I am trying to find out which port an SD card w/reader has been assigned to in C#. If I use the SerialPort class (SerialPort.GetPortNames), that doesn't work. It gives me COM1 and COM3, with or without the SD card and reader inserted via USB port. I've downloaded the LibUsbDotNet Namespace, but I can't find any classes that have any Methods that seem to do what I need. It's really a disk drive access, so maybe that's different. Anybody know a way I can get information on whether an SD card has been inserted or not and what the drive name is?
Sutton
Loading

Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 2, 2011, 6:25 AM EDT
Sutton Mehaffey19 reputationPosted Nov 2, 2011, 6:39 AM EDT
Sutton
Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 2, 2011, 6:59 AM EDT
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
or try this:
using System.Management;
using System.Management.Instrumentation;
ManagementClass mgmt = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection mcol = mgmt.GetInstances();
Sutton Mehaffey19 reputationPosted Nov 2, 2011, 7:06 AM EDT
using System.Management;
using System.Management.Instrumentation;
ManagementClass mgmt = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection mcol = mgmt.GetInstances();
Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 2, 2011, 7:18 AM EDT
using System.Management;
using System.Management.Instrumentation;
Console.ReadKey();
Sutton Mehaffey19 reputationPosted Nov 2, 2011, 7:22 AM EDT
Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 2, 2011, 7:41 AM EDT
http://msdn.microsoft.com/en-us/magazine/cc302051.aspx
but i think if you can get your results with the driveinfo class, use that.
VulpesRank #55 · 29.2K reputationPosted Nov 2, 2011, 8:28 AM EDT
However, the DriveInfo.DriveType property can tell you whether its removable media such as an SD card, which may suffice if no other info is required.