Re: Udev USB device class links
On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: > On 7/26/07, Matthew Burgess <[EMAIL PROTECTED]> wrote: > > > > On Thu, 26 Jul 2007 09:17:52 -0700, "Dan Nicholson" <[EMAIL PROTECTED]> > > wrote: > > > On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: > > >> The 2.6.22 kernel (maybe 2.6.21 too, didn't check) has an option > > >> CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text > > >> states that it is unnecessary if the following udev rule is used: > > >> > > >> SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ > > >> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" > > >> > > >> I checked the SuSE rules in udev-111, and this is in addition to the > > >> existing usb_device rule: > > >> > > >> SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; > > >> B=$${X.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" > > >> > > >> Does anyone have a problem if I add that to our rules? > > > > > > Actually, it seems that they're the same rule, but the kernel no > > > longer supplies the usb_device subsystem is removed in 2.6.22. Here's > > > a relevant bug: > > > > > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=248916#c10 > > > > > > So, the new rule can replace the old one depending on whether > > > CONFIG_USB_DEVICE_CLASS is set. I think both rules should be there so > > > that our rules stay compatible whether this setting is Y or N. Also, > > > leaving the older rule there means you get /dev/bus/usb nodes if you > > > run an older kernel. > > > > I'm not sure we need both rules. If CONFIG_USB_DEVICE_CLASS=n, the new > > rule will take effect. If CONFIG_USB_DEVICE_CLASS=y, whichever of the > > NAME= rules is hit first will take effect, if my understanding of Udev rule > > evaluation is correct. Therefore, if the new rule is placed above the > > existing one, the existing one then becomes entirely redundant. > > This is where I'm a little unsure. I believe if > CONFIG_USB_DEVICE_CLASS=y, then there won't be anything that matches > SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device". In that case, the new > rule would be useless. But I'm not sure about that since I'm not > actually running 2.6.22 (in the process of rebasing my .config). I built a kernel with and without CONFIG_USB_DEVICE_CLASS=y, and the rule works in both situations. It works fine with both. The only difference if you have it set to y is that you get /dev/usbdev?.? nodes (in addition to the endpoint _ep?? ones) and /sys/class/usb_device paths. Now to fix up the equivalent rule on the libusb page in BLFS. -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: Udev USB device class links
On Thu, Jul 26, 2007 at 10:25:57AM -0600, Matthew Burgess wrote: > On Thu, 26 Jul 2007 09:17:52 -0700, "Dan Nicholson" <[EMAIL PROTECTED]> wrote: > > On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: > >> The 2.6.22 kernel (maybe 2.6.21 too, didn't check) Nope, that setting is only in 2.6.22. :-) > >> has an option > >> CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text > >> states that it is unnecessary if the following udev rule is used: > >> > >> SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ > >> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" > >> > >> Does anyone have a problem if I add that to our rules? > > > > Actually, it seems that they're the same rule, but the kernel no > > longer supplies the usb_device subsystem is removed in 2.6.22. Here's > > a relevant bug: > > > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=248916#c10 Yeah, there's been some intermittent discussion on linux-hotplug-devel about this. IIRC, the usb_device class doesn't exist anymore, and some other part of the USB stuff creates those devices now. (The real USB device? The USB interface? Not quite sure.) As Kay said in that bug, the old method had some unfixable race conditions; that's why it got removed (when that kernel option is disabled, anyway). > > So, the new rule can replace the old one depending on whether > > CONFIG_USB_DEVICE_CLASS is set. I think both rules should be there so > > that our rules stay compatible whether this setting is Y or N. Also, > > leaving the older rule there means you get /dev/bus/usb nodes if you > > run an older kernel. > > I'm not sure we need both rules. If CONFIG_USB_DEVICE_CLASS=n, the new > rule will take effect. If CONFIG_USB_DEVICE_CLASS=y, whichever of the > NAME= rules is hit first will take effect, if my understanding of Udev > rule evaluation is correct. Therefore, if the new rule is placed above > the existing one, the existing one then becomes entirely redundant. As long as 2.6.22 kernels provide the $DEVTYPE / $BUSNUM / $DEVNUM values when CONFIG_USB_DEVICE_CLASS is enabled, then that's true. I don't know whether they do, though. I'm still running 2.6.21.3; Dan, if you're running 2.6.22.x with the USB device class stuff on, can you see whether the new rule will work? > I understand that someone running an older kernel would need the old > rule, but then we don't officially support running older versions of > any of our packages Agreed. If 2.6.22 provides the above environment variables no matter what CONFIG_USB_DEVICE_CLASS is set to, then yank the old rule out. Especially since it's really really ugly... ;-) pgpsySZsVdSv3.pgp Description: PGP signature -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: Udev USB device class links
On 7/26/07, Matthew Burgess <[EMAIL PROTECTED]> wrote: > > On Thu, 26 Jul 2007 09:17:52 -0700, "Dan Nicholson" <[EMAIL PROTECTED]> wrote: > > On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: > >> The 2.6.22 kernel (maybe 2.6.21 too, didn't check) has an option > >> CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text > >> states that it is unnecessary if the following udev rule is used: > >> > >> SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ > >> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" > >> > >> I checked the SuSE rules in udev-111, and this is in addition to the > >> existing usb_device rule: > >> > >> SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; > >> B=$${X.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" > >> > >> Does anyone have a problem if I add that to our rules? > > > > Actually, it seems that they're the same rule, but the kernel no > > longer supplies the usb_device subsystem is removed in 2.6.22. Here's > > a relevant bug: > > > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=248916#c10 > > > > So, the new rule can replace the old one depending on whether > > CONFIG_USB_DEVICE_CLASS is set. I think both rules should be there so > > that our rules stay compatible whether this setting is Y or N. Also, > > leaving the older rule there means you get /dev/bus/usb nodes if you > > run an older kernel. > > I'm not sure we need both rules. If CONFIG_USB_DEVICE_CLASS=n, the new rule > will take effect. If CONFIG_USB_DEVICE_CLASS=y, whichever of the NAME= rules > is hit first will take effect, if my understanding of Udev rule evaluation is > correct. Therefore, if the new rule is placed above the existing one, the > existing one then becomes entirely redundant. This is where I'm a little unsure. I believe if CONFIG_USB_DEVICE_CLASS=y, then there won't be anything that matches SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device". In that case, the new rule would be useless. But I'm not sure about that since I'm not actually running 2.6.22 (in the process of rebasing my .config). So, as Bryan said, it depends on whether the environment variables are still set in the event that CONFIG_USB_DEVICE_CLASS=y. Looking at the code in drivers/usb/core/devio.c, I think it is. I think all that happens is that you get the usbdev devices in addition to the normal routine. OK, I'm pretty sure that the DEVTYPE variable will be filled regardless of that CONFIG setting. > I understand that someone running an older kernel would need the old rule, > but then we don't officially support running older versions of any of our > packages (as it's not in an official, tested release) let alone something as > critical as the kernel. Yeah, I guess I don't really care too much about being backwards compatible with kernels. -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: Udev USB device class links
On Thu, 26 Jul 2007 09:17:52 -0700, "Dan Nicholson" <[EMAIL PROTECTED]> wrote: > On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: >> The 2.6.22 kernel (maybe 2.6.21 too, didn't check) has an option >> CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text >> states that it is unnecessary if the following udev rule is used: >> >> SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ >> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" >> >> I checked the SuSE rules in udev-111, and this is in addition to the >> existing usb_device rule: >> >> SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; >> B=$${X.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" >> >> Does anyone have a problem if I add that to our rules? > > Actually, it seems that they're the same rule, but the kernel no > longer supplies the usb_device subsystem is removed in 2.6.22. Here's > a relevant bug: > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=248916#c10 > > So, the new rule can replace the old one depending on whether > CONFIG_USB_DEVICE_CLASS is set. I think both rules should be there so > that our rules stay compatible whether this setting is Y or N. Also, > leaving the older rule there means you get /dev/bus/usb nodes if you > run an older kernel. I'm not sure we need both rules. If CONFIG_USB_DEVICE_CLASS=n, the new rule will take effect. If CONFIG_USB_DEVICE_CLASS=y, whichever of the NAME= rules is hit first will take effect, if my understanding of Udev rule evaluation is correct. Therefore, if the new rule is placed above the existing one, the existing one then becomes entirely redundant. I understand that someone running an older kernel would need the old rule, but then we don't officially support running older versions of any of our packages (as it's not in an official, tested release) let alone something as critical as the kernel. Regards, Matt. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: Udev USB device class links
On 7/26/07, Dan Nicholson <[EMAIL PROTECTED]> wrote: > The 2.6.22 kernel (maybe 2.6.21 too, didn't check) has an option > CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text > states that it is unnecessary if the following udev rule is used: > > SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ > NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" > > I checked the SuSE rules in udev-111, and this is in addition to the > existing usb_device rule: > > SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; > B=$${X.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" > > Does anyone have a problem if I add that to our rules? Actually, it seems that they're the same rule, but the kernel no longer supplies the usb_device subsystem is removed in 2.6.22. Here's a relevant bug: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=248916#c10 So, the new rule can replace the old one depending on whether CONFIG_USB_DEVICE_CLASS is set. I think both rules should be there so that our rules stay compatible whether this setting is Y or N. Also, leaving the older rule there means you get /dev/bus/usb nodes if you run an older kernel. Thoughts? -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Udev USB device class links
The 2.6.22 kernel (maybe 2.6.21 too, didn't check) has an option CONFIG_USB_DEVICE_CLASS that's marked as deprecated. The help text states that it is unnecessary if the following udev rule is used: SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" I checked the SuSE rules in udev-111, and this is in addition to the existing usb_device rule: SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" Does anyone have a problem if I add that to our rules? -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page