udev-ish replacement for hal-cups-utils?

Martin Pitt martin.pitt at ubuntu.com
Mon Jul 20 08:38:32 PDT 2009


Till Kamppeter [2009-07-18 21:33 +0200]:
> I got udev-configure-printer reading out the device ID, by replacing
> your 70-printers.rules by the following:
> 
> ACTION=="add", SUBSYSTEM=="usb", ATTRS{bInterfaceClass}=="07",
> ATTRS{bInterfaceSubClass}=="01",
> IMPORT{program}+="udev-configure-printer add %p"
> ACTION=="remove", RUN+=ENV{REMOVE_CMD}

Note that this isn't what REMOVE_CMD is supposed to do. You need to do

 ACTION==..., ENV{REMOVE_CMD}="udev-configure-printer remove %p"

and then it is RUN by udev automatically.

> This naturally only works with the usblp kernel module loaded (as
> otherwise udev does not provide the device ID).

No, this rule should work fine without usblp, udev-configure-printer
just won't find the ieee1284_id attribute. But the rule itself doesn't
match on that.

> The removal action ("udev-configure-printer remove ...") does not
> work for me, probably due to the parentheses in the device ID:

That's probably due to the quoting that happens in udev rules; I think
you need to store an additional "identifier" attribute in cups for
that, either the sysfs path directly, or the encoded device ID, and
compare that with what you get on device removal (perhaps with the
ENV{IEEE1284_ID}="$attr{ieee1284_id}" trick).

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the devkit-devel mailing list