Skip to content

Instantly share code, notes, and snippets.

@fawkesley
Last active August 15, 2021 19:09
Show Gist options
  • Save fawkesley/f4554d40bedbbb45fbeddb0bcae566ee to your computer and use it in GitHub Desktop.
Save fawkesley/f4554d40bedbbb45fbeddb0bcae566ee to your computer and use it in GitHub Desktop.

Solved: add a CUPS "Raw Device"

this guy got it working by adding a cups "Raw Device":

http://screaming.computer/blog/2020-02/connect-a-thermal-receipt-printer-to-a-linux-vm-in-unraid

https://askubuntu.com/a/110940

Also blacklist the usblp kernel module.

Other attempts

[112485.771320] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112485.857422] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112490.986040] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112490.986046] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112490.986049] usb 2-2: Product: POS58 USB Printer
[112490.986052] usb 2-2: Manufacturer: GD32 Microelectronics
[112490.986055] usb 2-2: SerialNumber: Printer
[112496.103434] usblp: can't set desired altsetting 0 on interface 0

https://forums.anandtech.com/threads/how-to-get-usb-thermal-printer-to-work-in-linux.2564142/

echo 0416:5011:c > /sys/module/usbcore/parameters/quirks

[112870.816044] usb 2-2: new full-speed USB device number 22 using xhci_hcd
[112870.970019] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112870.970025] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112870.970028] usb 2-2: Product: POS58 USB Printer
[112870.970031] usb 2-2: Manufacturer: GD32 Microelectronics
[112870.970034] usb 2-2: SerialNumber: Printer
[112872.027670] usblp 2-2:1.0: usblp2: USB Bidirectional printer dev 22 if 0 alt 0 proto 2 vid 0x0416 pid 0x5011

Quirk "c" means USB_QUIRK_NO_SET_INTF: https://github.com/torvalds/linux/blob/master/drivers/usb/core/quirks.c#L95

But now echo hello | /dev/usb/lp2 gives this error in DMESG:

[113059.881566] usblp2: nonzero read bulk status received: -71
[113059.881631] usblp2: nonzero write bulk status received: -71

https://github.com/vpatron/usb_receipt_printer/blob/master/usb_receipt_printer_demo.py

https://askubuntu.com/a/110940

[112485.771320] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112485.857422] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112490.986040] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112490.986046] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112490.986049] usb 2-2: Product: POS58 USB Printer
[112490.986052] usb 2-2: Manufacturer: GD32 Microelectronics
[112490.986055] usb 2-2: SerialNumber: Printer
[112496.103434] usblp: can't set desired altsetting 0 on interface 0

https://forums.anandtech.com/threads/how-to-get-usb-thermal-printer-to-work-in-linux.2564142/

echo 0416:5011:c > /sys/module/usbcore/parameters/quirks

[112870.816044] usb 2-2: new full-speed USB device number 22 using xhci_hcd
[112870.970019] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112870.970025] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112870.970028] usb 2-2: Product: POS58 USB Printer
[112870.970031] usb 2-2: Manufacturer: GD32 Microelectronics
[112870.970034] usb 2-2: SerialNumber: Printer
[112872.027670] usblp 2-2:1.0: usblp2: USB Bidirectional printer dev 22 if 0 alt 0 proto 2 vid 0x0416 pid 0x5011

Quirk "c" means USB_QUIRK_NO_SET_INTF: https://github.com/torvalds/linux/blob/master/drivers/usb/core/quirks.c#L95

But now echo hello | /dev/usb/lp2 gives this error in DMESG:

[113059.881566] usblp2: nonzero read bulk status received: -71
[113059.881631] usblp2: nonzero write bulk status received: -71

https://github.com/vpatron/usb_receipt_printer/blob/master/usb_receipt_printer_demo.py

https://askubuntu.com/a/110940

this guy got it working by adding a cups "Raw Device":

http://screaming.computer/blog/2020-02/connect-a-thermal-receipt-printer-to-a-linux-vm-in-unraid this guy got it working by adding a cups "Raw Device":

http://screaming.computer/blog/2020-02/connect-a-thermal-receipt-printer-to-a-linux-vm-in-unraid

Other attempts

[112485.771320] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112485.857422] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[112490.986040] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112490.986046] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112490.986049] usb 2-2: Product: POS58 USB Printer
[112490.986052] usb 2-2: Manufacturer: GD32 Microelectronics
[112490.986055] usb 2-2: SerialNumber: Printer
[112496.103434] usblp: can't set desired altsetting 0 on interface 0

https://forums.anandtech.com/threads/how-to-get-usb-thermal-printer-to-work-in-linux.2564142/

echo 0416:5011:c > /sys/module/usbcore/parameters/quirks

[112870.816044] usb 2-2: new full-speed USB device number 22 using xhci_hcd
[112870.970019] usb 2-2: New USB device found, idVendor=0416, idProduct=5011
[112870.970025] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[112870.970028] usb 2-2: Product: POS58 USB Printer
[112870.970031] usb 2-2: Manufacturer: GD32 Microelectronics
[112870.970034] usb 2-2: SerialNumber: Printer
[112872.027670] usblp 2-2:1.0: usblp2: USB Bidirectional printer dev 22 if 0 alt 0 proto 2 vid 0x0416 pid 0x5011

Quirk "c" means USB_QUIRK_NO_SET_INTF: https://github.com/torvalds/linux/blob/master/drivers/usb/core/quirks.c#L95

But now echo hello | /dev/usb/lp2 gives this error in DMESG:

[113059.881566] usblp2: nonzero read bulk status received: -71
[113059.881631] usblp2: nonzero write bulk status received: -71

https://github.com/vpatron/usb_receipt_printer/blob/master/usb_receipt_printer_demo.py

@Irdroid
Copy link

Irdroid commented Aug 15, 2021

Got similar problem , and now have stable printing on linux check out the gist below:

Zijiang POS58 fix for Linux / Cups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment