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
VulpesPosted Nov 2, 2011, 12:28 PM
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.
Javeed M ShaikhPosted Nov 2, 2011, 11:41 AM
http://msdn.microsoft.com/en-us/magazine/cc302051.aspx
but i think if you can get your results with the driveinfo class, use that.
Sutton MehaffeyPosted Nov 2, 2011, 11:22 AM
Javeed M ShaikhPosted Nov 2, 2011, 11:18 AM
using System.Management;
using System.Management.Instrumentation;
Console.ReadKey();
Sutton MehaffeyPosted Nov 2, 2011, 11:06 AM
using System.Management;
using System.Management.Instrumentation;
ManagementClass mgmt = new ManagementClass("Win32_PhysicalMedia");
ManagementObjectCollection mcol = mgmt.GetInstances();
Javeed M ShaikhPosted Nov 2, 2011, 10:59 AM
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 MehaffeyPosted Nov 2, 2011, 10:39 AM
Sutton
Javeed M ShaikhPosted Nov 2, 2011, 10:25 AM