From f31a90bba2be5b32d539cdd16f6c28858edc0459 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 6 Jun 2016 00:36:56 +0100 Subject: [PATCH] [enum] add support for O2Micro PCI-E card readers * Part of #767 --- src/dev.c | 17 ++++++++++++++++- src/rufus.rc | 10 +++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/dev.c b/src/dev.c index 7c98f084..0e20843f 100644 --- a/src/dev.c +++ b/src/dev.c @@ -182,6 +182,11 @@ BOOL GetDevices(DWORD devnum) "SD", "PCISTOR", "RTSOR", "JMCR", "JMCF", "RIMMPTSK", "RIMSPTSK", "RIXDPTSK", "TI21SONY", "ESD7SK", "ESM7SK", "O2MD", "O2SD", "VIACR" }; + // Oh, and we also have card devices (e.g. 'SCSI\DiskO2Micro_SD_...') under the SCSI enumerator... + const char* scsi_disk_prefix = "SCSI\\Disk"; + const char* scsi_card_name[] = { + "_SD_", "_MMC_", "_MS_", "_MSPro_", "_xDPicture_", "_O2Media_" + }; const char* usb_speed_name[USB_SPEED_MAX] = { "USB", "USB 1.0", "USB 1.1", "USB 2.0", "USB 3.0" }; // Hash table and String Array used to match a Device ID with the parent hub's Device Interface Path htab_table htab_devid = HTAB_EMPTY; @@ -369,6 +374,15 @@ BOOL GetDevices(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); + // Additional detection for SCSI card readers + if ((!props.is_CARD) && (safe_strnicmp(buffer, scsi_disk_prefix, sizeof(scsi_disk_prefix)-1) == 0)) { + for (j = 0; j < ARRAYSIZE(scsi_card_name); j++) { + if (safe_strstr(buffer, scsi_card_name[j]) != NULL) { + props.is_CARD = TRUE; + break; + } + } + } uuprintf(" Hardware ID: '%s'", buffer); memset(buffer, 0, sizeof(buffer)); @@ -462,11 +476,12 @@ BOOL GetDevices(DWORD devnum) } else if ((props.is_CARD) && ((!props.is_USB) || ((props.vid == 0) && (props.pid == 0)))) { uprintf("Found card reader device '%s'", buffer); } else if ((!props.is_USB) && (!props.is_UASP) && (props.is_Removable)) { - uprintf("Found non-USB removable device '%s' => Eliminated", buffer); if (!list_non_usb_removable_drives) { + uprintf("Found non-USB removable device '%s' => Eliminated", buffer); uuprintf("If you *REALLY* need, you can enable listing of this device with "); continue; } + uprintf("Found non-USB removable device '%s'", buffer); } else { if ((props.vid == 0) && (props.pid == 0)) { if (!props.is_USB) { diff --git a/src/rufus.rc b/src/rufus.rc index 4f38e30f..b84c4a20 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,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 EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 2.10.952" +CAPTION "Rufus 2.10.953" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -320,8 +320,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,952,0 - PRODUCTVERSION 2,10,952,0 + FILEVERSION 2,10,953,0 + PRODUCTVERSION 2,10,953,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -338,13 +338,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.10.952" + VALUE "FileVersion", "2.10.953" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.10.952" + VALUE "ProductVersion", "2.10.953" END END BLOCK "VarFileInfo"