On Wed, Mar 2, 2011 at 9:06 AM, Bryan Kadzban <bryan@xxxxxxxxxxxxxxxxxxxxx> wrote: > Vilius Benetis wrote: >> [Vilius] >>> tomorrow I will play with the code. >> the resulting UDEV rules (with reference to works of Adrian Crenshaw), >> for those who are interested: >> >> #By default, disable it. >> ACTION=="add", SUBSYSTEMS=="usb", RUN+="/bin/sh -c 'for host in >> /sys/bus/usb/devices/usb*; do echo 0 > $host/authorized_default; >> done'" > > It may not be possible to do what I'm about to suggest with this rule > (unless there's a way to match on all devices that have an > authorized_default file -- I'm not sure where in the USB stack those > devices are), but for this rule: > >> #Enable hub devices. >> ACTION=="add", ATTR{bDeviceClass}=="09", RUN+="/bin/sh -c 'echo 1 >>> /sys$DEVPATH/authorized'" > > (and the one below it), can't you just do this instead of the RUN?: > > ATTR{authorized}="1" > > Or does that not work for some reason? Â(It'll prevent spawning a whole > lot of shells to do work that udev already has code to handle...) we tested, ATTR{authorized}="1" works well, for ATTR{authorized_default}="0" we get an error during the boot, but it still works (probably the error is due to the yet non-existing device?): error opening ATTR{/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/input/input11/event9/authorized} for writing: No such file or directory If you have an idea how to get rid of this error, please share. the rules have been used: #By default, disable it. ACTION=="add", SUBSYSTEMS=="usb", ATTR{authorized_default}="0" #Enable hub devices. ACTION=="add", ATTR{bDeviceClass}=="09", ATTR{authorized}="1" #Other things to enable ACTION=="add", ATTRS{idProduct}=="c052", ATTR{authorized}="1" -- /Vilius -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html