renaming files in /dev/ *solved*

Kernels, Network, and Services configuration
Post Reply
Message
Author
schmidtbag
Posts: 246
Joined: 2010-04-14 20:51
Location: MA
Contact:

renaming files in /dev/ *solved*

#1 Post by schmidtbag »

I have a TV/radio tuner and I installed the gkrellm-radio plugin. The plugin works fine, but, it only works with /dev/radio. I'm not sure if its safe to rename files so I just create a symlink of /dev/radio0 as /dev/radio.

It gets pretty annoying to me to have to create a symlink every time I start up my computer so I can listen to the radio. Is there a way to get linux to permanently name "/dev/radio0" as "/dev/radio"?
Last edited by schmidtbag on 2010-09-16 18:59, edited 1 time in total.

peter_irich
Posts: 1366
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 4 times

Re: renaming files in /dev/

#2 Post by peter_irich »

In udev rule like SYMLINK+="radio".
It can be added in the appropriate rule or can by written the new rule with it
and with the smaller number than common rule.

Peter.

schmidtbag
Posts: 246
Joined: 2010-04-14 20:51
Location: MA
Contact:

Re: renaming files in /dev/

#3 Post by schmidtbag »

i'm not too familiar with editing udev. I found the line:

Code: Select all

echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' \
    > $udevroot/root-link-rule
so would I change it to:

Code: Select all

echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root", SYMLINK+="radio"' \
    > $udevroot/root-link-rule
then just restart? I'm not really sure I understand how this works, since i'm not actually specifying that "radio" is a symlink of "radio0"

logan
Posts: 269
Joined: 2008-03-29 18:09

Re: renaming files in /dev/

#4 Post by logan »

I'm not sure what that rule is, but I don't think you want to change it...

I put my custom rules in /etc/udev/rules.d/z99_local.rules. I don't know enough to help you write one for your radio, but you should be able to get some unique information to help you write one by doing a udevadm info -a -n /dev/radio0.

Here's some rules I have for misc devices:

Code: Select all

SUBSYSTEM=="block", KERNEL=="sr?", SYMLINK+="dvd"
SUBSYSTEMS=="usb", ATTRS{product}=="iPod", KERNEL=="sd?2", SYMLINK="ipod"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="PNY*", KERNEL=="sd?1", SYMLINK="flash"
SUBSYSTEMS=="scsi", ATTRS{model}=="Sansa Fuze 8GB*", KERNELS=="*:0:0:0", KERNEL=="sd?", SYMLINK="fuze"
SUBSYSTEMS=="scsi", ATTRS{model}=="Sansa Fuze 8GB*", KERNELS=="*:0:0:1", KERNEL=="sd?1", SYMLINK="fuze-sd"
KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth0"
You may be able to do one with:

Code: Select all

KERNEL=="radio0", SYMLINK+="radio"
Once you've got a rule written up, run udevadm trigger to test (you don't need to reboot).

schmidtbag
Posts: 246
Joined: 2010-04-14 20:51
Location: MA
Contact:

Re: renaming files in /dev/ *solved*

#5 Post by schmidtbag »

logan wrote:I'm not sure what that rule is, but I don't think you want to change it...

I put my custom rules in /etc/udev/rules.d/z99_local.rules. I don't know enough to help you write one for your radio, but you should be able to get some unique information to help you write one by doing a udevadm info -a -n /dev/radio0.

Here's some rules I have for misc devices:

Code: Select all

SUBSYSTEM=="block", KERNEL=="sr?", SYMLINK+="dvd"
SUBSYSTEMS=="usb", ATTRS{product}=="iPod", KERNEL=="sd?2", SYMLINK="ipod"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="PNY*", KERNEL=="sd?1", SYMLINK="flash"
SUBSYSTEMS=="scsi", ATTRS{model}=="Sansa Fuze 8GB*", KERNELS=="*:0:0:0", KERNEL=="sd?", SYMLINK="fuze"
SUBSYSTEMS=="scsi", ATTRS{model}=="Sansa Fuze 8GB*", KERNELS=="*:0:0:1", KERNEL=="sd?1", SYMLINK="fuze-sd"
KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth0"
You may be able to do one with:

Code: Select all

KERNEL=="radio0", SYMLINK+="radio"
Once you've got a rule written up, run udevadm trigger to test (you don't need to reboot).

nice! that worked! btw, i used the following:
KERNEL=="radio0", SUBSYSTEM=="video4linux", SYMLINK+="radio"
i'm sure it'd work without subsystem but i figured it wouldn't hurt to add that.

Thanks a lot, now I just gotta figure out how to make gkrellm not turn on my radio automatically when I log in.

Post Reply