From 49843fc3e752c030d2cc0ecc36dec321f96b39af Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Fri, 6 Mar 2020 23:24:26 +0530 Subject: [PATCH] script: add special decoding for CAN devid --- Tools/scripts/decode_devid.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tools/scripts/decode_devid.py b/Tools/scripts/decode_devid.py index 7c7bda0eab..054570b158 100755 --- a/Tools/scripts/decode_devid.py +++ b/Tools/scripts/decode_devid.py @@ -93,6 +93,13 @@ if opts.compass: if opts.imu: decoded_devname = imu_types.get(devtype, "UNKNOWN") -print("bus_type:%s(%u) bus:%u address:%u(0x%x) devtype:%u(0x%x) %s" % ( - bustypes.get(bus_type,"UNKNOWN"), bus_type, - bus, address, address, devtype, devtype, decoded_devname)) + +if bus_type == 3: + #uavcan devtype represents sensor_id + print("bus_type:%s(%u) bus:%u address:%u(0x%x) sensor_id:%u(0x%x) %s" % ( + bustypes.get(bus_type,"UNKNOWN"), bus_type, + bus, address, address, devtype-1, devtype-1, decoded_devname)) +else: + print("bus_type:%s(%u) bus:%u address:%u(0x%x) devtype:%u(0x%x) %s" % ( + bustypes.get(bus_type,"UNKNOWN"), bus_type, + bus, address, address, devtype, devtype, decoded_devname))