Parse usbscsi

/usr/bin/parse_usbscsi is a proprietary Buffalo binary tool which is part of the stock LS2 firmware (and probably other LinkStations). Buffalo has not released the source code of the binary, and has apparently no intention to do this.

The tool is used as part of the script which is supposed to mount hot-plugged storage devices. It is supposed to identify the device name of hot-plugged storage devices. Unfortunately it likes to fail to e.g. identify memory cards. Further, it is rather strange that for this small task Buffalo decided to build a binary, while the following three lines of trivial scripting code does the same:

awk '$1 ~ /Host/ && $3 ~ /usb-storage/ { printf "/dev/sd%c\n", substr($2, 5, length($2) - 5) + 97 }' /proc/scsi/usb-storage-*/*