Raspbery (in general, linux) newbie here.

I want to install a thermal dot printer in raspbian, and I've only gotten as far as the first step, which is to run make for the cups filter, which is this. I think it's stumbling on the file rastertoxp58.c

Below is what terminal returns when I run make in the directory to which I cloned the repo.

pi@raspberrypi:~/xp58 $ make
gcc -Wl,-rpath,/usr/lib -Wall -fPIC -O3 -c rastertoxp58.c
rastertoxp58.c:17:16: error: redefinition of typedef ‘__sighandler_t’ with different type
 typedef void (*__sighandler_t)();
In file included from rastertoxp58.c:8:0:
/usr/include/signal.h:85:16: note: previous declaration of ‘__sighandler_t’ was here
 typedef void (*__sighandler_t) (int);
Makefile:16: recipe for target 'rastertoxp58.o' failed
make: *** [rastertoxp58.o] Error 1

Have you made sure that the necessary packages are installed? If not, try sudo apt-get install libcups2-dev libcupsimage2-dev.

Anyways, are you using exactly the specific printer the CUPS filter is designed for? Otherwise, there is a large possibility that the filter won't work for you.

maybe offtopic:

Generally, I would ask if you really need CUPS to print with your thermal printer. CUPS is a printing system that is able to act as a print server, handle print contingents etc., but which is possibly also hugely overcomplicated for what you might be trying to achieve.

If you only want to print something of that simple shopping receipt type with just some text and maybe even barcodes printed, you might probably want to consider writing directly to the /dev/usb/lpX file (with lpX being specific to your system), as it is the easiest way to line-print on linux. Basically, everything written to this file will be printed. Text formatting (bold, newline, etc.) is then handled by escape sequences similar to those in the terminal.

Using this technique you could easily print any (command line) output of a program of your choice by starting it with someprogram > /dev/usb/lpX.

A how-to on this topic including some clues on escape sequences is to be found for example here (this one is using php, but will work with every command-line program).

As a next step it would also possible to just 'open' the file from within a program using filesystem functions and write to it what you want to have printed. In this way you wouldn't even lose your screen output / interface within the program.

Let me know if this works for you!

  • Thanks for the tips, @jxe. Turns out, I really just needed a different filter file. The one that came with the printer's driver disk was a makefile, and there wasn't a filter file in it. Couldn't figure it out. But as so common with a lot of Made in China products like this, the printer I got was a rebrand of another product. I figured out who the original manufacturer was, and found better documentation there. Seems I did indeed need CUPS, as the POS is web-enabled, and I want to be able to print on the same printer from another terminal. – jeffimperial Mar 22 '17 at 7:51
  • Great to hear you got it working! – jxe Mar 22 '17 at 8:34
  • @jeffimperial I'm stuck at the same problem. Can you please share more information on how you got it running ? :) – Vivek Sampara May 7 '18 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.