Bug 526657

Summary: yast2-printer: be ready for udev-configure-printer
Product: [openSUSE] openSUSE 11.2 Reporter: Vincent Untz <vuntz>
Component: YaST2Assignee: Johannes Meixner <jsmeix>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P2 - High CC: jsmeix
Version: Factory   
Target Milestone: Factory   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Vincent Untz 2009-07-30 08:46:53 UTC
As discussed in https://features.opensuse.org/305345, cups-autoconfig will be replaced. The new system-config-printer comes with some udev helpers that will play the role.

Looking at the preferences of cups-autoconfig in the yast tool, I don't think they're really that useful, so we could just remove it and replace the part about installing/removing cups-autoconfig with the same code but for the udev-configure-printer package.

(note: I didn't push the new package to factory yet, will hopefully do it soon)
Comment 1 Johannes Meixner 2009-08-04 07:06:03 UTC
Perhaps a good idea to have the yast2-printer author in CC ;-)

Vincent,
what are the reasonable configure options for the new
printer autoconfig tool?

Is cups-autoconfig already dropped for 11.2?
If not, I will keep the current cups-autoconfig stuff in yast2-printer.
If yes, what about an update 11.1 -> 11.2?
Will cups-autoconfig be obsoleted by the new printer autoconfig tool?

How can printer autoconfiguration be switched off and on?
Is there a sub-package in system-config-printer which contains only
the printer autoconfig stuff so that removing this sub-package
would switch off printer autoconfiguration?
If not, ist there a config file option to switch autoconfiguration
off and on?
If not, could one move the "some udev helpers" (which exxct files?)
away to switch off autoconfiguration?

In short:
How does the "some udev helpers" work?
Is there documentation?
If yes, where?
Comment 2 Johannes Meixner 2009-08-04 07:07:06 UTC
And this is no "normal" bug but a very late enhancement request.
Comment 3 Vincent Untz 2009-08-04 12:09:36 UTC
(In reply to comment #1)
> Perhaps a good idea to have the yast2-printer author in CC ;-)

(I thought you'd get notified, wrong assumption ;-) apologies)

> Vincent,
> what are the reasonable configure options for the new
> printer autoconfig tool?

There's no option as far as I can tell.

> Is cups-autoconfig already dropped for 11.2?

No, but I'd like to drop it: it's really not maintained at all, with nobody at all even looking at it.

> If not, I will keep the current cups-autoconfig stuff in yast2-printer.
> If yes, what about an update 11.1 -> 11.2?
> Will cups-autoconfig be obsoleted by the new printer autoconfig tool?

In theory, it will get obsoleted, yes (there's an Obsoletes tag in the package).

> How can printer autoconfiguration be switched off and on?

Add/remove the udev-configure-printer package.

An alternative is to edit/add/remove the %{_sysconfdir}/udev/rules.d/70-printers.rules file which contains the following:

# Low-level USB device add trigger
ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="07", ATTR{bInterfaceSubClass}=="01", RUN+="udev-configure-printer add %p"
# usblp device add trigger (needed when usblp is already loaded)
ACTION=="add", KERNEL=="lp*", RUN+="udev-configure-printer add %p"

# Low-level USB device remove trigger
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:0701*:*", RUN+="udev-configure-printer remove %p"

If it helps, I can put a copy of the file somewhere else in the package, so that you can blindly remove it and easily get the latest version of the package when adding it back.

> Is there a sub-package in system-config-printer which contains only
> the printer autoconfig stuff so that removing this sub-package
> would switch off printer autoconfiguration?

Yes, this subpackage is named udev-configure-printer. I can rename the package to something else if you think it makes sense.

> If not, ist there a config file option to switch autoconfiguration
> off and on?
> If not, could one move the "some udev helpers" (which exxct files?)
> away to switch off autoconfiguration?

See above :-)

> In short:
> How does the "some udev helpers" work?
> Is there documentation?
> If yes, where?

It's really all in the 70-printers.rules file. If you need more details, just ask.


(fwiw, it's coming a bit late, but we skipped the hal-cups-utils step and went directly to this udev approach, which is really new)
Comment 4 Johannes Meixner 2009-08-04 12:37:49 UTC
Regarding cups-autoconfig:
yast2-printer is already safe if cups-autoconfig is not installed.
I will remove in yast2-printer the possibility to install it.
But if it is already installed (e.g. after an update or when
a user installed it manually because he likes it so much ;-)
the old functionality is still available in yast2-printer.

Regarding udev-configure-printer:
Do not rename it.
I do not care how its name is.
But I will use the name hardcoded in yast2-printer.
Therefore I care that the name is stable.
Add/remove the udev-configure-printer package is perfectly
simple and easy for me and for the end-user too.
(Just like "sane-backends-autoconfig".)


Another question:

When in the running system udev-configure-printer gets installed
or removed, how is udev notified about its changed rules
so that udev will start to configure printers automatically
versus will stop to configure printers automatically?

Or is a restart of the whole udev system needed
which means - as far as I understand - a complete reboot
because udev is part of /etc/init.d/boot...)?
Comment 5 Vincent Untz 2009-08-04 12:52:06 UTC
(In reply to comment #4)
> When in the running system udev-configure-printer gets installed
> or removed, how is udev notified about its changed rules
> so that udev will start to configure printers automatically
> versus will stop to configure printers automatically?
> 
> Or is a restart of the whole udev system needed
> which means - as far as I understand - a complete reboot
> because udev is part of /etc/init.d/boot...)?

As far as I know, you have nothing to do: for example, I just installed the package, plugged a printer and it worked. udev is using inotify to monitor the rules, so it picks up any change there automatically.
Comment 6 Johannes Meixner 2009-08-04 13:25:09 UTC
Vincent,
could you verify if it also works the other way round:
Unplug the printer, remove all print queues (lpadmin -x <queue>),
remove udev-configure-printer, finally replug the printer.
Now there should be still no print queue.
Comment 7 Vincent Untz 2009-08-05 09:18:16 UTC
(In reply to comment #6)
> Vincent,
> could you verify if it also works the other way round:
> Unplug the printer, remove all print queues (lpadmin -x <queue>),
> remove udev-configure-printer, finally replug the printer.
> Now there should be still no print queue.

Works as expected.
Comment 8 Johannes Meixner 2009-08-05 10:50:17 UTC
Fixed yast2-printer in SVN revision 58285:
-----------------------------------------------------------------------
- In the Autoconfig dialog autoconfig.ycp added support for
  udev-configure-printer which replaces cups-autoconfig
  because cups-autoconfig is deprecated because
  cups-autoconfig uses HAL which is deprecated, see
  http://lists.freedesktop.org/archives/hal/2009-June/013429.html
  nevertheless cups-autoconfig is still supported too
  (see Novell/Suse Bugzilla bnc#526657).
- 2.18.19
-----------------------------------------------------------------------
Comment 9 Johannes Meixner 2009-08-05 12:04:57 UTC
Submitted to openSUSE:Factory:
-------------------------------------------------------------------------
 16776  State:new     Creator:jsmeix       When:2009-08-05T14:01:04
        submit:       YaST:Head/yast2-printer  ->  openSUSE:Factory       
        Comment: 'Upgraded to 2.18.19'
-------------------------------------------------------------------------