On Thu, Nov 29, 2012 at 6:35 PM, Marco Bonfiglio <marco.bonfig...@gmail.com> wrote: > > > 2012/11/29 Jorge Almeida <jjalme...@gmail.com> >> >> Anyone knows how to dig into /sys to find the serial number of a device >> (say, >> a USB pen)? I few days ago I found by trial and error something like >> $ cat >> /sys/devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4:1.0/host13/target13:0:0/13:0:0:0/block/sdc/../../../../../serial >> which gave me E68911000519 >> Now I can't find nothing of the sort. (Yes, I know the path changes >> each time the >> device is plugged in, but even so) >> Any information that would put some order into this mess would be great. >> >> TIA >> >> Joreg Almeida >> > > If by "serial" you mean UUID I personally use "ls -l /dev/disk/by-uuid/" > It is not the same thing, but anyway I have in /dev/disk/by-id/ a symlink usb-silicon_-power_E68911000519-0:0 -> ../../sdd
This is indeed the device I meant, and the serial number is the "E68911000519" substring. But this symlink exists because udev created it. I need to somehow dig it out of /sys, not out of /dev. IOW, how did udev retrieved the information to create the symlink? The values of ../by-uuid/ would probably be equally good, but I don't know how to find them any more than I know how to find the serials... Thanks J.A.