scripts-reco

Des scripts pour faciliter le reconditionnement de portables - retour accueil

git clone git://bebou.netlib.re/scripts-reco

Log | Files | Refs | README |

commit afe7da1f868e7f3679e8479ea83d98330b47e155
parent 5f8276fb58355e01412f88eff1f1c5586793bec3
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 20 Mar 2025 15:17:16 +0100

Factorisation du lancement de xev correction bug

Le bug était que j'avais copié collé le filtre awk du pad dans le
clavier, on ne recevait plus les évènements du clavier.
La factorisation est explicite.

Diffstat:
Mtests/clavier | 20+++++++++++---------
Mtests/pad | 19+++++++++++--------
2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/tests/clavier b/tests/clavier @@ -8,23 +8,24 @@ update_layout() { column -ts ' ' } +launch_xev() { + stdbuf -i0 -o0 xev | $awk_inter ' + /^Key(Press|Release)/ {type=$1} + /keycode [0-9]+/ && !(NR%2) {print substr($7,0,index($7,")")-1)}' > $tmpdir/kbd_fifo& + awk_pid=$! +} + command -V mawk > /dev/null && awk_inter="mawk -W interactive" || awk_inter="stdbuf -i0 -o0 gawk" disposition=$(find clavier -type f -name '*.kbd' | fzy) [ ! -p "$tmpdir/kbd_fifo" ] && mkfifo $tmpdir/kbd_fifo -stdbuf -i0 -o0 xev | $awk_inter ' - /^Key(Press|Release)/ {type=$1} - /keycode [0-9]+/ && !(NR%2) {print substr($7,0,index($7,")")-1)}' > $tmpdir/kbd_fifo& -awk_pid=$! +launch_xev while read key;do clear;update_layout; if ! ps -q "$awk_pid" > /dev/null;then - stdbuf -i0 -o0 xev | $awk_inter ' - /^Key(Press|Release)/ {type=$1} - /keycode [0-9]+/ && !(NR%2) {print substr($7,0,index($7,")")-1)}' > $tmpdir/kbd_fifo& - awk_pid=$! + launch_xev fi printf "verification de $key, ligne $i\n" while read entered;do @@ -35,5 +36,6 @@ while read key;do fi done < $tmpdir/kbd_fifo done < "$disposition" -update_layout | sauver +clear +update_layout | sauver diff --git a/tests/pad b/tests/pad @@ -6,25 +6,26 @@ update_layout() { < "$disposition" awk "/$regex/ {printf \"%s%s%s\n\",\"$vert\",\$0,\"$norm\";next}1" } +launch_xev() { + stdbuf -i0 -o0 xev | $awk_inter ' + /^MotionNotify/ {print $1} + /button [0-9]+/ {print substr($4,1,1)}' > $tmpdir/kbd_fifo& + awk_pid=$! +} + command -V mawk > /dev/null && awk_inter="mawk -W interactive" || awk_inter="stdbuf -i0 -o0 gawk" disposition=clavier/pad [ ! -p "$tmpdir/kbd_fifo" ] && mkfifo $tmpdir/kbd_fifo -stdbuf -i0 -o0 xev | $awk_inter ' - /^MotionNotify/ {print $1} - /button [0-9]+/ {print substr($4,1,1)}' > $tmpdir/kbd_fifo& -awk_pid=$! +launch_xev while read key;do clear informer "1=clique gauche\n2=clique molette\n3=clique droit\nMotionNotify=bouger le curseur" update_layout if ! ps -q "$awk_pid" > /dev/null;then - stdbuf -i0 -o0 xev | $awk_inter ' - /^Key(Press|Release)/ {type=$1} - /keycode [0-9]+/ && !(NR%2) {print substr($7,0,index($7,")")-1)}' > $tmpdir/kbd_fifo& - awk_pid=$! + launch_xev fi printf "verification de $key, ligne $i\n" while read entered;do @@ -35,4 +36,6 @@ while read key;do fi done < $tmpdir/kbd_fifo done < "$disposition" + +clear update_layout | sauver