From b866b3ca249dce61f8ff16c8d28514d1b80386d7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 14 Dec 2017 23:10:43 -0800 Subject: [PATCH] ao-bringup/test-chaoskey: Make finding most recent device more reliable Use dmesg -t to strip off the timestamp, which avoids having a variable number of fields for awk to look at. Signed-off-by: Keith Packard --- ao-bringup/test-chaoskey | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ao-bringup/test-chaoskey b/ao-bringup/test-chaoskey index f64b1f84..26684875 100755 --- a/ao-bringup/test-chaoskey +++ b/ao-bringup/test-chaoskey @@ -12,8 +12,8 @@ case "$#" in serial="--serial $1" ;; 0) - snum=`sudo dmesg | awk '/usb.*Product:/ { ck = index($0, "ChaosKey"); } - /usb.*SerialNumber:/ { if (ck) print $5; }' | tail -1` + snum=`sudo dmesg -t | awk '/usb.*Product:/ { ck = index($0, "ChaosKey"); } + /usb.*SerialNumber:/ { if (ck) print $4; }' | tail -1` case "$snum" in "") -- 2.30.2