Skip to content

fix: support Epson TM-T20IV and skip non-device lsusb lines - #15

Merged
anothingguy merged 1 commit into
devfrom
fix/tm-t20iv-and-lsusb-parsing
Nov 3, 2026
Merged

anothingguy merged 1 commit into
devfrom
fix/tm-t20iv-and-lsusb-parsing

Conversation

@anothingguy

Copy link
Copy Markdown
Collaborator

Summary

Two small fixes ported from the Debian 13 packaging of upstream PyWebDriver, superquinquin-sur-deule/debian-pywebdriver:

  • Epson TM-T20IV support: adds 04b8:0e39 to the supported USB printers in escpos_driver, so a TM-T20IV is detected with device_type=usb on Linux. On Windows (device_type=win32), the printer goes through the Windows print queue and isn't affected. The printer list in test-scripts/escpos-test.py gets the same entry. The udev rule already covers every USB device, so it doesn't need a change.
  • USB devices page crash: /usb_devices.html parsed every line of lsusb output as a device, so it crashed with IndexError when lsusb isn't installed (lsusb: not found) or prints nothing. It now skips lines without : ID .

Source patches: 00002-add-epson-tmt20iv-support.patch, and the views.py hunk of 00001-prevent-crash-on-missing-device.patch.

Test plan

  • pre-commit run passes on the changed files.

  • Ran usb_devices() with fake lsusb output:

    lsusb output before after
    2 devices 2 devices 2 devices
    lsusb: not found IndexError 0 devices
    empty IndexError 0 devices
  • Plug a TM-T20IV in over USB on Linux and check it shows as Connected on the status page. (Not done: no TM-T20IV on hand.)

- escpos_driver: add Epson TM-T20IV (04b8:0e39) to the supported USB
  printers, so it's detected with device_type=usb. Also added to the
  copy of the list in test-scripts/escpos-test.py.
- views: /usb_devices.html skipped no line of lsusb output, so it
  crashed with IndexError when lsusb is missing or prints nothing.
  Skip lines without ": ID ".

Both ported from superquinquin-sur-deule/debian-pywebdriver patches
00002-add-epson-tmt20iv-support and 00001-prevent-crash-on-missing-device.
@anothingguy
anothingguy merged commit ef2be86 into dev Nov 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant