On Thu, Nov 29, 2012 at 07:31:10PM +0000, Jorge Almeida wrote

> It is a matter of programming, not looking. I need a program that
> creates the symlink when the device is plugged in. Think mdev
> (more precisely, a complement to mdev that would take care of a few
> particular devices, to allow using fstab to mount them in chosen
> mountpoints, and then leave the rest to mdev).

  I have a couple of scripts that automount USB devices under mdev.  See
https://wiki.gentoo.org/wiki/Mdev for the general setup, and
https://wiki.gentoo.org/wiki/Mdev/Automount_USB and
https://wiki.gentoo.org/wiki/Mdev/Automount_USB/automount

  Once set up, "it just works".  If you want to go spelunking through
/sys for connected USB devices, here are a few hints.  I currently
have connected to my machine...
* a Dell keyboard
* a Logitech trackball mouse
* an external USB hard drive
* 2 USB keys

  The output below shows that not every USB device has a serial number,
and the "Patriot Memory" key has a serial number but no manufacturer...

[d531][waltdnes][~] find /sys/devices/pci0* -name serial | xargs cat
0000:00:1a.0
0000:00:1a.1
0000:00:1a.2
0000:00:1a.7
0000:00:1d.0
0000:00:1d.1
0000:00:1d.2
0000:00:1d.7
00000000000000070493
078215B00E5C
574341565530313435313431

[d531][waltdnes][~] find /sys/devices/pci0* -name manufacturer | xargs cat
Linux 3.3.8-gentoo uhci_hcd
Linux 3.3.8-gentoo uhci_hcd
Dell
Linux 3.3.8-gentoo uhci_hcd
Logitech
Linux 3.3.8-gentoo ehci_hcd
Linux 3.3.8-gentoo uhci_hcd
Linux 3.3.8-gentoo uhci_hcd
Linux 3.3.8-gentoo uhci_hcd
Linux 3.3.8-gentoo ehci_hcd
SanDisk Corporation
        
Western Digital

[d531][waltdnes][~] find /sys/devices/pci0* -name product | xargs cat
UHCI Host Controller
UHCI Host Controller
Dell USB Keyboard
2003
UHCI Host Controller
Trackball
c404
EHCI Host Controller
UHCI Host Controller
UHCI Host Controller
UHCI Host Controller
EHCI Host Controller
Cruzer Titanium
Patriot Memory  
My Book 1110


-- 
Walter Dnes <waltd...@waltdnes.org>
We are apparently better off trying to avoid udev like the plague.
Linus Torvalds; 2012/10/03 https://lkml.org/lkml/2012/10/3/349

Reply via email to