From b276fbab900da46e1c4b7becc99888310e3ca87f Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Wed, 22 May 2013 20:47:04 +0300 Subject: [PATCH] updated scan-registers to support receiver scan --- tools/scan-registers.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tools/scan-registers.sh b/tools/scan-registers.sh index ceaa6abe..38a14e3b 100755 --- a/tools/scan-registers.sh +++ b/tools/scan-registers.sh @@ -6,35 +6,39 @@ if test -z "$1"; then fi HC="$(dirname "$(readlink -f "$0")")/hidconsole" +if test "$1" = "FF"; then + DEVNUMBER=FF +else + DEVNUMBER=0$1 +fi +HIDRAW=$2 z='0 1 2 3 4 5 6 7 8 9 a b c d e f' do_req() { - "$HC" --hidpp $2 | grep -v ' 8F.. ..0[12]' | grep -B 1 '^>> ' + "$HC" --hidpp $HIDRAW | grep -v "\[1. $DEVNUMBER 8F.. ..0[12]" | grep -B 1 '^>> ' } -reg00=$(echo "10 0${1} 8100 000000" | do_req) -oldflags=$(echo "$reg00" | grep -Po '>>.*? 8100 \K[0-9a-f]{6}(?=\])') +oldflags=$(echo "10 ${DEVNUMBER} 8100 000000" | do_req | grep -Po "^>> \([0-9. ]*\) \[10 $DEVNUMBER 8100 \K[0-9a-f]{6}(?=\])") if [ -n "$oldflags" ]; then echo "# Old notification flags: $oldflags" { - echo "10 0${1} 8000 ffffff" # enable all notifications - echo "10 0${1} 8100 000000" # read available notifs - echo "10 0${1} 8000 $oldflags" # restore notifications - } | do_req | grep -B 1 '^>>.* 8100 ' -elif [ -n "$reg00" ]; then - echo "# Warning: hidconsole API got changed - unrecognized output" - echo "$reg00" + echo "10 ${DEVNUMBER} 8000 ffffff" # enable all notifications + echo "10 ${DEVNUMBER} 8100 000000" # read available notifs + echo "10 ${DEVNUMBER} 8000 $oldflags" # restore notifications + } | do_req | grep -B 1 "^>>.* $DEVNUMBER 8100 " +else + echo "# Failed to read notification flags." fi for x in $z; do for y in $z; do [ "$x$y" = 00 ] || \ - echo "10 0${1} 81${x}${y} 000000" + echo "10 ${DEVNUMBER} 81${x}${y} 000000" done done | do_req for x in $z; do for y in $z; do - echo "10 0${1} 83${x}${y} 000000" + echo "10 ${DEVNUMBER} 83${x}${y} 000000" done done | do_req