4

I'm having trouble hooking up my Raspberry Pi 3 Model B to my Adafruit Tiny Thermal Printer (nb: not the mini thermal printer - this is the one with a mini-USB port built in).

I've got it connected via mini-USB to USB in my rPi, it's connected to power using the supplied AC adapter. I can print a test page by holding the feed button while connected to power.

I noticed that it's currently on /dev/usb/lp0 and after chmod'ing this to 666 I was able to use the following command to get a test print:

echo -e "This is a test.\\n\\n\\n" > /dev/usb/lp0

However, I'm trying to use the following library:

https://github.com/adafruit/Python-Thermal-Printer/

But it's not playing ball...

By default it's set to look at /dev/serial0 - which if I run python printertest.py

I get the following error:

Traceback (most recent call last):
File "printertest.py", line 5, in <module>
printer = Adafruit_Thermal("/dev/serial0", 19200, timeout=5)
File "/home/pi/printer/Adafruit_Thermal.py", line 85, in __init__
Serial.__init__(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 261,     
in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 278, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/serial0: [Errno 2] No such file or directory: '/dev/serial0'

Changing it to /dev/usb/lp0 gives me this error:

Traceback (most recent call last):
File "printertest.py", line 5, in <module>
printer = Adafruit_Thermal("/dev/usb/lp0", 19200, timeout=5)
File "/home/pi/printer/Adafruit_Thermal.py", line 85, in __init__
Serial.__init__(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 261, 
in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 282, in open
self._reconfigurePort()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 311, in _reconfigurePort
raise SerialException("Could not configure port: %s" % msg)
serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')

Which I assume the problem to be with Could not configure port: (25, 'Inappropriate ioctl for device')

I've tried looking around for this but I can't see a relevant explanation to my situation. Am I missing something big here?

Tom Harris
  • 41
  • 1

0 Answers0