I have a flash drive where I know its vendor ID and product ID.
By scanning through /sys/bus/usb/devices
, I can reliably find the enumeration point for the root device (e.g. /sys/bus/usb/devices/3-1
) and the enumeration point for the mass storage device (e.g. /sys/bus/usb/devices/3-1:1.0
).
Once I know the two enumeration points, how do I use these to lookup the mountpoint (e.g. /mnt/usb0/part0
or /mnt/UsbStorageA
)?
--
Alternatively, is there a direct way to get the mountpoint from the vendor ID and product ID?
--
EDIT 1 (more details on my progress):
Ok so (working backward from the mountpoint):
mountpoint: /storage/usb0/part0
(according to /proc/mount
)
device node: /dev/block/vold/8:1
(according to /proc/mount
)
partition name sda1
(according to /proc/partitions
)
But I can't seem to correlate into /sys/block
, because there is no sda1
entry in /sys/block
, and neither is there any 8:1
entry in /sys/dev/block
. Instead, bizarrely, the USB device is in /sys/dev/char
, as 189:261
. Why the heck would it appear as a char device but not a block device? :-(