Hello all,
I need to store some metadata about various CD drives, and have that information be accessible across reboots. I have a few ideas but I haven't figured out the best way to handle things yet. My current code does the following:
1) Registers with DiskArbitration for IOCDMedia events 2) When an event occurs, I grab the IOPath from the DADisk's description and match that with an io_service_t 3) I inspect the io_service_t's properties, particularly for kIOPropertySCSITaskUserClientInstanceGUID 4) I use the GUID to uniquely identify the device
Here is where I am a stuck; I would have expected that the GUID remains the same across reboots, but empirical evidence suggests this is not the case. So I can't use the GUID as a key for drive identification. This may be a good thing, since ROM drives may not be STUC devices and as such wouldn't have a GUID anyway.
My next idea was to use the drive's serial number via kIOPropertyProductSerialNumberKey, but while IOStorageDeviceCharacteristics.h says the key is mandatory it is missing for my drive:
"Device Characteristics" = { "BD Features" = 0; "CD Features" = 1791; "DVD Features" = 503; "Low Power Polling" = 1; "Power Off" = 0; "Product Name" = "DVD-R UJ-845E"; "Product Revision Level" = DMP2; "Vendor Name" = MATSHITA; };
So obviously this won't work either.
My third idea is to use the IOPath of the device, but is this a reliable way to uniquely identify a CD device? I have a feeling it isn't, but I'm not quite sure.
Is there another way to accomplish what I am trying to do?
Thanks, Stephen |