Newer kernels store device strings in memory on USB device init. This makes querying them later safe. (Thanks Greg KH)
This commit is contained in:
@@ -393,8 +393,6 @@ void GetNewStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
|
|||||||
if( ReadFile( sPath + "device/../idProduct", sBuf ) )
|
if( ReadFile( sPath + "device/../idProduct", sBuf ) )
|
||||||
sscanf( sBuf, "%x", &usbd.idProduct );
|
sscanf( sBuf, "%x", &usbd.idProduct );
|
||||||
|
|
||||||
/* These queries cause communication with the USB device. Disabling
|
|
||||||
* them may result in higher reliability. */
|
|
||||||
if( ReadFile( sPath + "device/../serial", sBuf ) )
|
if( ReadFile( sPath + "device/../serial", sBuf ) )
|
||||||
{
|
{
|
||||||
usbd.sSerial = sBuf;
|
usbd.sSerial = sBuf;
|
||||||
|
|||||||
Reference in New Issue
Block a user