I wondered when I had to find the USB device name in Linux using shell script (shell command), it was little tricky, specially in case of UDEV.
You can use different methods to get this like using udevinfo command, from sysfs, from /var/log/messages.
Using udevinfo:
for DEV in /dev/sd*; do
udevinfo -q env -n $DEV 2>/dev/null | grep "ID_BUS=usb";
done
Using sysfs:
Change this according to your need.
find /sys/bus/usb/drivers/usb-storage/[1-9]-[0-1]\:1.0/|grep -wo sd\[a-z]|head -1
Using /var/log/messages:
Grep the usb device in /var/log/messages file, when usb device is connected.
I hope USB device can be detected easily now.
Pingback: Linux console - programmatical detection of which device a USB storage is assigned to - Just just easy answers