1.修复插入usb识别问题
This commit is contained in:
parent
0d75e82d10
commit
0c835f714d
|
@ -72,6 +72,7 @@ static BOOL System_WaitUsbDev(void)
|
|||
break;
|
||||
|
||||
vos_util_delay_ms(10);
|
||||
cnt++;
|
||||
} while(cnt < timeout);
|
||||
|
||||
if(exit_code == 0)
|
||||
|
@ -103,6 +104,22 @@ static BOOL System_check_usb_host(void)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL System_check_usb_dev(void)
|
||||
{
|
||||
char command[26] = "lsmod | grep nvt_usb2dev";
|
||||
FILE *fp = popen(command, "r");
|
||||
char result[256];
|
||||
fgets(result, sizeof(result), fp);
|
||||
pclose(fp);
|
||||
if (result[0] == '\0') {
|
||||
printf("nvt_usb2dev module is not loaded.\n");
|
||||
return FALSE;
|
||||
} else {
|
||||
printf("nvt_usb2dev module is loaded.\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL System_InsmodUsb(BOOL isHost)
|
||||
{
|
||||
char** usb_drivers = NULL;
|
||||
|
@ -178,13 +195,13 @@ static BOOL System_RmmodUsb(BOOL isHost)
|
|||
|
||||
if(isHost){
|
||||
|
||||
if(is_usb_host_driver_inserted == FALSE)
|
||||
if(System_check_usb_host() == FALSE)
|
||||
return TRUE;
|
||||
|
||||
usb_drivers = usb_host_drivers;
|
||||
}
|
||||
else{
|
||||
if(is_usb_dev_driver_inserted == FALSE)
|
||||
if(System_check_usb_dev() == FALSE)
|
||||
return TRUE;
|
||||
|
||||
usb_drivers = usb_dev_drivers;
|
||||
|
|
Loading…
Reference in New Issue
Block a user