[Nut-upsdev] nut + usb + udev with kernel 2.6.22

Vamp admin at vampik.ru
Wed Oct 3 17:53:52 UTC 2007


Hello, Arnaud!
You wrote to "Gilad Arnold" <arnold at cs.berkeley.edu> on Wed, 3 Oct 2007 
09:00:27 +0200:

> first, thanks for your report.

> I suspected such a thing from recent feedback.

> Here is what I'm preparing to push:

> --- nut-2.2.0~/scripts/udev/nut-usbups.rules.in 2007-02-01
> 16:23:17.000000000 +0100
> +++ nut-2.2.0/scripts/udev/nut-usbups.rules.in  2007-02-02
> 15:43:42.000000000 +0100
> @@ -1,7 +1,11 @@
>  # udev rules for the NUT USB drivers

> -SUBSYSTEM!="usb_device", GOTO="nut-usbups_rules_end"
>  ACTION!="add", GOTO="nut-usbups_rules_end"
> +SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
> +SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
> +BUS!="usb", GOTO="nut-usbups_rules_end"
> +
> +LABEL="nut-usbups_rules_real"

>  # MGE UPS SYSTEMS - usbhid-ups
>  SYSFS{idVendor}=="0463", SYSFS{idProduct}=="ffff", MODE="664",
> GROUP="@RUN_AS_USER@"

> Can you both test it and make some feedback?

Hmmm... There is no "BUS" variable. There is only "PHYSDEVBUS". Here is a 
part of udevmonitor log after hotplugging the UPS:


UDEV  [1191432274.966025] add      /devices/pci0000:00/0000:00:10.0/usb2/2-2 
(usb)
UDEV_LOG=7
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-2
SUBSYSTEM=usb
SEQNUM=928
MAJOR=189
MINOR=131
DEVTYPE=usb_device
PHYSDEVBUS=usb
DEVICE=/proc/bus/usb/002/004
PRODUCT=1/0/100
TYPE=0/0/0
BUSNUM=002
DEVNUM=004
UDEVD_EVENT=1
DEVNAME=/dev/bus/usb/002/004

UDEV  [1191432274.973327] add      /class/usb_endpoint/usbdev2.4_ep00 
(usb_endpoint)
UDEV_LOG=7
ACTION=add
DEVPATH=/class/usb_endpoint/usbdev2.4_ep00
SUBSYSTEM=usb_endpoint
SEQNUM=929
MAJOR=254
MINOR=10
PHYSDEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-2
PHYSDEVBUS=usb
PHYSDEVDRIVER=usb
UDEVD_EVENT=1
DEVNAME=/dev/usbdev2.4_ep00


UDEV  [1191432275.180306] add      /class/usb/hiddev0 (usb)
UDEV_LOG=7
ACTION=add
DEVPATH=/class/usb/hiddev0
SUBSYSTEM=usb
SEQNUM=931
MAJOR=180
MINOR=96
PHYSDEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0
PHYSDEVBUS=usb
PHYSDEVDRIVER=usbhid
UDEVD_EVENT=1
DEVNAME=/dev/usb/hiddev0


UDEV  [1191432275.185572] add      /class/usb_endpoint/usbdev2.4_ep81 
(usb_endpoint)
UDEV_LOG=7
ACTION=add
DEVPATH=/class/usb_endpoint/usbdev2.4_ep81
SUBSYSTEM=usb_endpoint
SEQNUM=932
MAJOR=254
MINOR=11
PHYSDEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0
PHYSDEVBUS=usb
PHYSDEVDRIVER=usbhid
UDEVD_EVENT=1
DEVNAME=/dev/usbdev2.4_ep81

UDEV  [1191432275.227639] add      /class/usb_device/usbdev2.4 (usb_device)
UDEV_LOG=7
ACTION=add
DEVPATH=/class/usb_device/usbdev2.4
SUBSYSTEM=usb_device
SEQNUM=933
MAJOR=189
MINOR=131
PHYSDEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-2
PHYSDEVBUS=usb
PHYSDEVDRIVER=usb
UDEVD_EVENT=1
DEVNAME=/dev/bus/usb/002/004

So, here we get:
/dev/bus/usb/002/004 (SUBSYSTEM=usb, DEVTYPE=usb_device)
/dev/usbdev2.4_ep00 (SUBSYSTEM=usb_endpoint)
/dev/usb/hiddev0 (SUBSYSTEM=usb)
/dev/usbdev2.4_ep81 (SUBSYSTEM=usb_endpoint)
/dev/bus/usb/002/004 (SUBSYSTEM=usb_device)

/dev/bus/usb/xxx/xxx is added twice, with SUBSYSTEM=usb, DEVTYPE=usb_device 
and with SUBSYSTEM=usb_device.

In case of colgplug, we get the same except that /dev/bus/usb/xxx/xxx is 
added only once with SUBSYSTEM=usb, DEVTYPE=usb_device .

I think, Gilad Arnold's solution is best if we need only 
/dev/bus/usb/xxx/xxx and do not need hiddev and endpoints. My solution 
adjusts permissions of all devices.

With best regards, Vamp.  E-mail: admin at vampik.ru 




More information about the Nut-upsdev mailing list