Gentoo Archives: gentoo-user

From: Walter Dnes <waltdnes@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] serial in /sys
Date: Thu, 29 Nov 2012 22:37:32
Message-Id: 20121129223557.GA11921@waltdnes.org
In Reply to: Re: [gentoo-user] serial in /sys by Jorge Almeida
1 On Thu, Nov 29, 2012 at 07:31:10PM +0000, Jorge Almeida wrote
2
3 > It is a matter of programming, not looking. I need a program that
4 > creates the symlink when the device is plugged in. Think mdev
5 > (more precisely, a complement to mdev that would take care of a few
6 > particular devices, to allow using fstab to mount them in chosen
7 > mountpoints, and then leave the rest to mdev).
8
9 I have a couple of scripts that automount USB devices under mdev. See
10 https://wiki.gentoo.org/wiki/Mdev for the general setup, and
11 https://wiki.gentoo.org/wiki/Mdev/Automount_USB and
12 https://wiki.gentoo.org/wiki/Mdev/Automount_USB/automount
13
14 Once set up, "it just works". If you want to go spelunking through
15 /sys for connected USB devices, here are a few hints. I currently
16 have connected to my machine...
17 * a Dell keyboard
18 * a Logitech trackball mouse
19 * an external USB hard drive
20 * 2 USB keys
21
22 The output below shows that not every USB device has a serial number,
23 and the "Patriot Memory" key has a serial number but no manufacturer...
24
25 [d531][waltdnes][~] find /sys/devices/pci0* -name serial | xargs cat
26 0000:00:1a.0
27 0000:00:1a.1
28 0000:00:1a.2
29 0000:00:1a.7
30 0000:00:1d.0
31 0000:00:1d.1
32 0000:00:1d.2
33 0000:00:1d.7
34 00000000000000070493
35 078215B00E5C
36 574341565530313435313431
37
38 [d531][waltdnes][~] find /sys/devices/pci0* -name manufacturer | xargs cat
39 Linux 3.3.8-gentoo uhci_hcd
40 Linux 3.3.8-gentoo uhci_hcd
41 Dell
42 Linux 3.3.8-gentoo uhci_hcd
43 Logitech
44 Linux 3.3.8-gentoo ehci_hcd
45 Linux 3.3.8-gentoo uhci_hcd
46 Linux 3.3.8-gentoo uhci_hcd
47 Linux 3.3.8-gentoo uhci_hcd
48 Linux 3.3.8-gentoo ehci_hcd
49 SanDisk Corporation
50
51 Western Digital
52
53 [d531][waltdnes][~] find /sys/devices/pci0* -name product | xargs cat
54 UHCI Host Controller
55 UHCI Host Controller
56 Dell USB Keyboard
57 2003
58 UHCI Host Controller
59 Trackball
60 c404
61 EHCI Host Controller
62 UHCI Host Controller
63 UHCI Host Controller
64 UHCI Host Controller
65 EHCI Host Controller
66 Cruzer Titanium
67 Patriot Memory
68 My Book 1110
69
70
71 --
72 Walter Dnes <waltdnes@××××××××.org>
73 We are apparently better off trying to avoid udev like the plague.
74 Linus Torvalds; 2012/10/03 https://lkml.org/lkml/2012/10/3/349

Replies

Subject Author
Re: [gentoo-user] serial in /sys Jorge Almeida <jjalmeida@×××××.com>