Des scripts pour faciliter le reconditionnement de portables - retour accueil
git clone git://bebou.netlib.re/scripts-reco
Log | Files | Refs | README |
pad (1102B)
1 # pad 2 pause "Il va falloir appuyer sur toutes les touches du pad" 3 4 update_layout() { 5 [ -f "$tmpdir/kbd_valid" ] && regex="$(< $tmpdir/kbd_valid paste -s -d '|' -)" || regex="^$" 6 < "$disposition" awk "/$regex/ {printf \"%s%s%s\n\",\"$vert\",\$0,\"$norm\";next}1" 7 } 8 9 launch_xev() { 10 stdbuf -i0 -o0 xev | $awk_inter ' 11 /^MotionNotify/ {print $1} 12 /button [0-9]+/ {print substr($4,1,1)}' > $tmpdir/kbd_fifo& 13 awk_pid=$! 14 } 15 16 command -V mawk > /dev/null && awk_inter="mawk -W interactive" || awk_inter="stdbuf -i0 -o0 gawk" 17 18 disposition=clavier/pad 19 [ ! -p "$tmpdir/kbd_fifo" ] && mkfifo $tmpdir/kbd_fifo 20 21 launch_xev 22 23 while read key;do 24 clear 25 informer "1=clique gauche\n2=clique molette\n3=clique droit\nMotionNotify=bouger le curseur" 26 update_layout 27 if ! ps -q "$awk_pid" > /dev/null;then 28 launch_xev 29 fi 30 printf "verification de $key, ligne $i\n" 31 while read entered;do 32 if [ "$entered" = "$key" ];then 33 printf "^%s$\n" "$key" >> $tmpdir/kbd_valid;break 34 else 35 printf "reçu : %s, voulu : %s\n" "$entered" "$key" 36 fi 37 done < $tmpdir/kbd_fifo 38 done < "$disposition" 39 40 clear 41 update_layout | sauver