[cups] thermal receipt printer - avoiding filters for raw plain-text access and usblp misbehaviour

Dominik Taborsky bremby at seznam.cz
Mon Aug 28 13:54:28 PDT 2017


Hello,

I have posted a StackOverflow question[0] and I would like to get more
attention to it, as it is specific to CUPS. I will also post it below,
but if anyone can give me any pointers or help, you can do it either on
SO or here (I'm subscribed). Thank you.

[0] https://stackoverflow.com/q/45926734/4749818

Question text:

I have a thermal receipt printer on a USB interface that accepts plain
text only with some special command sequences. I'm struggling with
setting it up.

I have created a raw printer using the CUPS web interface
(localhost:631; followed this:
https://stackoverflow.com/a/38965500/4749818). There are two issues with it:

    In dmesg I see the printer registration as a USB device and also as
a USB printer - using usblp module. When I send a document to print,
dmesg also gives "usblp0: removed" and "usb 3-1: reset full-speed USB
device ...". Only rarely the printer prints anything and I haven't
spotted a pattern yet.

    I should also mention that I tried blacklisting the usblp module as
recommended here and also using those cups options mentioned as the
first troubleshooting in the very same thread. Those options had no
effect at all, and I haven't managed to blacklist the kernel module - on
ArchLinux I added a line "blacklist usblp" to
/etc/modprobe.d/modprobe.conf. After removing the module manually
(modprobe -r usblp) and restarting/reconnecting the printer, the usblp
module is automatically loaded again, completely ignoring the blacklist.
I also tried using "install usblp /bin/false" and that also had no
effect. I think I'm going crazy; what am I doing wrong?

    When the printer does print, it still is being sent PDF formatted
data (the very first printed line says "%PDF-1.5" followed by something
that looks like a file format header). AFAIK, the raw printer should
avoid all filters (or conversions). I have read through this bug report
thread. The thread pointed me to some files in /usr/share/cups/mime/,
specifically I tried editing "cupsfilters.convs", changing this line:

    text/plain    application/pdf    32    texttopdf

    into this line:

    text/plain    text/plain    0    -

    To print a plain text file, I created a text file using Geany,
setting encoding to None (presumably ascii?) and filetype also to none.
It obviously did not work, it still printed a PDF.

I don't know what else to do. Usually I come up with a couple more
things to try while I'm writing the question, so I rarely get to ask
anything, but this time I'm empty.

Last thing, the printer works, if I avoid using CUPS and lp* completely,
I can write lines to the usblp-made device and it prints; it also
correctly recognizes command sequences, e.g. the paper cutter.

Any tips welcome!

Thank you.

Dominik


[0] https://stackoverflow.com/q/45926734/4749818


More information about the cups mailing list