public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alex Schuster <wonko@wonkology.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Udev rules for identical hard drives
Date: Thu, 2 Aug 2012 19:43:50 +0200	[thread overview]
Message-ID: <20120802194350.6a721f35@weird.wonkology.org> (raw)
In-Reply-To: <20120802165919.GA25423@waltdnes.org>

Walter Dnes writes:

>   You can get the ATTRS{serial} (i.e. serial number).  See the printer
> example at http://www.reactivated.net/writing_udev_rules.html and adapt
> to your hard drive.  Serial numbers should be unique, even amongst
> otherwise identical drives...
> 
> ======================================================================
> I power on my printer, and it is assigned device node /dev/lp0. Not
> satisfied with such a bland name, I decide to use udevinfo to aid me in
> writing a rule which will provide an alternative name:
> 
>     # udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
>       looking at device '/class/usb/lp0':
>         KERNEL=="lp0"
>         SUBSYSTEM=="usb"
>         DRIVER==""
>         ATTR{dev}=="180:0"
> 
>       looking at parent device
> '/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
>         SUBSYSTEMS=="usb"
>         ATTRS{manufacturer}=="EPSON"
>         ATTRS{product}=="USB Printer"
>         ATTRS{serial}=="L72010011070626380"
> 
> My rule becomes:
> 
>     SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380",
> SYMLINK+="epson_680"

That's exactly what I would like to have! I have a working solution, but
using UDEV would seem more adequate.

But: I cannot find a serial number for my hard drives in the output. And
shouldn't there be a file named 'serial' in /sys? I have some, but not
for my block devices, only for USB and in /sys/{bus,pci}/drivers/.

BTW, sys-fs/udev-187 does not have the 'udevinfo' command, it seems to be
'udevadm info' now. 

	Wonko


  reply	other threads:[~2012-08-02 17:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 23:34 [gentoo-user] Udev rules for identical hard drives Alex Schuster
2012-08-01 23:59 ` Canek Peláez Valdés
2012-08-02  0:01   ` Canek Peláez Valdés
2012-08-02  0:42     ` Alex Schuster
2012-08-02  0:53       ` Canek Peláez Valdés
2012-08-02  9:20         ` Alex Schuster
2012-08-02 10:38           ` Alex Schuster
2012-08-02 13:11             ` Mark Knecht
2012-08-02 15:02               ` Alex Schuster
2012-08-02 15:50                 ` Dale
2012-08-02 18:29                   ` Alex Schuster
2012-08-03  6:40                     ` Dale
2012-08-03 15:31                       ` Paul Hartman
2012-08-04  5:50                         ` Dale
2012-08-02 15:50                 ` Mark Knecht
2012-08-02 17:43                   ` Peter Humphrey
2012-08-02 18:28                     ` Mark Knecht
2012-08-02 18:47                   ` Alex Schuster
2012-08-02 16:59 ` Walter Dnes
2012-08-02 17:43   ` Alex Schuster [this message]
2012-08-02 18:57     ` Neil Bothwick
2012-08-02 18:55   ` Neil Bothwick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120802194350.6a721f35@weird.wonkology.org \
    --to=wonko@wonkology.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox