LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Printer's /dev/usb/lpx file is not shown on ubuntu mate 20.04 (https://www.linuxquestions.org/questions/linux-software-2/printers-dev-usb-lpx-file-is-not-shown-on-ubuntu-mate-20-04-a-4175702901/)

DJ541 10-31-2021 01:21 PM

Printer's /dev/usb/lpx file is not shown on ubuntu mate 20.04
 
Hello all linux user!
On ubuntu mate 18.04 I used to send data in hexadecimal representation into a usb thermal printer with this command:

cat cmds.txt > /dev/usb/lp0

I used as well sending the printing esc/p commands to this file from my program.

I upgraded to ubuntu mate 20.04 and realized, that the lpx file (belonging to the printer) does not appear in the /dev/usb folder, like on ubuntu mate 18.04. I have googled a little bit and found, that

dmesg | grep usblp

command should provide some useful information about connection of the printer. I am not skilled at this area, therefore I do not use proper terms at this point.

With its usage I realized, that: On Ubuntu 20.04 the output is :

$ dmesg | grep usblp
[ 17.634888] usblp 3-3:1.0: usblp1: USB Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x04F9 pid 0x209D
[ 17.634950] usbcore: registered new interface driver usblp
[ 35.318303] usblp1: removed

while on Ubuntu 18.04 the log does not end with removed keyword and the lpx file shows in the expected path. The printer shows in output of lsusb on both systems:

$ lsusb
Bus 003 Device 003: ID 04f9:209d Brother Industries, Ltd QL-820NWB P-touch Label Printer

I suspect that on ubuntu 20.04 there is some process removing the usblp. Since the usblp should be responsible for creation of lpx files, they do not show up.

My question is, how to get usblp working to show lpx files on ubuntu mate 20.04?

Thank you.

hazel 11-01-2021 06:33 AM

It's worth checking if the usblp module itself has been unloaded. Most people nowadays use cups for printing with a libusb backend and that's supposed to be incompatible with usblp, so maybe that's why your new Ubuntu removes it. It could well be blacklisted in one of the files in /etc/modprobe.d.

You can easily check if the module is loaded by using
Code:

lsmod|grep usblp
If it is not, you can reload it by hand.
Code:

sudo modprobe usblp
If it is blacklisted by modprobe, that can be corrected by a simple edit.

DJ541 11-01-2021 08:34 AM

Hi hazel,
thank you for your reply. I apologize for the delay. Somehow, I did not get the info email about your reply.

Quote:

It's worth checking if the usblp module itself has been unloaded.
Code:

lsmod | grep 'usblp'
gives

usblp 28672 0

So, I expect it to be loaded.

Quote:

It could well be blacklisted in one of the files in /etc/modprobe.d.
usblp is not blacklisted in /etc/modprobe.d/blacklist.conf



Meanwhile, I think I found the core of the problem. On Ubuntu 18.04, when i run

Code:

usb-devices
and check driver section of the printer, I get usblp (no suprise here). But when I run the same in Ubuntu 20.04 i get usbfs. I suspect the ubuntu 20.04 to assign the printer driver for usb HDD. Am I right? Here is the complete output from
Code:

usb-devices
on ubuntu 20.04:

T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=04f9 ProdID=209d Rev=01.00
S: Manufacturer=Brother
S: Product=QL-820NWB
S: SerialNumber=000M0Z803274
C: #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=0mA
I: If#=0x0 Alt= 1 #EPs= 2 Cls=07(print) Sub=01 Prot=04 Driver=usbfs
I: If#=0x1 Alt= 1 #EPs= 2 Cls=07(print) Sub=01 Prot=04 Driver=usbfs

DJ541 11-01-2021 12:01 PM

Hello hazel,
thank you for you reply. I checked everything according to your suggestions. usblp is loaded and is no blacklisted. But I found, that a wrong driver is assigned to the printer. When I run
Code:

usb-devices
and check output for the printer, particularly the Driver, I get Driver=usbfs. In my opinion, the OS thinks, that the printer is a USB HDD.

How can I fix that?

hazel 11-02-2021 07:22 AM

Quote:

Originally Posted by DJ541 (Post 6297550)
When I run usb-devices
and check output for the printer, particularly the Driver, I get Driver=usbfs. In my opinion, the OS thinks, that the printer is a USB HDD.

How can I fix that?

According to the kernel docs, usbfs is just a driver for the filesystem attached to /dev/bus/usb. It doesn't imply that the attached usb device is itself a filesystem. When I check on my box, I find that /dev/bus/usb/001/002 is assigned to the lp group, so that must be the port where my printer is attached. But then I use cups/libusb for my printing and don't ever use usblp.

Sorry but I'm not sure where you go from here.

DJ541 11-02-2021 04:26 PM

My point is,
that on ubuntu 18.04 the lpx files appear in the /dev/usb/, where the printer's driver is usblp. On ubuntu 20.04, the driver is usbfs. If i managed to switch the driver in ubuntu 20.04 to usblp, the lpx files would be created in /dev/usb/. But this prehaps cannot be done directly:

Quote:

In short, you often can't force a particular driver to use a particular device.
from

https://unix.stackexchange.com/quest...iver-to-device

It seems, I will have to switch to libusb to establish communication with my printer on newer OSs.

Quote:

But then I use cups/libusb for my printing and don't ever use usblp
Can you recommend me any good tutorials for libusb (C++)? I need to send raw data (esc/p commands in hexadecimal represenattion) to the printer.

Thanks


All times are GMT -5. The time now is 09:54 PM.