Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WMI and the difference between memory cards and USB drives

WMI and the difference between memory cards and USB drives

Scheduled Pinned Locked Moved C#
hardwareperformance
16 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B brian shapiro

    I've noticed in Device Manager that the Mass Storage Devices for the multi-card readers I own have a "Bus reported device description" of "Mass Storage Device" -- a generic name -- but the one for the USB drive instead has the description of the device name. Is this at all significant? And where does the "Bus reported device description" come from?

    M Offline
    M Offline
    Michel Godfroid
    wrote on last edited by
    #7

    Educated guesswork, don't quote me on this :) : Real hard disk devices have firmware, and it's the firmware that reports this. (it will usually correspond to the 'friendly device name', I think). Disk drive producers will often include free utilities (such as some backup crapware), which will only run on their kit. The software has to check if their kit is connected, and it will do that by checking this field. Often, firmware must also be updated, usually using specific IOCTLs, and the firmware update utilities must be sure they don't clobber some other manufacturer's. This field may help in checking the origin of the kit before they issue their 'zap and destroy' IOCTLs. Some USB disk assemblies also offer firmware RAID configurations, and this may help their raid configuration utilities in determining the command set to configure them. A storage card has no firmware, and so cannot report anything here (there may be exceptions, but I haven't come across any). If there's anything firmware worth reporting, it will be at the composite device level. Anyway, a storage card can only report anything when it's inserted, so this probably wouldn't serve your purpose.

    B 1 Reply Last reply
    0
    • M Michel Godfroid

      Educated guesswork, don't quote me on this :) : Real hard disk devices have firmware, and it's the firmware that reports this. (it will usually correspond to the 'friendly device name', I think). Disk drive producers will often include free utilities (such as some backup crapware), which will only run on their kit. The software has to check if their kit is connected, and it will do that by checking this field. Often, firmware must also be updated, usually using specific IOCTLs, and the firmware update utilities must be sure they don't clobber some other manufacturer's. This field may help in checking the origin of the kit before they issue their 'zap and destroy' IOCTLs. Some USB disk assemblies also offer firmware RAID configurations, and this may help their raid configuration utilities in determining the command set to configure them. A storage card has no firmware, and so cannot report anything here (there may be exceptions, but I haven't come across any). If there's anything firmware worth reporting, it will be at the composite device level. Anyway, a storage card can only report anything when it's inserted, so this probably wouldn't serve your purpose.

      B Offline
      B Offline
      brian shapiro
      wrote on last edited by
      #8

      Actually it kind of would serve my purpose -- I just want to determine whether a logical disk is hosted by a card reader, or is hosted by a USB drive. If I could determine the 'bus reported' description for any given USB Mass Storage Device.. but I don't know how to do that. Can you help?

      M 1 Reply Last reply
      0
      • B brian shapiro

        Actually it kind of would serve my purpose -- I just want to determine whether a logical disk is hosted by a card reader, or is hosted by a USB drive. If I could determine the 'bus reported' description for any given USB Mass Storage Device.. but I don't know how to do that. Can you help?

        M Offline
        M Offline
        Michel Godfroid
        wrote on last edited by
        #9

        I'll dig around a bit, don't expect anything today, bedtime coming soon in my timezone :zzz:

        B 1 Reply Last reply
        0
        • M Michel Godfroid

          I'll dig around a bit, don't expect anything today, bedtime coming soon in my timezone :zzz:

          B Offline
          B Offline
          brian shapiro
          wrote on last edited by
          #10

          Based on the devices that I have, I figured out that you can expect a USB Flash Drive to have PDCAP_D2_SUPPORTED under "Power data" in Device Manager, but not a memory card. So I used a PInvoke to DevicePowerEnumDevices in PowrProf.dll ( http://msdn.microsoft.com/en-us/library/aa372681(VS.85).aspx[^] ). That allowed me to filter by the device name in Win32_DiskDrive.Model and the PDCAP_D2_SUPPORTED flag.

          M 1 Reply Last reply
          0
          • B brian shapiro

            Based on the devices that I have, I figured out that you can expect a USB Flash Drive to have PDCAP_D2_SUPPORTED under "Power data" in Device Manager, but not a memory card. So I used a PInvoke to DevicePowerEnumDevices in PowrProf.dll ( http://msdn.microsoft.com/en-us/library/aa372681(VS.85).aspx[^] ). That allowed me to filter by the device name in Win32_DiskDrive.Model and the PDCAP_D2_SUPPORTED flag.

            M Offline
            M Offline
            Michel Godfroid
            wrote on last edited by
            #11

            Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?

            B 4 Replies Last reply
            0
            • M Michel Godfroid

              Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?

              B Offline
              B Offline
              brian shapiro
              wrote on last edited by
              #12

              Actually, this doesn't seem to be working.. I thought it was, but I must have been mistaken. The internal card readers don't support D2, but the external card readers do.

              1 Reply Last reply
              0
              • M Michel Godfroid

                Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?

                B Offline
                B Offline
                brian shapiro
                wrote on last edited by
                #13

                I figured out what I did wrong --- you have to do a check on the Logical Disk name, not the Disk Drive name. The Disk Drive for the card reader supports more power states, and the Portable Device (listed in Device Manager) supports even more, including D1.

                1 Reply Last reply
                0
                • M Michel Godfroid

                  Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?

                  B Offline
                  B Offline
                  brian shapiro
                  wrote on last edited by
                  #14

                  Except that only seems to work for one flash drive I have and not another. I'll continue to investigate that.

                  1 Reply Last reply
                  0
                  • M Michel Godfroid

                    Sounds reasonable. This would probably correspond to a 'spin-down' on USB disks, which makes no sense on flash cards (they are only required to support D0 and D3, fully ON and fully OFF). Wonder what an SSD would have in this case?

                    B Offline
                    B Offline
                    brian shapiro
                    wrote on last edited by
                    #15

                    It was my error; the problem was it didn't find a drive with that drive letter because it was referring to the Portable Device, and thats listed by the Volume name if there is one. But I finally found something that works! If you enumerate the hardware ID strings for the devices that support D2, the only ones that show up are the ones for flash drives. The memory cards are enumerated I think, but a query for the hardware ID returns an empty string. So you have to find the PnPEntity associated with the DiskDrive, and take the first indexed HardwareID. No problems with this so far..

                    B 1 Reply Last reply
                    0
                    • B brian shapiro

                      It was my error; the problem was it didn't find a drive with that drive letter because it was referring to the Portable Device, and thats listed by the Volume name if there is one. But I finally found something that works! If you enumerate the hardware ID strings for the devices that support D2, the only ones that show up are the ones for flash drives. The memory cards are enumerated I think, but a query for the hardware ID returns an empty string. So you have to find the PnPEntity associated with the DiskDrive, and take the first indexed HardwareID. No problems with this so far..

                      B Offline
                      B Offline
                      brian shapiro
                      wrote on last edited by
                      #16

                      Just so people reading this know... it turns out the original solution I found is working again. I don't know if it was a glitch in how my system was reporting the information or whether the second, more thorough method is just more fool-proof. I'm getting the power data through setupapi.dll rather than through powerprof.dll though, since I'm trying to move away from WMI.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups