Andrew Benton wrote:
If a package in BLFS depends on Hotplug, perhaps a page about hotplug
can be added to BLFS? For what it's worth, libusb compiles and works
fine for me without the hotplug scripts.
That's because of the current insecure /proc/bus/usb permissions in BLFS
(i.e., the "usb" group added by me specifically in order to avoid
dependency on hotplug). Libusb _does_ compile and work in this insecure
setup. But when one begins to separate USB devices that one should and
should not have direct access to, the following happens.
Old setup:
My USB scanner has a vendor ID 05d8 and a product ID 4002. When this
scanner is being detected by coldplug or hotplug, the "usb.agent" runs
and looks up the vendor/device ID pair in
/etc/hotplug/usb/libsane.usermap (I am talking about old SANE, the new
one uses a handler in /etc/hotplug.d/usb, but that's still obsolete,
racy, and AFAIK gPhoto2 still uses usermaps). It's there, so
/etc/hotplug/usb/libsane runs, sleeps 3 seconds in order to
/proc/bus/usb/xxx/yyy pseudofile to appear and changes its group to
"scanner".
New setup:
The usermaps are not supported at all, and hotplug handlers should be
converted to udev rules. Also, raw usb devices get a sane device node of
the form /dev/bus/usb/1/2 (needs at least kernel 2.6.13-rc6-mm1 or
2.6.14-rc1). The relevant (very long) udev rule exactly corresponding to
the old setup is:
SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}
B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c", GROUP="usb"
One no longer has to mount the obsolete /proc/bus/usb filesystem then.
For scanners and cameras, one has to add 10000 rules that match each
vendor/device ID pair and override GROUP.
Also the following patch is needed for libusb:
Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
---
diff -u -r1.73 linux.c
--- linux.c 1 Mar 2005 19:36:42 -0000 1.73
+++ linux.c 9 Aug 2005 00:06:43 -0000
@@ -636,11 +636,8 @@
if (check_usb_vfs("/proc/bus/usb")) {
strncpy(usb_path, "/proc/bus/usb", sizeof(usb_path) - 1);
usb_path[sizeof(usb_path) - 1] = 0;
- } else if (check_usb_vfs("/sys/bus/usb")) { /* 2.6 Kernel with sysfs */
- strncpy(usb_path, "/sys/bus/usb", sizeof(usb_path) -1);
- usb_path[sizeof(usb_path) - 1] = 0;
- } else if (check_usb_vfs("/dev/usb")) {
- strncpy(usb_path, "/dev/usb", sizeof(usb_path) - 1);
+ } else if (check_usb_vfs("/dev/bus/usb")) {
+ strncpy(usb_path, "/dev/bus/usb", sizeof(usb_path) -1);
usb_path[sizeof(usb_path) - 1] = 0;
} else
usb_path[0] = 0; /* No path, no USB support */
--
Alexander E. Patrakov
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page