Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Udev confusion: Rules for a mp3 player meino.cramer@×××.de