Bug 131097

Summary: cups should enable printer when it is turned on
Product: [openSUSE] SUSE Linux 10.1 Reporter: Andreas Kleen <ak>
Component: PrintingAssignee: Klaus Singvogel <kssingvo>
Status: RESOLVED WONTFIX QA Contact: Johannes Meixner <jsmeix>
Severity: Enhancement    
Priority: P5 - None CC: aj, asklein, vetter
Version: Alpha 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Andreas Kleen 2005-10-27 17:57:06 UTC
I have a USB laserjet printer. The printer was initially turned off.
I tried to print and cups disabled the printer  (it's possible
that the printer was already turned on during the uptime though,
I don't quite remember). Anyways on the current print attempt 
it was off.

Being disabled while turned off was ok, but after I turned it on the printer staid in disabled state and I had to manually enable it to print again.

For a normal end user that would have been a showstopper, even for 
me it cost some time for investigation.
Comment 1 Johannes Meixner 2005-10-28 07:46:02 UTC
If only one USB printer is used, see
http://www.cups.org/str.php?L1267
how you can avoid at least one situation which disables the queue
(i.e. use the generic DeviceURI "usb:/dev/usb/lp0").

You can switch YaST to use generic DeviceURIs for USB printers.
Or via command line use "lpadmin -p QUEUE -v usb:/dev/usb/lp0"
to change the DeviceURI to the generic style.
Again: This works o.k. only if you have only one USB printer.

See for example the mail
http://www.easysw.com/cups/newsgroups.php?s5622+gcups.general+v5627
and the next two mails for an explanation why the queue must be
disabled by default in case of a data transmission error.

In the next CUPS version the USB backend will do endless retires
in any case and additionally the next CUPS version adds an error
policy which allows to configure how CUPS handles these errors
(something like abort retry ignore) => will be FIXED.
Comment 2 Andreas Kleen 2005-10-28 09:12:57 UTC
It was not a real transmission error, the device was simply not there
(turned off) 

Endless retries etc. are wrong too. disabling is ok when the device
is not there. But what it should do is to just watch
for the hotplug event when it sees the USB device first and then enable the printer if disabled. Basically I think you need to add a little hook
to the USB hotplug script that handles this case.


Comment 3 Andreas Kleen 2005-10-28 10:58:08 UTC
Kay might have some input on this.
Comment 4 Johannes Meixner 2005-10-28 11:17:32 UTC
Regarding comment #2:
I understand your request.
It comes very often on the CUPS mailing list.
The request looks easy but if it was so easy,
it would have been already implemented.

Regarding "watch for the hotplug event":
I think it is up to the backend to do this.
As far as I understand the CUPS design it is not the cupsd
which should care about the plain data transmission to the recipient
because this is delegated to the various backends, see
http://portal.suse.com/sdb/en/2004/05/jsmeix_print-cups-in-a-nutshell.html
"The Backends"

Therefore it is o.k. when the backend keeps running and
polls each 30 seconds for the printer - this should not cause
a too high system load.

From my point of view it may be nicer than polling when the backend
falls asleep and is waked up by a hotplug event - but does this work
in any case - even without special hotplug/udev/HAL deamons running?

In any case:
We won't do such changes for 10.0
=> Enhancement request for 10.1 and reassigned to CUPS maintainer.
 
Comment 5 Andreas Kleen 2005-10-28 11:48:12 UTC
hotplug/udev/hal is running on SUSE and that is what matters.

I wouldn't change anything with cups itself, but just add a script
on printer hotplug that looks for the associated queues and when
they are disabled automatically enables them.
Comment 6 Johannes Meixner 2005-10-28 12:00:28 UTC
Ahh!
Thanks for clarification.

Regarding "automatically enable":
What if the admin had disabled the queue intentionally?
It should stay disabled even if a normal user unplugs
and re-plugs the USB cable.

I think the CUPS error policy (see comment #1) is the better
way to handle it.
Comment 7 Andreas Kleen 2005-10-28 12:04:45 UTC
I think it's reasonable to let cable hotplug/printer reset overwrite queue disable. If someone has access to the hardware like this they're basically like the admin. In theory you could implement two different disabled states to distingush it, but that would be probably overkill.

Polling is definitely not a good idea. I don't want to wait 30seconds
and it's just dumb in general.
Comment 8 Kay Sievers 2005-10-28 12:08:14 UTC
RH plugs into the HAL callout mechanism to notify cups about printer changes:
  http://cvs.fedora.redhat.com/viewcvs/devel/hal-cups-utils/
Comment 9 Klaus Singvogel 2005-10-28 12:31:58 UTC
Thanks. To disable the printer, as soon as an error occurs, is done with intention.

We had a long description regarding this in the administration handbook. But first was this chapter reduced to some basic hints, now this book no longer shipped. Thats were we must start to point at, if we blaim and cry. :-(
Next thing is, that printing isn't included in our free "installation support" for customers...

Anyway: I accept your point of view and your bugreport is valid. But our explanation, why we won't change the behavior isn't false neither. So we don't change the behavior here and keep being in sync with the CUPS project itself.
This contains the advantage that our users can ask at public mailing lists, why this-and-that is not working in CUPS, and they can expect to get a response from there.

Thanks for understanding.
Comment 11 Andreas Klein 2006-05-10 11:06:55 UTC
This problem should be fixed in CUPS 1.2 which is now released.
http://www.cups.org/str.php?L1267
Will there be an update for 10.1 or at least for SLES10?
Comment 12 Klaus Singvogel 2006-05-10 11:38:24 UTC
No. No updates for our old products.

cups-1.2.0 is not stable, at least not for our needs. E.g. Browsing is no longer working after a "reload" of cupsd is done. 
It is not possible to use an old 1.1.x configuration with cups-1.2.x, they are incompatible. Other fundamental changes took also place ==> a smooth upgrade is neither possible.