From 88731c283629f116be0c81b82a41db8f8ecb067b Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Mon, 25 Apr 2022 18:09:06 -0400 Subject: [PATCH] scripts: identify application in canbus_query Signed-off-by: Eric Callahan --- scripts/canbus_query.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/canbus_query.py b/scripts/canbus_query.py index 7312a0c6..52dd4706 100644 --- a/scripts/canbus_query.py +++ b/scripts/canbus_query.py @@ -10,6 +10,8 @@ import can CANBUS_ID_ADMIN = 0x3f0 CMD_QUERY_UNASSIGNED = 0x00 RESP_NEED_NODEID = 0x20 +CMD_SET_KLIPPER_NODEID = 0x01 +CMD_SET_CANBOOT_NODEID = 0x11 def query_unassigned(canbus_iface): # Open CAN socket @@ -37,7 +39,16 @@ def query_unassigned(canbus_iface): if uuid in found_ids: continue found_ids[uuid] = 1 - sys.stdout.write("Found canbus_uuid=%012x\n" % (uuid,)) + AppNames = { + CMD_SET_KLIPPER_NODEID: "Klipper", + CMD_SET_CANBOOT_NODEID: "CanBoot" + } + app_id = CMD_SET_KLIPPER_NODEID + if msg.dlc > 7: + app_id = msg.data[7] + app_name = AppNames.get(app_id, "Unknown") + sys.stdout.write("Found canbus_uuid=%012x, Application: %s\n" + % (uuid, app_name)) sys.stdout.write("Total %d uuids found\n" % (len(found_ids,))) def main():