RAW CAN decoding
问题 I'm trying to import CAN data using a virtual CAN network and am getting strange results when I unpack my CAN packet of data. I'm using Python 3.3.7 Code: import socket, sys, struct sock = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) interface = "vcan0" try: sock.bind((interface,)) except OSError: sys.stderr.write("Could not bind to interface '%s'\n" % interface) fmt = "<IB3x8s" while True: can_pkt = sock.recv(16) can_id, length, data = struct.unpack(fmt, can_pkt) can_id &=