public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Udev confusion: Rules for a mp3 player
@ 2014-06-28 14:57 meino.cramer
  2014-06-28 17:43 ` Jc García
  0 siblings, 1 reply; 3+ messages in thread
From: meino.cramer @ 2014-06-28 14:57 UTC (permalink / raw
  To: Gentoo

[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]

Hi,

For my mp3-player I want to write udev rules to give better names
to the according entries under /dev

Problem is: Th eplayer has an internal flash, which only holds the firmware
(in my case) and a sd-card slot, in which you can insert a flash card
with music files.

The internal memory has a partition directly on - say - sdb and the
sd-card in the slot is regulary formatted and represents itsself as
sdc and sdc1.

With udevadm I determined the serial number of the device (to make it
unique) and the model ("Internal storage" and "SD card slot"), which
seems to make it easy to buit rules from.
The one and only reason for not being THAT happy is: The rules didn't work.

Here:
http://www.reactivated.net/writing_udev_rules.html

I read some instructions.
It is said that one should not combine elements of one device and more
than one parent.

Is "device" meant as "the entry under /dev" or is it to be understand
as "the electric entity on my desktop (the player)".

I want rules which also work, if another sdcard of a different size is
inserted into the player...

How can I write rules to map the internal storage, the whole device
(aka /dev/sdc) of the sdcard (for example for reformatting reasons)
and the partition of the sdcard (aka /dev/sdc1), which work?

To this email I have attached the gzipped outputs of the according
udevadm calls.

Thank you very much for any help in advance!
Best regards,
mcc

PS:
This is what I have tried and which does *NOT* work!
SUBSYSTEM=="block",ATTRS{model}=="Internal Storage",ATTRS{serial}=="1A8C518301403210B00000000",SYMLINK+="sansaclipzip_root"
SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTR{partition}=="1", ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data_1"
SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data"



[-- Attachment #2: sansadatadevice.txt.gz --]
[-- Type: application/x-gunzip, Size: 1457 bytes --]

[-- Attachment #3: sansadatapartition.txt.gz --]
[-- Type: application/x-gunzip, Size: 1531 bytes --]

[-- Attachment #4: sansainternal.txt.gz --]
[-- Type: application/x-gunzip, Size: 1447 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Udev confusion: Rules for a mp3 player
  2014-06-28 14:57 [gentoo-user] Udev confusion: Rules for a mp3 player meino.cramer
@ 2014-06-28 17:43 ` Jc García
  2014-06-28 18:05   ` meino.cramer
  0 siblings, 1 reply; 3+ messages in thread
From: Jc García @ 2014-06-28 17:43 UTC (permalink / raw
  To: gentoo-user

2014-06-28 8:57 GMT-06:00  <meino.cramer@gmx.de>:
> Hi,
>
> For my mp3-player I want to write udev rules to give better names
> to the according entries under /dev
>
> Problem is: Th eplayer has an internal flash, which only holds the firmware
> (in my case) and a sd-card slot, in which you can insert a flash card
> with music files.
>
> The internal memory has a partition directly on - say - sdb and the
> sd-card in the slot is regulary formatted and represents itsself as
> sdc and sdc1.
>
> With udevadm I determined the serial number of the device (to make it
> unique) and the model ("Internal storage" and "SD card slot"), which
> seems to make it easy to buit rules from.
> The one and only reason for not being THAT happy is: The rules didn't work.
>
> Here:
> http://www.reactivated.net/writing_udev_rules.html
>
> I read some instructions.
> It is said that one should not combine elements of one device and more
> than one parent.
>
> Is "device" meant as "the entry under /dev" or is it to be understand
> as "the electric entity on my desktop (the player)".
>
> I want rules which also work, if another sdcard of a different size is
> inserted into the player...
>
> How can I write rules to map the internal storage, the whole device
> (aka /dev/sdc) of the sdcard (for example for reformatting reasons)
> and the partition of the sdcard (aka /dev/sdc1), which work?
>
> To this email I have attached the gzipped outputs of the according
> udevadm calls.
>
> Thank you very much for any help in advance!
> Best regards,
> mcc
>
> PS:
> This is what I have tried and which does *NOT* work!
> SUBSYSTEM=="block",ATTRS{model}=="Internal Storage",ATTRS{serial}=="1A8C518301403210B00000000",SYMLINK+="sansaclipzip_root"
> SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTR{partition}=="1", ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data_1"
> SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data"
>
>
I'm not going to help you with your udev rules, but just point out, it
seems to me you are going to a more complicated layer than you need
to, if you just want personalized naming for your partitions under
/dev (for using with scripts or something like that), I would suggest
you to use the label feature, of the filesystems you are going to use
for those blocks, this will cause udev to generate respective
/dev/disk/by-label/* symlinks, altought I guess if you already know
this if you are playing with udev rules.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Udev confusion: Rules for a mp3 player
  2014-06-28 17:43 ` Jc García
