Commit fa500ebca438f896ba40791ab7245479aa8d237b
1 parent
9e185e7d
MAJ
Showing
2 changed files
with
3 additions
and
8 deletions
Show diff stats
site/fichiersRPI/fichiersRPI.zip
No preview for this file type
site/fichiersRPI/port.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | +base=`dirname $0` | ||
4 | +cd $base | ||
3 | data=$(dmesg | grep ttyACM | cut -f 7 -d " " | cut -f 1 -d : ) | 5 | data=$(dmesg | grep ttyACM | cut -f 7 -d " " | cut -f 1 -d : ) |
4 | code=$(echo $data | cut -f 1 -d " ") | 6 | code=$(echo $data | cut -f 1 -d " ") |
5 | -#echo $code | ||
6 | port=$(pwd | cut -c 17) | 7 | port=$(pwd | cut -c 17) |
7 | let port-- | 8 | let port-- |
8 | -#echo $port | ||
9 | dev="/dev/ttyACM" | 9 | dev="/dev/ttyACM" |
10 | name="$dev$port" | 10 | name="$dev$port" |
11 | commande=$(udevadm info --name=$name --attribute-walk | egrep "idVendor|idProduct|serial") | 11 | commande=$(udevadm info --name=$name --attribute-walk | egrep "idVendor|idProduct|serial") |
12 | idProduct=$(echo $commande | cut -f 1 -d " ") | 12 | idProduct=$(echo $commande | cut -f 1 -d " ") |
13 | idVendor=$(echo $commande | cut -f 2 -d " ") | 13 | idVendor=$(echo $commande | cut -f 2 -d " ") |
14 | serial=$(echo $commande | cut -f 3 -d " ") | 14 | serial=$(echo $commande | cut -f 3 -d " ") |
15 | -#echo $commande | ||
16 | -#echo $idProduct | ||
17 | -#echo $idVendor | ||
18 | -#echo $serial | ||
19 | newdev="ttyPR" | 15 | newdev="ttyPR" |
20 | newname="$newdev$port" | 16 | newname="$newdev$port" |
21 | -#echo $newname | ||
22 | rule="SUBSYSTEM==\"tty\", $serial, $idVendor, $idProduct, SYMLINK+=\"$newname\"" | 17 | rule="SUBSYSTEM==\"tty\", $serial, $idVendor, $idProduct, SYMLINK+=\"$newname\"" |
23 | -#echo $rule | ||
24 | echo $rule >> /etc/udev/rules.d/usb-serial.rules | 18 | echo $rule >> /etc/udev/rules.d/usb-serial.rules |
25 | udevadm trigger | 19 | udevadm trigger |
20 | + |