[sane-devel] Help needed diagnosing strange failure to scan with Samsung SCX-4500W

Mike Cloaked mike.cloaked at gmail.com
Thu May 9 18:49:42 UTC 2013


Hi Theodore

Thank you very much for your long reply - much of what you say sounds right
to me, and indeed I had wondered myself whether there was a conflict
"somewhere" between the printer and scanner support within the system but I
don't know how to resolve it. I have googled and found a number of posts on
various mailing lists and forums which indicate that this problem is not a
new one, and is not specific to any one linux distro - and yet there seems
no real way to find out how to sort the conflict out.

I will answer your questions inline below and hope that this can begin to
yield some insight into where the problem lies and how to try to resolve it.


> What this looks like to me is that the support for a USB printer is
> permanently installed on your main desktop, but not on the laptops. Am I
> right about this?
>

Correct - the laptops were set to use the shared printer via cups (with
avahi-daemon running), but not to use the usb printer plugged directly into
the laptops.

>
> Is printer support installed on the laptops? Or not?
>

General printer support is installed in the laptops but the specific
printer is not set up - i.e. the crucial line in
/etc/udev/rules.d/70-printers.rules is not present in the laptops.

>
> If present on the laptops, is the printer support activated when you turn
> the
> laptop on? Or not?
>
Only the cups shared printer when the printer is plugged into the main
desktop machine. Not directly on the laptop usb port.


>
> When you successfully scan on the laptop, when did you hook up the
> scanner? Before booting? Or after?
>
> After booting.


> Obviously, what I am suspecting is that your laptops are either not
> configured to talk to a printer, or they are not installing automatically
> whatever is needed to do that, and so you can go ahead and use the
> scanner. But on the main machine it is configured to access the printer.
> And if the printer access is "active" then in all likelihood the scanner
> access is blocked. The kernel support for printers has grabbed the
> hardware and will not let go.
>
> Yes that sounds reasonable - the printer only "autoconfigures" if the
crucial extra definition line is in the udev rules file. Since it is
missing on the laptops then when the printer is plugged in it does not get
set up. On the desktop with the crucial line in the printer autoconfigured
as soon as it was plugged in. However removing the printer and re-plugging
it with the extra line removed does not fix the issue (though I have not
rebooted in that configuration - which could conceivably make a difference)


> Based upon these suspicions, a couple more questions:
>
>
> Is the printer attached permanently to the main desktop system? In
> particular, is it detected during bootup and the support installed while
> the system is booting?
>
> Usually yes - I have booted without the printer switched on, and the
desktop still fails to get the scanner going when I do turn it on (since
the printer and scanner are both operating obviously once it is switched on)


> If the above is "yes" then what happens if you hook it to the laptop, boot
> the laptop, and then try to use the scanner? Clearly, I am suspecting that
> you will suddenly not be able to access the scanner. But by all means
> do confirm that I am right or wrong.
>
> I could certainly try that - but haven't yet. I guess you are suggesting
that a kernel module will be loaded at boot and then conflict with the
scanner?


> Conversely, what happens if you disconnect the printer/scanner from the
> main machine and then boot up, and plug in the printer/scanner after
> booting. Can you now get access to the scanner? Whether the answer to
> the previous question is yes, or no, can you do a print job?
>
> If I do that with the extra line in the udev rules file then it will print
fine but not scan.


> Probably, you can think of some more tests along the same lines now that I
> brought the question up. So I leave you to do that.
>
> snip
>
> I don't know enough of the details of sane to know why this is happening.
> But what appears to be happening is that the first attempt simply looks
> for the device, and the second one wants to see if it really is a scanner
> and it is "not a scanner" because it is a printer. Perhaps someone else
> who knows the sane codebase could enlighten us why this is happening.
>
> Another thing leaves me scratching the head, here, though. If sane is
> using libusb then why does it not disable and inactivate the /dev/lp*
> which the printer is using? Such disabling is exactly what happens with a
> dual-mode camera. Namely, the /dev/video* associated with the camera is
> disabled, and the program to download still photos can now work. Not that
> this would actually make you happy, of course, because after scanning you
> would need to re-plug the USB device in order to make it to be a printer
> again (if it is acting just like one of my cameras). Curious whether your
> distro is using an old version of libusb which does not support the
> userspace-disables-module feature, or whether they have taken that feature
> back out again, thinking it was not a good idea after all. I have not kept
> up with this stuff in the last few months so I do not know.
>

The version of libusb is as follows:

[root at home1 scan-debug]# pacman -Ss libusb
core/libusb-compat 0.1.4-2 [installed]
    Library to enable user space application programs to communicate with
USB devices
core/libusbx 1.0.15-1 [installed]
    Library that provides generic access to USB device
extra/libgusb 0.1.6-1 [installed]
    GLib wrapper around libusb1


> > The system log files contain lines like:
> > May  6 16:43:27 localhost kernel: [ 8041.053060] usb 1-4: usbfs:
> > interface 1 claimed by usblp while 'xsane' sets config #1
>
> Yep. And apparently your libusb cannot grab the device, or else the
> printer is a special case and nobody gets to grab it.
>
> >
> > I have tried unplugging the device and replugging it but nothing I do
> > ever seems to make any difference.
>
> As I mentioned above, try leaving the printer unplugged during boot. Also
> try plugging the printer to the laptop before booting the laptop.
>
> Will try to run that test later this evening.

>
> I do not claim familiarity with systemd. My distro does not use it. The
> udev rules are no help, either. If the kernel grabbed the hardware because
> it is a printer, these will be ignored. Unless your libusb can in turn
> disable the printer driver. Which might not make one very happy, either,
> and is therefore far from an ultimate solution to the problem. However,
> systemd could conceivably be part of the problem. If it has "decided"
> during boot that your USB peripheral is a printer, then that decision
> might well be irrevocable. I don't know enough about systemd to be able to
> say this for certain, of course.
>
>
I would certainly like to know the answer to that very question! I have
been using systemd with udev for some time without any problems apart from
this one!


> See above. It doesn't solve the problem, of course, only narrow it down
> if my suspicions are correct. Basically, it seems to me this is a
> problem which requires fundamental changes which have not yet occurred.
> (Speculating) It seems to me that what is needed is some changes in the
> kernel code for USB printers which can accommodate dual-mode
> printer-scanner or triple-mode printer-scanner-fax hardware.
>
>
> Yes hopefully the answers to the questions will help narrow it down - but
whether any fundamental change in the udev and/or systemd code is necessary
before the two functions can both work without messing with re-plugging the
device and rebooting each time I don't know. If there was a workaround ,
say running a script, it would make life easier - but of course the
"proper" solution is to have whatever code is the underlying cause of the
issue properly fixed.  I expect as you say that this is likely not an issue
with sane but with device handling in one or other of the
kernel/udev/systemd

Thanks


-- 
mike c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130509/fde75c09/attachment.html>


More information about the sane-devel mailing list