Querying the connecting device for usb devices in OS X
Ok, so here's the setup. In OS X (>= 10.5开发者_如何学编程), is it possible, given a mounted usb device with a known location, say /Volumes/FLASHDRIVE, to find out whether this device is connecting through another usb device (a card reader for example) and if so, which one.
Ideally, this could all be done in python, but if not that's ok too.
You're confusing the term device with the term volume--in this example (and in most real world situations) there would only be one device involved.
The state of most hardware falls under the purview of IOKit, and the only way you can possibly get to this information from Python is through careful parsing of the ioreg tool's output.
精彩评论