Discussion:
[blfs-dev] Cups and kernel USB printer support (/dev/usb/lp0)
Ken Moffat
2014-01-21 00:24:04 UTC
Permalink
I think we have an overzealous "Note" in the Kernel Configuration
part of the cups instructions -

| There is a conflict between the Cups libusb backend and the usblp
| kernel driver. If you want to use Cups with libusb, do not enable
| USB Printer support in your kernel.

For several years, I have used the kernel's usblp driver, as a
modules. and not libusb. Indeed, I removed colord from my builds
when it apparently became dependant on libusb. But while I was
testing everything for make-4.0 I had to build libusb, and confirmed
that printing via libusb without the kernel's usblp driver worked
fine. So far so good, and I decided to reinstate colord and to
allow myself to use lsusb from usbutils if I ever needed it.

And then I went back to that build to put a 3.13.0 kernel on it. I
wanted to check my ink (using escputil), but that needs to read the
raw device, /dev/usb/lp0, and I didn't have one. Googling showed
that arch's wiki mentions building usblp as a module, inserting it
before using escputil, and then rmmod'ing it to enable printing to
work. Sounded awkward, but worth a try.

In fact, with usblp as a module everything is working fine in
3.13.0 with libusb! When I connect the printer, usblp (and
usb_storage - who said printers were straightforward ? :) gets
loaded and escputil is able to tell me which ink is running out.
And then, even without trying to rmmod usblp, printing through cups
works fine.

Not sure if building usblp into the kernel will work the same way ?
I'll have to try that when I next build a new kernel for this system,
I suppose [ CONFIG_USB_PRINTER=y ].

Meanwhile, opinions from people with different usb printers who use
cups and libusb would be welcome. Maybe usblp needs to be a module
so that it isn't loaded when cups start, or perhaps any previous
problem has now been resolved in a recent version of one of the
packages.

ĸen
--
das eine Mal als Tragödie, dieses Mal als Farce
Fernando de Oliveira
2014-01-21 14:30:05 UTC
Permalink
Post by Ken Moffat
I think we have an overzealous "Note" in the Kernel Configuration
part of the cups instructions -
| There is a conflict between the Cups libusb backend and the usblp
| kernel driver. If you want to use Cups with libusb, do not enable
| USB Printer support in your kernel.
printing via libusb without the kernel's usblp driver worked
fine. So far so good, and I decided to reinstate colord and to
allow myself to use lsusb from usbutils if I ever needed it.
And then I went back to that build to put a 3.13.0 kernel on it. I
wanted to check my ink (using escputil), but that needs to read the
raw device, /dev/usb/lp0, and I didn't have one. Googling showed
that arch's wiki mentions building usblp as a module, inserting it
before using escputil, and then rmmod'ing it to enable printing to
work. Sounded awkward, but worth a try.
In fact, with usblp as a module everything is working fine in
3.13.0 with libusb! When I connect the printer, usblp (and
usb_storage - who said printers were straightforward ? :) gets
loaded and escputil is able to tell me which ink is running out.
And then, even without trying to rmmod usblp, printing through cups
works fine.
Not sure if building usblp into the kernel will work the same way ?
I'll have to try that when I next build a new kernel for this system,
I suppose [ CONFIG_USB_PRINTER=y ].
Meanwhile, opinions from people with different usb printers who use
cups and libusb would be welcome. Maybe usblp needs to be a module
so that it isn't loaded when cups start, or perhaps any previous
problem has now been resolved in a recent version of one of the
packages.
ĸen
I have always used libusb, so, do not know much about this. But this
subject is of much interest for me, you know...

After reading your post I tried escputil, unfortunately:

{{{
$ env LC_ALL=C sudo escputil --new --raw-device=/dev/usb/lp0 --identify
...
Unknown printer Stylus CX7300!
EPSON Stylus CX7300

...

$ escputil -M | grep CX7
escp2-cx7000f Epson Stylus CX7000F
escp2-cx7400 Epson Stylus CX7400
escp2-cx7700 Epson Stylus CX7700
escp2-cx7800 Epson Stylus CX7800
}}}

Cups uses Epson Stylus CX7000F an sane uses Epson Stylus CX7400. I would
like to discover how to instruct escputil to think that the printer is
one of those two. Failed to find it in web searches.

Back to your subject, I did some tests in Lubuntu (my CUPS/SANE server).

{{{
$ lsmod | grep usb
usblp 17885 0
usb_storage 39646 0
}}}

Tried using ldd to find any CUPS library or application linked to libusb
in LFS7.4: none.

I do not understand this result.

But all seem to indicate that there is no problem, as module, like you said.

Tomorrow, I will investigate ArchLinux, Fedora and Mageia. I think we
are not in a rush (if you think we are, I will stop other
editing/developing works and will concentrate just on this one), but
your experiment is in time for us to modify definitely our CUPS page.

