I have a connection issue with a barcode scanner connected by usb to the Jetson Orin. Right now, when I first connect the scanner (MS4717) everything works fine. I can run my project or any tool interacting with the device for as long as I want. But if I quit and restart the project or any of the multiple tools I have tried, the Jetson is no longer receiving any data from the scanner.
The scanner is always mounted correctly (usually at /dev/ttyACM0) and communicates by SSI over USB CDC. I’ve tried monitoring with pyserial’s miniterm and with
screen /dev/ttyACM0 9600 but the same problem arises, if I ever stop the program I can’t connect to the scanner anymore afterwards (f.e. screen just says
[screen is terminating])
I haven’t encountered this issue on any other computer, so I believe it might be an issue with the Jetson rather than the scanner.
In the project I’m trying to run, I use pyserial to interact with the device. Here is an extract of the code to give you an idea of how I use it:
import serial serial_port = "/dev/ttyACM0" baud_rate = 9600 with serial.Serial(serial_port, baud_rate, timeout=0.1) as device_serial: device_serial.flush() while True: try: # read a line from the serial port barcode_byte_string = device_serial.readline() if len(barcode_byte_string) > 0: # convert the byte string to a string and strip the newline character barcode = barcode_byte_string.decode("utf-8").rstrip() # publish the barcode to the topic self.publish_barcode(barcode, serial_port) except serial.SerialException as e: # exit with error code 1. This will cause the application to be restarted. sys.exit(1) except Exception as e: break