[usb] fix default listing for ADATA USB HDDs

* Also improve debug print statement in USB enumeration
* Closes #610
This commit is contained in:
Pete Batard 2015-10-03 23:47:06 +01:00
parent 2cfb53c34e
commit e1d0ab73a5
4 changed files with 18 additions and 27 deletions

View File

@ -77,7 +77,6 @@ static str_score_t str_score[] = {
{ "TOSHIBA", 5 },
{ "QUANTUM", 10 },
{ "EXCELSTOR", 10 },
{ "ADATA", -15 },
{ "CORSAIR", -15 },
{ "KINGMAX", -15 },
{ "KINGSTON", -15 },

View File

@ -115,6 +115,7 @@ extern void _uprintf(const char *format, ...);
#define vuprintf(...) if (verbose) _uprintf(__VA_ARGS__)
#define vvuprintf(...) if (verbose > 1) _uprintf(__VA_ARGS__)
#define suprintf(...) if (!bSilent) _uprintf(__VA_ARGS__)
#define uuprintf(...) if (usb_debug) _uprintf(__VA_ARGS__)
#ifdef _DEBUG
#define duprintf(...) _uprintf(__VA_ARGS__)
#else

View File

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.5.764"
CAPTION "Rufus 2.5.765"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -319,8 +319,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,5,764,0
PRODUCTVERSION 2,5,764,0
FILEVERSION 2,5,765,0
PRODUCTVERSION 2,5,765,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -337,13 +337,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.5.764"
VALUE "FileVersion", "2.5.765"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.5.764"
VALUE "ProductVersion", "2.5.765"
END
END
BLOCK "VarFileInfo"

View File

@ -136,9 +136,9 @@ static __inline BOOL IsVHD(const char* buffer)
/* For debugging user reports of HDDs vs UFDs */
//#define FORCED_DEVICE
#ifdef FORCED_DEVICE
#define FORCED_VID 0x0930
#define FORCED_PID 0x6544
#define FORCED_NAME "TOSHIBA TransMemory USB Device"
#define FORCED_VID 0x125F
#define FORCED_PID 0xA11A
#define FORCED_NAME "ABATA CH11 USB Device"
#endif
/*
@ -189,8 +189,7 @@ BOOL GetUSBDevices(DWORD devnum)
if (htab_create(DEVID_HTAB_SIZE, &htab_devid)) {
dev_info_data.cbSize = sizeof(dev_info_data);
for (i=0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) {
if (usb_debug)
uprintf("Processing Hub %d:", i + 1);
uuprintf("Processing Hub %d:", i + 1);
devint_detail_data = NULL;
devint_data.cbSize = sizeof(devint_data);
// Only care about the first interface (MemberIndex 0)
@ -205,22 +204,19 @@ BOOL GetUSBDevices(DWORD devnum)
if (CM_Get_Child(&device_inst, dev_info_data.DevInst, 0) == CR_SUCCESS) {
device_id[0] = 0;
s = StrArrayAdd(&dev_if_path, devint_detail_data->DevicePath);
if (usb_debug)
uprintf(" Hub[%d] = '%s'", s, devint_detail_data->DevicePath);
uuprintf(" Hub[%d] = '%s'", s, devint_detail_data->DevicePath);
if ((s>= 0) && (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS)) {
if ((k = htab_hash(device_id, &htab_devid)) != 0) {
htab_devid.table[k].data = (void*)(uintptr_t)s;
}
if (usb_debug)
uprintf(" Found ID[%03d]: %s", k, device_id);
uuprintf(" Found ID[%03d]: %s", k, device_id);
while (CM_Get_Sibling(&device_inst, device_inst, 0) == CR_SUCCESS) {
device_id[0] = 0;
if (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS) {
if ((k = htab_hash(device_id, &htab_devid)) != 0) {
htab_devid.table[k].data = (void*)(uintptr_t)s;
}
if (usb_debug)
uprintf(" Found ID[%03d]: %s", k, device_id);
uuprintf(" Found ID[%03d]: %s", k, device_id);
}
}
}
@ -300,8 +296,7 @@ BOOL GetUSBDevices(DWORD devnum)
memset(buffer, 0, sizeof(buffer));
props.is_VHD = SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_HARDWAREID,
&datatype, (LPBYTE)buffer, sizeof(buffer), &size) && IsVHD(buffer);
if (usb_debug)
uprintf("Processing Device: '%s'", buffer);
uuprintf("Processing Device: '%s'", buffer);
memset(buffer, 0, sizeof(buffer));
if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME,
@ -324,8 +319,7 @@ BOOL GetUSBDevices(DWORD devnum)
props.is_UASP = ((((uintptr_t)device_id)+2) >= ((uintptr_t)devid_list)+list_start[1]);
// Now get the properties of the device, and its Device ID, which we need to populate the properties
j = htab_hash(device_id, &htab_devid);
if (usb_debug)
uprintf(" Matched with ID[%03d]: %s", j, device_id);
uuprintf(" Matched with ID[%03d]: %s", j, device_id);
// Try to parse the current device_id string for VID:PID
// We'll use that if we can't get anything better
@ -354,12 +348,10 @@ BOOL GetUSBDevices(DWORD devnum)
device_id = str;
method_str = "[GP]";
j = htab_hash(device_id, &htab_devid);
if (usb_debug)
uprintf(" Matched with (GP) ID[%03d]: %s", j, device_id);
uuprintf(" Matched with (GP) ID[%03d]: %s", j, device_id);
}
if ((uintptr_t)htab_devid.table[j].data > 0) {
if (usb_debug)
uprintf(" Matched with Hub[%d]: '%s'", (uintptr_t)htab_devid.table[j].data,
uuprintf(" Matched with Hub[%d]: '%s'", (uintptr_t)htab_devid.table[j].data,
dev_if_path.String[(uintptr_t)htab_devid.table[j].data]);
if (GetUSBProperties(dev_if_path.String[(uintptr_t)htab_devid.table[j].data], device_id, &props))
method_str = "";
@ -380,8 +372,7 @@ BOOL GetUSBDevices(DWORD devnum)
if (is_SCSI) {
// If we have an SCSI drive and couldn't get a VID:PID, we are most likely
// dealing with a system drive => eliminate it!
if (usb_debug)
uprintf(" Non USB => Eliminated");
uuprintf(" Non USB => Eliminated");
continue;
}
safe_strcpy(str, sizeof(str), "????:????"); // Couldn't figure VID:PID