I will try to help as I can. Eventually, I could bring the printer
temporarily to connect by cable, instead of wifi.

Thanks for this experiment.
--
[]s,
Fernando
Ken Moffat
2014-01-21 18:56:15 UTC
Permalink
Post by Fernando de Oliveira
Post by Ken Moffat
I think we have an overzealous "Note" in the Kernel Configuration
part of the cups instructions -
[...]

Thanks for the reply - I was starting to think my message had got
lost (I haven't yet got a copy from the list, but that is also true
of one or two recent posts on the -support lists where I've only
Post by Fernando de Oliveira
I have always used libusb, so, do not know much about this. But this
subject is of much interest for me, you know...
{{{
$ env LC_ALL=C sudo escputil --new --raw-device=/dev/usb/lp0 --identify
On my system, /dev/usb/lp0 is created for the usblp driver - i.e.
you have created usblp.ko in
/lib/modules/$(uname -r)/kernel/drivers/usb/class/

Without that driver, the device does not exist for me.
Post by Fernando de Oliveira
...
Unknown printer Stylus CX7300!
EPSON Stylus CX7300
...
$ escputil -M | grep CX7
escp2-cx7000f Epson Stylus CX7000F
escp2-cx7400 Epson Stylus CX7400
escp2-cx7700 Epson Stylus CX7700
escp2-cx7800 Epson Stylus CX7800
}}}
Cups uses Epson Stylus CX7000F an sane uses Epson Stylus CX7400. I would
like to discover how to instruct escputil to think that the printer is
one of those two. Failed to find it in web searches.
You say your printer also does scanning, i.e. it is a multifunction
device. One link I found was
http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html
which suggests that multifunction printers are a bit too complex for
the traditional methods.

NB escputil is a user tool, the printer needs to be idle but you
don't need root permissions. For checking ink levels,
escputil -i -r /dev/usb/lp0
works for me.
Post by Fernando de Oliveira
Back to your subject, I did some tests in Lubuntu (my CUPS/SANE server).
{{{
$ lsmod | grep usb
usblp 17885 0
usb_storage 39646 0
}}}
Debian and ubuntu had code to get both backends working (see the
link above), and I guess some of it is now upstream.
Post by Fernando de Oliveira
Tried using ldd to find any CUPS library or application linked to libusb
in LFS7.4: none.
Yeah, the use is well hidden. And the build-system defaults to a
"quiet" output so that the commands do not get shown. With 1.7.0,
(I'm still using that) if libusb-1.0 is found it will be reported in
the CFLAGS (I can see that in my log) and it should define LIBUSB
as -lusb-1.0. That gets referenced in backend/Makefile - it is used,
if present, when backend/usb is created - and that gets
installed at /usr/lib/cups/backend/usb.

ĸen
--
das eine Mal als Tragödie, dieses Mal als Farce
Fernando de Oliveira
2014-01-22 14:06:31 UTC
Permalink
Hi ĸen,
Post by Ken Moffat
Post by Fernando de Oliveira
Post by Ken Moffat
I think we have an overzealous "Note" in the Kernel Configuration
part of the cups instructions -
[...]
Thanks for the reply - I was starting to think my message had got
lost (I haven't yet got a copy from the list, but that is also true
of one or two recent posts on the -support lists where I've only
Post by Fernando de Oliveira
I have always used libusb, so, do not know much about this. But this
subject is of much interest for me, you know...
{{{
$ env LC_ALL=C sudo escputil --new --raw-device=/dev/usb/lp0 --identify
On my system, /dev/usb/lp0 is created for the usblp driver - i.e.
you have created usblp.ko in
/lib/modules/$(uname -r)/kernel/drivers/usb/class/
Without that driver, the device does not exist for me.
Yes. Have you tried it as built in the kernel, instead of module? I
think we need to know that for the book, when we decide it is ready.
Post by Ken Moffat
Post by Fernando de Oliveira
...
Unknown printer Stylus CX7300!
EPSON Stylus CX7300
...
$ escputil -M | grep CX7
escp2-cx7000f Epson Stylus CX7000F
escp2-cx7400 Epson Stylus CX7400
escp2-cx7700 Epson Stylus CX7700
escp2-cx7800 Epson Stylus CX7800
}}}
Cups uses Epson Stylus CX7000F an sane uses Epson Stylus CX7400. I would
like to discover how to instruct escputil to think that the printer is
one of those two. Failed to find it in web searches.
You say your printer also does scanning, i.e. it is a multifunction
device. One link I found was
http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html
which suggests that multifunction printers are a bit too complex for
the traditional methods.
Yes, it is multifunctional. Sorry, forgot to write it.

Thanks for the link. I read there that the problem I have and the patch
I included in BLFS for ipp over the network was also due to those
modifications. Last CUPS update for the book i did, tried to make it
work with avali, but failed, that's why I keep the patch there.
Post by Ken Moffat
NB escputil is a user tool, the printer needs to be idle but you
don't need root permissions. For checking ink levels,
escputil -i -r /dev/usb/lp0
works for me.
Not at Lubuntu:

{{{
$ env LC_ALL=C escputil --new --raw-device=/dev/usb/lp0 --identify
Escputil version 5.2.8-pre1, Copyright (C) 2000-2006 Robert Krawitz
Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
This is free software, and you are welcome to redistribute it
under certain conditions; type 'escputil -l' for details.

Cannot open /dev/usb/lp0 read/write: Permission denied
}
Post by Ken Moffat
Post by Fernando de Oliveira
Back to your subject, I did some tests in Lubuntu (my CUPS/SANE server).
{{{
$ lsmod | grep usb
usblp 17885 0
usb_storage 39646 0
}}}
Did that for Mageia, Arch and Fedora, as promissed, there is no output,
from Fedora:

{{{
[ ***@VMWFedoraNG ~ ]$ lpstat -p -d
printer Epson_Epson_Stylus_CX7300 is idle. enabled since Qua 22 Jan
2014 10:58:39 BRT
system default destination: Epson_Epson_Stylus_CX7300



[ ***@VMWFedoraNG ~ ]$ lsmod | grep usb
[ ***@VMWFedoraNG ~ ]$
}}}

{{{
***@VMWArch ~ $ lpstat -p -d
printer Epson-Stylus-CX7300 is idle. enabled since Qua 15 Jun 2011
15:17:44 BRT
File "/System/Library/ColorSync/Profiles/Generic CMYK
Profile.icc" not available: No such file or directory
printer Epson-Stylus-CX7300:1 disabled since Qua 24 Out 2012 11:26:58 BRT -
Backend /usr/lib/cups/backend/tpvmgp does not exist!
system default destination: Epson-Stylus-CX7300:1


***@VMWArch ~ $ lsmod | grep usb
usbcore 154188 3 uhci_hcd,ehci_hcd,ehci_pci
usb_common 1604 1 usbcore
}}}

{{{
[***@VMWMageia ~]$ /sbin/lsmod | grep usb
usbhid 47320 0
hid 87153 2 hid_generic,usbhid
usbcore 189409 4 uhci_hcd,ehci_hcd,ehci_pci,usbhid
usb_common 12921 1 usbcore
}}}

However, Mageia is useless, cups was not installed, failed to get it
configured.

Think that those data above help nothing.
Post by Ken Moffat
Debian and ubuntu had code to get both backends working (see the
link above), and I guess some of it is now upstream.
That link you gave informs that upstream did not accept, IIRC.
Post by Ken Moffat
Post by Fernando de Oliveira
Tried using ldd to find any CUPS library or application linked to libusb
in LFS7.4: none.
Yeah, the use is well hidden. And the build-system defaults to a
"quiet" output so that the commands do not get shown. With 1.7.0,
(I'm still using that) if libusb-1.0 is found it will be reported in
the CFLAGS (I can see that in my log) and it should define LIBUSB
as -lusb-1.0. That gets referenced in backend/Makefile - it is used,
if present, when backend/usb is created - and that gets
installed at /usr/lib/cups/backend/usb.
ĸen
I knew about /usr/lib/cups/backend/usb, but no the rest of the info
relating to libusb. Thanks.

I do not know if I have anything to add to your info. It is a big move,
bringing the printer to connect via usb, but you feel that this is
needed, please just ask.
--
[]s,
Fernando
Ken Moffat
2014-01-22 20:17:40 UTC
Permalink
This post might be inappropriate. Click to display it.
Ken Moffat
2014-01-27 22:22:43 UTC
Permalink
Post by Ken Moffat
Post by Fernando de Oliveira
Yes. Have you tried it as built in the kernel, instead of module? I
think we need to know that for the book, when we decide it is ready.
No, only that one system has libusb, and the choice of packages
(basically, what was not built in my first build with make-4.0) is
not convenient for my normal usage.
OK, got back to this, and installed a new kernel (3.12.9) with the
driver built in. Also changed an ink cartridge - recharging the
heads apparently used up to 14% of some of the cartridges, according
to escputil. Anyway, with
CONFIG_USB_PRINTER=y
both escputil and cups work.

I'll mention this on -support, in case anybody has a different
view, before I change the book.

ĸen
--
das eine Mal als Tragödie, dieses Mal als Farce
Fernando de Oliveira
2014-01-27 23:39:50 UTC
Permalink
Post by Ken Moffat
OK, got back to this, and installed a new kernel (3.12.9) with the
driver built in. Also changed an ink cartridge - recharging the
heads apparently used up to 14% of some of the cartridges, according
to escputil. Anyway, with
CONFIG_USB_PRINTER=y
both escputil and cups work.
I'll mention this on -support, in case anybody has a different
view, before I change the book.
ĸen
Good! Easier "life" for many. :-)
--
[]s,
Fernando
Loading...