Commit 77cb2c36 authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Update unbind ftdi script, using variables

parent 351d0e46
#!/bin/sh
echo "Add udev rule so 0403:6001 devices do not load ftdi_sio driver"
VENDOR=${1:-0403}
PRODUCT=${2:-6001}
FILE=${3:-99-ftdi.rules}
LINE1='ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE:="0666"'
LINE2=$'ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", RUN+="/bin/sh -c \'echo $kernel > /sys/bus/usb/drivers/ftdi_sio/unbind\'"'
FILE=/etc/udev/rules.d/99-ftdi.rules
echo "Add udev rule so ${VENDOR}:${PRODUCT} devices do not load ftdi_sio driver"
LINE0="#The following 2 lines make ${VENDOR}:${PRODUCT} devices not load ftdi_sio driver"
LINE1="ATTRS{idVendor}==\"${VENDOR}\", ATTRS{idProduct}==\"${PRODUCT}\", MODE:=\"0666\""
LINE2=$"ATTRS{idVendor}==\"${VENDOR}\", ATTRS{idProduct}==\"${PRODUCT}\", RUN+=\"/bin/sh -c 'echo \$kernel > /sys/bus/usb/drivers/ftdi_sio/unbind'\""
FILE=/etc/udev/rules.d/$FILE
sudo touch $FILE
grep -qF -- "$LINE0" "$FILE" || echo "$LINE0" | sudo tee -a "$FILE" > /dev/null
grep -qF -- "$LINE1" "$FILE" || echo "$LINE1" | sudo tee -a "$FILE" > /dev/null
grep -qF -- "$LINE2" "$FILE" || echo "$LINE2" | sudo tee -a "$FILE" > /dev/null
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment