Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got Input/Output Error #449

Open
striderblue opened this issue Mar 15, 2021 · 1 comment
Open

I got Input/Output Error #449

striderblue opened this issue Mar 15, 2021 · 1 comment

Comments

@striderblue
Copy link

python-escpos version: 2.2.0

python version: 3.8.5

operating system: Ubuntu 20.04.2 LTS (GNU/Linux 5.8.0-44-generic x86_64)

Printer: Citizen CT-D150

Problem:

Could not set configuration: [Errno None] Other error
Traceback (most recent call last):
File "demo01.py", line 25, in
typewriter.image(img)
File "/home/ntq/.local/lib/python3.8/site-packages/escpos/escpos.py", line 99, in image
self._raw(header + im.to_raster_format())
File "/home/ntq/.local/lib/python3.8/site-packages/escpos/printer.py", line 85, in _raw
self.device.write(self.out_ep, msg, self.timeout)
File "/home/ntq/.local/lib/python3.8/site-packages/usb/core.py", line 979, in write
return fn(
File "/home/ntq/.local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 837, in bulk_write
return self.__write(self.lib.libusb_bulk_transfer,
File "/home/ntq/.local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 938, in __write
_check(retval)
File "/home/ntq/.local/lib/python3.8/site-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

lsusb:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0aa7 Intel Corp.
Bus 001 Device 005: ID 1d90:20f1 Citizen Thermal Printer
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

check Usb Thermal Printer:

DEVICE ID 1d90:20f1 on Bus 001 Address 005 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x1d90
idProduct : 0x20f1
bcdDevice : 0x2 Device 0.02
iManufacturer : 0x1 CITIZEN
iProduct : 0x2 Thermal Printer
iSerialNumber : 0x3 00000000
bNumConfigurations : 0x1
CONFIGURATION 1: 0 mA ====================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x20 (32 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xc0 Self Powered
bMaxPower : 0x0 (0 mA)
INTERFACE 0: Printer ===================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x7 Printer
bInterfaceSubClass : 0x1
bInterfaceProtocol : 0x2
iInterface : 0x0
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x0
ENDPOINT 0x2: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x2 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x0

In python code:
typewriter = printer.Usb(0x1d90, 0x20f1, 0, 0x81, 0x2)

What I done:

  • already set

udev rule, SUBSYSTEM=="usb", ATTRS{idVendor}=="1d90", ATTRS{idProduct}=="20f1", MODE="0664", GROUP="home"

  • reload with sudo udevadm control --reload && sudo udevadm trigger
  • restart hardware
  • try to search this problem in google for solution but no results to solve.

I do not know how to fix/solve this problem
Please advice/suggest.

best regards

@viniciusbrit
Copy link

viniciusbrit commented Apr 15, 2022

I'm having the same thing. I keep getting usb.core.USBError: [Errno 5] Input/Output Error
I'm using a raspberry pi zero 2 and I'm only trying to print an image and 3 lines of text
Here's my code:

from escpos.printer import Usb

printer = Usb(0x28e9, 0x0289)
printer.image("/home/pi/image.jpg")
printer.text("\n\n\n")

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

No branches or pull requests

2 participants