/dev/ttyUSB0 Printer status The printer responds with a status message to certain commands. The status message consists of two bytes denoting the length of the message including these two bytes. All status messages consist of at least 8 bytes of general status and error information as well as microcode version. If, for example, bit 8 in byte e of the status message is set, the printer reports that its buffer has less than 1k characters left to make the controlling system aware that it should slow down or discard the buffer. A set of bits is used to denote if the message is an answer to an inquiry command such as "Request printer ID". If that is the case the printer appends a command-specific amount of extra information to the end of the status message. The reported size of the message that is encoded in the first two bytes of the printers response is higher, accordingly. The following python-script requests the printer ID in order to identify the printer type and capabilities in use: import serial import struct # select, configure and open the serial interface with serial.Serial('/dev/ttyUSB0', 19200, timeout=5) as ser: # tell the printer to respond with its ID information ser.write(b'\x1d\x49\x01') # read the first two bytes of the response message_length_data = ser.read(2) # convert the data to an integer message_length = struct.unpack('>H', message_length_data)[0] print('Message length: {}'.format(message_length)) # read the entire response. keep in mind that the first two bytes have already been read raw_data = ser.read(message_length - 2) # Because the two bytes denoting the length have been read earlier, the response is two bytes shorter # than the length of the message. The first byte of the actual status response is therefor is 1 and the highest is 13 # The status bytes are being pushed into a python list [] object which start its indexing at 0 so 1 must be subtracted # from they byte number reference in the user guide and in the comments. # # Check if the message is indeed a response to a printer ID request: if raw_data[4] & (1 << 0) != 0: # byte 9 gives a rough indication of the printer type: if raw_data[8] == 0x30: print('Type: non-Tx8/Tx9 model, or Tx8/Tx9 in TI4 emulation mode') elif raw_data[8] == 0x31: print('Type: Tx8 or Tx9 model') # byte 10 indicates the model more closely and distinguishes between features regarding