Last active
November 9, 2017 15:50
-
-
Save jgmel/8aba673986094a08c1d249db70e65e88 to your computer and use it in GitHub Desktop.
Phoenix Card Reader-USB Smartcard Reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
main(){ | |
NCARD=0 | |
PREFIX=phoenix | |
rm -f /etc/udev/rules.d/99-usb-serial.rules | |
for n in /dev/ttyUSB*; do | |
let NCARD++ | |
UDEV_SERIAL=`udevadm info -a -p $(udevadm info -q path -n ${n}) | grep -B 12 'FT232R USB UART' | grep 'ATTRS{serial}'` | |
cat >> /etc/udev/rules.d/99-usb-serial.rules <<EOT | |
SUBSYSTEMS=="usb", KERNEL=="ttyUSB?", ${UDEV_SERIAL}, SYMLINK+="${PREFIX}${NCARD}" | |
EOT | |
echo "$n ==> /dev/${PREFIX}${NCARD}" | |
if [ ! -e /dev/${PREFIX}${NCARD} ]; then | |
ln -s $n /dev/${PREFIX}${NCARD} | |
fi | |
done | |
} | |
main | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment