linux/drivers/usb/core
Kay Sievers fbf82fd2e1 [PATCH] USB: real nodes instead of usbfs
This patch introduces a /sys/class/usb_device/ class
where every connected usb-device will show up:

  tree /sys/class/usb_device/
  /sys/class/usb_device/
  |-- usb1.1
  |   |-- dev
  |   `-- device -> ../../../devices/pci0000:00/0000:00:1d.0/usb1
  |-- usb2.1
  |   |-- dev
  |   `-- device -> ../../../devices/pci0000:00/0000:00:1d.1/usb2
  ...

The presence of the "dev" file lets udev create real device nodes.
  kay@pim:~/src/linux-2.6> tree /dev/bus/usb/
  /dev/bus/usb/
  |-- 1
  |   `-- 1
  |-- 2
  |   `-- 1
  ...

udev rule:
  SUBSYSTEM="usb_device", PROGRAM="/sbin/usb_device %k", NAME="%c"
  (echo $1 | /bin/sed 's/usb\([0-9]*\)\.\([0-9]*\)/bus\/usb\/\1\/\2/')

This makes libusb pick up the real nodes instead of the mounted usbfs:
  export USB_DEVFS_PATH=/dev/bus/usb

Background:
  All this makes it possible to manage usb devices with udev instead of
  the devfs solution. We are currently working on a pam_console/resmgr
  replacement driven by udev and a pam-helper. It applies ACL's to device
  nodes, which is required for modern desktop functionalty like
  "Fast User Switching" or multiple local login support.

New patch with its own major. I've succesfully disabled usbfs and use real
nodes only on my box. With: "export USB_DEVFS_PATH=/dev/bus/usb" libusb picks
up the udev managed nodes instead of reading usbfs files.

This makes udev to provide symlinks for libusb to pick up:
  SUBSYSTEM="usb_device", PROGRAM="/sbin/usbdevice %k", SYMLINK="%c"

/sbin/usbdevice:
  #!/bin/sh
  echo $1 | /bin/sed 's/usbdev\([0-9]*\)\.\([0-9]*\)/bus\/usb\/\1\/\2/'

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:22:29 -07:00
..
buffer.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
config.c [PATCH] USB: fix up some sparse warnings about static functions that aren't static. 2005-04-18 17:39:24 -07:00
devices.c [PATCH] make driver's name be const char * 2005-06-20 15:15:01 -07:00
devio.c [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00
file.c [PATCH] USB: trivial error path fix 2005-06-20 15:15:09 -07:00
hcd-pci.c [ACPI] S3 Suspend to RAM: fix driver suspend/resume methods 2005-07-11 23:23:46 -04:00
hcd.c [PATCH] USB: convert kcalloc to kzalloc 2005-09-07 16:57:46 -07:00
hcd.h [PATCH] USB: fix in usb_calc_bus_time 2005-07-29 13:12:54 -07:00
hub.c [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00
hub.h [PATCH] usbcore: Remove hub_set_power_budget 2005-06-27 14:43:48 -07:00
inode.c [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00
message.c [PATCH] USB: Usbcore: Don't try to delete unregistered interfaces 2005-07-29 13:12:53 -07:00
otg_whitelist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sysfs.c [PATCH] USB: add bMaxPacketSize0 attribute to sysfs 2005-07-12 11:52:54 -07:00
urb.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
usb.c [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00
usb.h [PATCH] USB: real nodes instead of usbfs 2005-09-08 16:22:29 -07:00