diff --git a/print_server.py b/print_server.py index 7533fd8..4e15771 100644 --- a/print_server.py +++ b/print_server.py @@ -12,7 +12,13 @@ from jobs.maze import MazeJob # Example: 0x04b8 is Epson. USB_VENDOR_ID = 0x0525 USB_PRODUCT_ID = 0xa700 +# Input interface: +# `lsusb -vvv -d xxxx:xxxx | grep iInterface` +# iInterface 0 INPUT_ENDPOINT = 0x00 +# Output interface: +# `lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT` +# bEndpointAddress 0x01 EP 1 OUT OUTPUT_ENDPOINT = 0x01 # Set to True to print to console instead of physical printer (for testing) @@ -28,12 +34,12 @@ def get_printer(): try: # Initialize USB printer - # profile="TM-T88V" is a generic profile, works for many ESC/POS printers - + # Generic printer with custom settings: p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="default") p.profile.profile_data['media']['width']['mm'] = 80 p.profile.profile_data['media']['width']['pixels'] = 512 + # Specific printer based on a profile. See https://python-escpos.readthedocs.io/en/latest/printer_profiles/available-profiles.html # p = Usb(USB_VENDOR_ID, USB_PRODUCT_ID, 0, INPUT_ENDPOINT, OUTPUT_ENDPOINT, profile="TM-T88V") return p except USBNotFoundError: