ao-bringup: test-chaoskey needs to use the SerialNumber dmesg line
authorKeith Packard <keithp@keithp.com>
Sun, 19 Feb 2017 06:46:29 +0000 (22:46 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 20 Feb 2017 19:16:52 +0000 (11:16 -0800)
I had a locally hacked kernel which was reporting the serial number
along with the device name. Instead of depending on that, just look
for the regular SerialNumber report which is in all kernel versions

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-bringup/test-chaoskey

index b4c8164f584b716cc64123b4cb725d57b2115b2d..f64b1f846b1edb1a5a715799ef66ebde988a7c40 100755 (executable)
@@ -12,7 +12,9 @@ case "$#" in
        serial="--serial $1"
        ;;
     0)
-       snum=`dmesg | grep 'on chaoskey' | tail -1 | sed 's/.*chaoskey \([0-9a-f][0-9a-f]*\) on chaoskey.*/\1/'`
+       snum=`sudo dmesg | awk '/usb.*Product:/ { ck = index($0, "ChaosKey"); }
+                    /usb.*SerialNumber:/ { if (ck) print $5; }' | tail -1`
+
        case "$snum" in
            "")
                serial=""