LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   udev rule to rename /dev/sdx as /dev/sdr does not work :-( on OS 11.2 (https://www.linuxquestions.org/questions/suse-opensuse-60/udev-rule-to-rename-dev-sdx-as-dev-sdr-does-not-work-on-os-11-2-a-866630/)

tkmbe 03-05-2011 01:47 PM

udev rule to rename /dev/sdx as /dev/sdr does not work :-( on OS 11.2
 
Hello

I'm trying to get my usb cardreader to apear as /dev/sdr instead of /dev/sdc on Opensuse 11.2
What I read about udev a rule like
Code:

UBSYSTEM=="usb", ATTRS{idVendor}=="11b0", ATTRS{idProduct}=="6108", NAME="sdr", SYMLINK="cfreader",GROUP="storage"
should work or not?
My device still appears as /dev/sdc and /dev/sdr and symlink /dev/cfreader are created BUT /dev/sdr has not same mayor/minor number as /dev/sdc and of course is not accessible.

What is wrong?

Any hints from the udev gurus?

aus9 03-06-2011 07:17 PM

hi

since no-one else has replied as yet.....your rule makes no mention of what to do with sdc ok?

I gather you have a sda and sdb?

why not create an udev rule so accept sdc but the udev rule creates a symlink from it to /dev/cfreader and no need to mention /dev/sdr

something like this assuming your ids are correct


------------------------copy between dashes-----
ACTION!="add", GOTO="cfreader_End"

SUBSYSTEMS=="usb", ACTION==”add”, ATTRS{idProduct}=="6108", GOTO="cfreader"

LABEL="cfreader"
RUN+="/bin/ln -s /dev/sdc /dev/cfreader"

LABEL="cfreader_End"

--------------------------------------

using root powers run
Code:

udevadm control --reload-rules
which is safer than rebooting as you want to see if there is any error

jimbeam 05-10-2012 01:53 AM

In case anybody wonders onto this thread, I think the OP was almost correct.
However, I think you need to add a + before the = in the SYMLINK command, and I don't think specifying the name is necessary as the device name sdr can change depending on what udev/the kernel want. You already identify the vendor and product.

So you get something like this:
Code:

SUBSYSTEM=="usb", ATTRS{idVendor}=="11b0", ATTRS{idProduct}=="6108", SYMLINK+="cfreader",GROUP="storage"
See e.g. http://manpages.ubuntu.com/manpages/...n7/udev.7.html


All times are GMT -5. The time now is 08:24 PM.