Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Udev confusion: Rules for a mp3 player
Date: Sat, 28 Jun 2014 18:05:49
Message-Id: 20140628180540.GB3918@solfire
In Reply to: Re: [gentoo-user] Udev confusion: Rules for a mp3 player by "Jc García"
1 Jc García <jyo.garcia@×××××.com> [14-06-28 19:48]:
2 > 2014-06-28 8:57 GMT-06:00 <meino.cramer@×××.de>:
3 > > Hi,
4 > >
5 > > For my mp3-player I want to write udev rules to give better names
6 > > to the according entries under /dev
7 > >
8 > > Problem is: Th eplayer has an internal flash, which only holds the firmware
9 > > (in my case) and a sd-card slot, in which you can insert a flash card
10 > > with music files.
11 > >
12 > > The internal memory has a partition directly on - say - sdb and the
13 > > sd-card in the slot is regulary formatted and represents itsself as
14 > > sdc and sdc1.
15 > >
16 > > With udevadm I determined the serial number of the device (to make it
17 > > unique) and the model ("Internal storage" and "SD card slot"), which
18 > > seems to make it easy to buit rules from.
19 > > The one and only reason for not being THAT happy is: The rules didn't work.
20 > >
21 > > Here:
22 > > http://www.reactivated.net/writing_udev_rules.html
23 > >
24 > > I read some instructions.
25 > > It is said that one should not combine elements of one device and more
26 > > than one parent.
27 > >
28 > > Is "device" meant as "the entry under /dev" or is it to be understand
29 > > as "the electric entity on my desktop (the player)".
30 > >
31 > > I want rules which also work, if another sdcard of a different size is
32 > > inserted into the player...
33 > >
34 > > How can I write rules to map the internal storage, the whole device
35 > > (aka /dev/sdc) of the sdcard (for example for reformatting reasons)
36 > > and the partition of the sdcard (aka /dev/sdc1), which work?
37 > >
38 > > To this email I have attached the gzipped outputs of the according
39 > > udevadm calls.
40 > >
41 > > Thank you very much for any help in advance!
42 > > Best regards,
43 > > mcc
44 > >
45 > > PS:
46 > > This is what I have tried and which does *NOT* work!
47 > > SUBSYSTEM=="block",ATTRS{model}=="Internal Storage",ATTRS{serial}=="1A8C518301403210B00000000",SYMLINK+="sansaclipzip_root"
48 > > SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot ",ATTR{partition}=="1", ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data_1"
49 > > SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot ",ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data"
50 > >
51 > >
52 > I'm not going to help you with your udev rules, but just point out, it
53 > seems to me you are going to a more complicated layer than you need
54 > to, if you just want personalized naming for your partitions under
55 > /dev (for using with scripts or something like that), I would suggest
56 > you to use the label feature, of the filesystems you are going to use
57 > for those blocks, this will cause udev to generate respective
58 > /dev/disk/by-label/* symlinks, altought I guess if you already know
59 > this if you are playing with udev rules.
60 >
61
62 ...this would identify the sd-cards instead of the device, so I choose
63 to udev-rules instead of labels...
64
65 Best regards,
66 mcc