1
votes

I'd like to make a program that will detect which /dev/sd* entry is linked to a known USB VID/PID pair.

Do you know how I can get the VID/PID of a USB stick that would appear as /dev/sd*?

1
I'd look into libudev.David Grayson

1 Answers

4
votes

you can use udevadm for this

in the output of udevadm info -q property -n /dev/sd* the VID is in the ID_VENDOR_ID field and the PID is in the ID_MODEL_ID field

you can extract this using grep / sed...