Re: Identifying CD drives across reboots
Re: Identifying CD drives across reboots
- Subject: Re: Identifying CD drives across reboots
- From: Andre-John Mas <email@hidden>
- Date: Mon, 17 Dec 2007 21:53:36 -0500
On 14-Dec-07, at 22:56 , Stephen F. Booth wrote:
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?
While I can't necessarily provide the answer you are looking for, what
I can suggest is checking to see if IORegistryExplorer can see a
serial number for your drive. If it does, then it would suggest that
there is a way to get it.
Andre
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden