Followers

Thursday, 12 October 2017

Get the device id of usb reader from drive letter

Source: stackoverflow.com --- Wednesday, October 11, 2017
After inserting, an sd reader WITH NO card, a removable drive appears in Windows with a drive letter. I need to find the device id of that reader without having a card inserted. I can have many readers inserted at any time. Currently I am subscribed to Win32_VolumeChangedEvent to catch the insertions. That gives me the drive letter. var insertQuery = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2"); var insertWatcher = new ManagementEventWatcher(insertQuery); insertWatcher.EventArrived += DeviceInsertedEvent; insertWatcher.Start(); Querying WMI I can get the PNPDeviceID from Win32_DiskDrive but no drive letter as the drive letter is a property of Win32_LogicalDisk . I can't map between the two objects since Win32_DiskPartition doesn't show my card readers without SD cards. Am I missing a way relate the objects I need? Or is there another way to look up the device id on insertion or from drive letter? ...



from Windows http://ift.tt/2xz7zm0

No comments:

Post a Comment