One idea which comes to mind here, involves the use of the
VolumeToBSDNode sample code. For each mounted volume, the sample
demonstrates how to equate each volume with the BSD node name, which
then can be used to determine whether the node is associated with a
CD, DVD, or other storage media. If you identify the storage media as
USB, then you can determine the locationID property.
I think if you start with this sample, you can go on to associate a
volume with a locationID, if the media is from a USB Storage device.
Of course, then the next question would be to distinguish USB Mass
Storage devices that are connected to your hub of interest, to those
mass storage devices that are direct connected to the Mac, or through
a different hub - like an iPod shuffle connected to the keyboard.
For this portion of the question, if one looks at the sources for the
IOUSBFamily, specifically at IOUSBDevice.cpp -
IOUSBDevice::SetProperties call, one can see that the location ID for
a device is presently based on the locationID of the hub to which the
device is attached. The USB engineering team has never documented
that this algorithm for assigning the locationID will remain true in
future releases, but it does show how things have been done until
now. The only documented feature of the locationID property is that
it will be unique for each attached device.
best wishes
rich kubota
At 12:22 AM -0700 5/26/05, B. Mitchell Loebel wrote:
Hello list and Fernando:
Perhaps I should clarify my question in the context of what I now
understand about locationID. I originally framed my question as
follows:
"I have an N port hub connected to a Mac USB port. This hub is
permanently connected. Each of the N ports of my external hub has an
SD reader device permanently connected. When a removable SD flash is
inserted into one of the readers I get a volume mounted event so that
I can get the name of the mounted volume and then copy a file from my
hard drive to the SD flash ... no problem. I would like my code to
tell me which physical reader contains the mounted volume."
Now I see that each flash reader will acquire a 32 bit locationID
when it is connected to the USB bus system and I can pick up those
numbers with a callback which responds to a deviceAdded notification.
Of course, I can't know the ordering of the USB enumeration, so I
can't know which locationID binds with which physical port.
Additionally, my code supports a mount event so that I have a
callback that responds to a flash media being put into one of the USB
reader devices. The fundamental question is how can I determine which
physical port contains the flash media that mounts? Inasmuch as I
can't know which locationID binds with which physical port, I don't
see how knowing the locationIDs for each of the readers helps me.
At 10:25 PM -0600 5/25/05, Fernando Urbina wrote:
I think that the best that you can do is get the locationID of the
device in question. This number is persistent across restarts, as
long as the bus topology remains the same (which sounds like it will
from your description). What you do with this location ID is up to
you ;-)
HTH,
--
Fernando Urbina
USB Technology Team
Apple Computer, Inc.
On May 25, 2005, at 10:07 PM, B. Mitchell Loebel wrote:
As an example, Windows explorer binds a drive letter to a reader
whether or not the removable flash is inserted in the reader. And
that drive letter persists for the entire session even after the
removable flash has been removed. How can I do the same under OSX
... Carbon, please?
--
-----
B. Mitchell Loebel 408 425-9920 cell
Executive Director
The Tech Startup Connection
(formerly The PARALLEL Processing Connection)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden
--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden