FreeBSD 8.0 and HPLIP - you also need execute permissions on /dev/usb

Patrick Lamaiziere patfbsd at davenulle.org
Mon Jan 11 19:56:32 UTC 2010


Le Sun, 10 Jan 2010 02:39:13 +0100,
Torfinn Ingolfsen <torfinn.ingolfsen at broadpark.no> a écrit :

> Ok, I recently "upgraded" my main workstation to FreeBSD 8.0-stable
> (clean install on a new slice):
> tingo at kg-v2$ uname -a
> FreeBSD kg-v2.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #1: Wed Jan  6
> 21:21:40 CET 2010     root at kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC
> amd64
> 
> After that I got the fun of installøing all my ports again. 
> 
> Anyway, this machine have a HP Photosmart 8250 printer connected to it
> (via usb), and I have been using hplip from ports to controil it.
> Before the upgrade (using FreeBSD 7.2-stable, I was running HPLIP
> 3.9.6b). Now I installed hplip 3.9.8 from ports, since it is the
> newest i ports.

...
 
> Ok, so you need execute permissions on /dev/usb as well (because it
> is a directory). I fixed it by adding 'add path 'usb' mode 0770'
> to /etc/devfs.rules.
> 
> Is this the correct way to deal wih it?

You don't have to change the mode for /dev/usb, just remove the rules:
add path 'usb*' mode 0660

add path 'usb/*' group cups
add path 'usb/*' mode 0660

It should work but you change *all* the usb devices nodes.
I don't like it.

uscanner is gone, you can remove this :
add path 'uscanner*' group cups
add path 'uscanner*' mode 0660

If you want to use the hplip tools, the user must be able to access
the ugen devices of the printer. For this I use a group hplip
/etc/group
hplip:*:999:patrick

A rule in devd.conf to run a small script when the printer is detected
(an all-in-one HP Photosmart C4680)

attach 10 {
        device-name "ugen[0-9]+";
        match "vendor"  "0x03f0";
        match "product" "0x7411";
        action "/root/sbin/ugen-hdle $device-name";
};

And the small script:
/root/sbin/ugen-hdle 
#!/bin/sh
dev=`echo $1 | /usr/bin/awk 'BEGIN { } { s = substr($0, 5, 99); } END
{print s; }'`

/usr/sbin/chown cups:hplip /dev/usb/$dev.[0-9]
/bin/chmod g+rw /dev/usb/$dev.[0-9]

So I've got :
# ls -la /dev/usb/*
crw-rw----  1 cups  hplip       0, 108 28 oct 03:24 /dev/usb/2.2.0
crw-rw----  1 cups  hplip       0, 112 28 oct 03:24 /dev/usb/2.2.1
crw-rw----  1 cups  hplip       0, 113 28 oct 03:24 /dev/usb/2.2.2
crw-rw----  1 cups  hplip       0, 114 28 oct 03:24 /dev/usb/2.2.4
crw-rw----  1 cups  hplip       0, 115 28 oct 03:24 /dev/usb/2.2.5
crw-rw----  1 cups  hplip       0, 116 28 oct 03:24 /dev/usb/2.2.6
crw-rw----  1 cups  hplip       0, 117 28 oct 03:24 /dev/usb/2.2.7
crw-rw----  1 cups  hplip       0, 118 28 oct 03:24 /dev/usb/2.2.8
crw-rw----  1 cups  hplip       0, 131 28 oct 03:24 /dev/usb/2.2.9

$ id
uid=1001(patrick) gid=1001(patrick)
groups=1001(patrick),0(wheel),5(operator),999(hplip)

Works fine here. There is (was?) a small bug with the hp tools and
cups. Hp-systray does not work if the locale is set to something else
than "C".
 
Regards.


More information about the freebsd-usb mailing list