I have OpenWrt on a Raspberry Pi,on which I plug two Arduino Uno boards.
I run lsusb to get the Product/Vendor IDs and get this:
Bus 001 Device 005: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 001 Device 006: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
I have made this in hotplug.d,but it only works if there is only one Arduino plugged:
#!/bin/sh
ARD_PRODID="2341/43/1"
SYMLINK="arduino_sensors"if[ "${PRODUCT}" = "${ARD_PRODID}" ];
then if [ "${ACTION}" = "add" ];
then
DEVICE_NAME = $(ls /sys/$DEVPATH | grep tty)
if [ -z ${DEVICE_NAME} ];
then logger -t Hotplug Warning DEVICE_NAME is empty
exit
fi
logger -t Hotplug Device name of ARD is $DEVICE_NAME
ln -s /dev/$DEVICE_NAME /dev/${SYMLINK}
logger -t Hotplug Symlink from /dev/$DEVICE_NAME to /dev/${SYMLINK} created
fi
fiif [ "${PRODUCT}" = "${ARD_PRODID}" ];
then if [ "${ACTION}" = "remove" ];
then
rm /dev/${SYMLINK}
logger -t Hotplug Symlink /dev/${SYMLINK} removed
fi
fi
How could I use the Serial Numbers of the boards instead of just the IDs to distinguish between them?