I have already done a search for stackoverflow.com and google for an answer, but have not found anything.
I have a bsdName partition (disk1s1) that belongs to an external USB hard drive (disk1).
I need to find out the serial number of this external hard drive. I already tried the following (look for a service called bsd):
io_service_t io_service = IOServiceGetMatchingService(kIOMasterPortDefault,IOBSDNameMatching(kIOMasterPortDefault, 0, [@"disk1" cStringUsingEncoding:NSUTF8StringEncoding]));
The problem with this: A return type of service IOMediathat does not have a field USB Serial Number. I get the same problem if I use DiskArbitrationframework (this is an abstraction for IOMedia)
So, I tried the other way around: get all the IOUSBDeviceservices to iterate over them and just search for bsdName or sections on IOUSBDevice. Unfortunately, information about any sections or bsd names is not stored in IOUSBDevice.
Can someone help me with this problem?
Additional Information:
- Xcode 4.3.2
- Mac OS X Lion (10.7.3)
EDIT:
Here is the interesting part of the output if I repeat all IOUSBDevice or AppleUSBEHCI io_services:
Child props: {
"Bus Power Available" = 250;
"Device Speed" = 2;
IOCFPlugInTypes = {
"9dc7b780-9ec0-11d4-a54f-000a27052861" = "IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle";
};
IOGeneralInterest = "IOCommand is not serializable";
IOUserClientClass = IOUSBDeviceUserClientV2;
"Low Power Displayed" = 0;
PortNum = 3;
"Requested Power" = 250;
"USB Address" = 6;
"USB Product Name" = "Mass Storage Device";
"USB Serial Number" = 09021000000000003740385375;
"USB Vendor Name" = JetFlash;
bDeviceClass = 0;
bDeviceProtocol = 0;
bDeviceSubClass = 0;
bMaxPacketSize0 = 64;
bNumConfigurations = 1;
bcdDevice = 2560;
iManufacturer = 1;
iProduct = 2;
iSerialNumber = 3;
idProduct = 4096;
idVendor = 34148;
kHasMSCInterface = 1;
locationID = "-99418112";
sessionID = 209792844564562;
uid = "USB:85641000003740385375";
}
As you can see, I get the serial number, but I have no way to tell which bsd name for this device has.
source
share