add port detection through lsusb
This commit is contained in:
@@ -406,11 +406,14 @@ void GetNewStorageDevices( vector<UsbStorageDeviceEx>& vDevicesOut )
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Bus 002 Device 001: ID 0000:0000
|
// Bus 002 Device 001: ID 0000:0000
|
||||||
|
// Port 4
|
||||||
// iSerial 3 1125198948886
|
// iSerial 3 1125198948886
|
||||||
// bInterfaceClass 8 Mass Storage
|
// bInterfaceClass 8 Mass Storage
|
||||||
|
|
||||||
CString sCommand = "/usr/sbin/lsusb";
|
// Don't include a path. The usbutils installer script installs
|
||||||
char *szParams[] = { "/usr/sbin/lsusb", "-v", NULL };
|
// to /usr/local/sbin and the Debian package installs to /usr/sbin/.
|
||||||
|
CString sCommand = "lsusb";
|
||||||
|
char *szParams[] = { "lsusb", "-v", NULL };
|
||||||
CString sOutput;
|
CString sOutput;
|
||||||
RunProgram( sCommand, szParams, sOutput );
|
RunProgram( sCommand, szParams, sOutput );
|
||||||
|
|
||||||
@@ -433,6 +436,15 @@ void GetNewStorageDevices( vector<UsbStorageDeviceEx>& vDevicesOut )
|
|||||||
continue; // stop processing this line
|
continue; // stop processing this line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Port 4
|
||||||
|
int iPort;
|
||||||
|
iRet = sscanf( sLine.c_str(), "Port %d", &iPort );
|
||||||
|
if( iRet == 1 )
|
||||||
|
{
|
||||||
|
usbd.iPort = iPort;
|
||||||
|
continue; // stop processing this line
|
||||||
|
}
|
||||||
|
|
||||||
// iSerial 3 1125198948886
|
// iSerial 3 1125198948886
|
||||||
char szSerial[1024];
|
char szSerial[1024];
|
||||||
iRet = sscanf( sLine.c_str(), " iSerial %d %[^\n]", &iThrowAway, szSerial );
|
iRet = sscanf( sLine.c_str(), " iSerial %d %[^\n]", &iThrowAway, szSerial );
|
||||||
|
|||||||
Reference in New Issue
Block a user