udev-ish replacement for hal-cups-utils?

Martin Pitt martin.pitt at ubuntu.com
Fri Jul 17 02:59:04 PDT 2009


Hello Tim,

Tim Waugh [2009-07-16 23:31 +0100]:
> The requirements for this are a bit fiddly:
> 
> * if CUPS < 1.4 is to be supported, we need to give group lp read/write
> access to the usblp device node

This is provided by 50-udev-default.rules:

KERNEL=="parport[0-9]*",        GROUP="lp"
SUBSYSTEM=="printer",           KERNEL=="lp*", GROUP="lp"
SUBSYSTEM=="ppdev",             GROUP="lp"
SUBSYSTEM=="usb",               KERNEL=="lp*", NAME="usb/%k",
SYMLINK+="usb%k", GROUP="lp"
KERNEL=="lp[0-9]*",             GROUP="lp"
KERNEL=="irlpt[0-9]*",          GROUP="lp"

> * additionally, the HPLIP "toolbox" program seems to want direct access
> to this node as well, so potentially the console user will get
> read/write access as well using an ACL (although how that can work for
> fast user switching without hal I'm not entirely sure)

This was recently fixed in udev 145:

  70-acl.rules: ENV{ID_HPLIP}=="1", ENV{ACL_MANAGE}="1"

Analoguous to the old hal fdis, the hplip package now needs to ship
rules like

  ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c302", GROUP="lp", ENV{ID_HPLIP}="1"

for this to work. This was done in the Ubuntu package, but I don't
know about the upstream status. Till?

> * otherwise, the CUPS usb backend can use libusb so group lp needs
> read/write access to the /dev/bus/usb/xxx/yyy node

How to identify non-hplip USB devices which are printers and talked to
via cups and libusb? Can we rely on printers setting a correct USB
class (7 according to [1])? Or do they need some magic ioctls and
other poking to identify them as printers?

It seems to me that 50-udev-default.rules could just add a rule like

  SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="07", GROUP="lp"

Kay, do you think that's appropriate?

How did that work in the pre-udev world? hal didn't do anything to
change the group of raw USB devices.

I don't think that auto ACLs are appropriate here, since cupsd isn't
on a "local console" in the ConsoleKit sense, so it wouldn't get
auto-ACLs.

> Can udev set ACLs easily, or should that be done by the callout program?

udev has support for automatic ACLs, similar to the ones that hal
provided. Projects need to ship udev rules which identify particular
devices (ID_GPHOTO2, ID_HPLIP, etc.) and 70-acl.rules in udev then
assigns the ACL_MANAGE=1 tag (the latter is done centrally in udev
just in case the implementation of ACL setting changes).

Thanks,

Martin

[1] http://www.usb.org/developers/defined_class/#BaseClass07h

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/devkit-devel/attachments/20090717/3c513943/attachment.pgp 


More information about the devkit-devel mailing list