@ 2014-06-28 18:05   ` meino.cramer
  0 siblings, 0 replies; 3+ messages in thread
From: meino.cramer @ 2014-06-28 18:05 UTC (permalink / raw
  To: gentoo-user

Jc García <jyo.garcia@gmail.com> [14-06-28 19:48]:
> 2014-06-28 8:57 GMT-06:00  <meino.cramer@gmx.de>:
> > Hi,
> >
> > For my mp3-player I want to write udev rules to give better names
> > to the according entries under /dev
> >
> > Problem is: Th eplayer has an internal flash, which only holds the firmware
> > (in my case) and a sd-card slot, in which you can insert a flash card
> > with music files.
> >
> > The internal memory has a partition directly on - say - sdb and the
> > sd-card in the slot is regulary formatted and represents itsself as
> > sdc and sdc1.
> >
> > With udevadm I determined the serial number of the device (to make it
> > unique) and the model ("Internal storage" and "SD card slot"), which
> > seems to make it easy to buit rules from.
> > The one and only reason for not being THAT happy is: The rules didn't work.
> >
> > Here:
> > http://www.reactivated.net/writing_udev_rules.html
> >
> > I read some instructions.
> > It is said that one should not combine elements of one device and more
> > than one parent.
> >
> > Is "device" meant as "the entry under /dev" or is it to be understand
> > as "the electric entity on my desktop (the player)".
> >
> > I want rules which also work, if another sdcard of a different size is
> > inserted into the player...
> >
> > How can I write rules to map the internal storage, the whole device
> > (aka /dev/sdc) of the sdcard (for example for reformatting reasons)
> > and the partition of the sdcard (aka /dev/sdc1), which work?
> >
> > To this email I have attached the gzipped outputs of the according
> > udevadm calls.
> >
> > Thank you very much for any help in advance!
> > Best regards,
> > mcc
> >
> > PS:
> > This is what I have tried and which does *NOT* work!
> > SUBSYSTEM=="block",ATTRS{model}=="Internal Storage",ATTRS{serial}=="1A8C518301403210B00000000",SYMLINK+="sansaclipzip_root"
> > SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTR{partition}=="1", ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data_1"
> > SUBSYSTEM=="block",ATTRS{model}=="SD Card Slot    ",ATTRS{serial}=="1A8C518301403210B00000000", SYMLINK+="sansaclipzip_data"
> >
> >
> I'm not going to help you with your udev rules, but just point out, it
> seems to me you are going to a more complicated layer than you need
> to, if you just want personalized naming for your partitions under
> /dev (for using with scripts or something like that), I would suggest
> you to use the label feature, of the filesystems you are going to use
> for those blocks, this will cause udev to generate respective
> /dev/disk/by-label/* symlinks, altought I guess if you already know
> this if you are playing with udev rules.
> 

...this would identify the sd-cards instead of the device, so I choose
to udev-rules instead of labels...

Best regards,
mcc





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-28 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-28 14:57 [gentoo-user] Udev confusion: Rules for a mp3 player meino.cramer
2014-06-28 17:43 ` Jc García
2014-06-28 18:05   ` meino.cramer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox