LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Location for Custom udev Rules (https://www.linuxquestions.org/questions/slackware-14/location-for-custom-udev-rules-600783/)

Toods 11-19-2007 04:37 AM

Location for Custom udev Rules
 
I am using the lastest udev package as in 'Current' and I want to create one or two rules for my own devices, for example my digital camera.

My question is: what is the preferred name for the rule file that I should create for my rules to put in the /etc/udev/rules.d directory?.

Many thanks,

Bill.

allend 11-19-2007 04:52 AM

I would suggest /etc/udev/rules.d/90-local.rules.
You create this for yourself, and it will survive any upgrades to udev rules that you make in the future.

Toods 11-19-2007 05:16 AM

Many thanks.

Someone suggested /etc/udev/rules.d/10-local.rules as an alternative.

Is there any advantage of an 'early' or 'late' rule for something like a USB digatal camera storage device?.

Thanks,

Bill.

allend 11-19-2007 05:33 AM

I do not know. I am only passing on what rworkman and PiterPunk suggested in a thread I participated in recently.

evilDagmar 11-19-2007 07:35 AM

Later would probably be better than sooner in this case. Sooner would run the risk of tangling with an update actually setting a rule for your device that doesn't match what you've been using and possibly breaking something.

...when dealing with overlapping rules in general, you want them to be defined in order of broadest scope to narrowest scope (everywhere/everything, ix86 or ppc machines, stuff that's here, this particular machine).

swampdog2002 11-19-2007 08:05 AM

I have created a file to create symbolic links for my modem and dvd drives as /etc/udev/rules.d/10-udev.rules and seems to work fine for my purposes. I imagine that is would all depend on the types of rules that you are trying to create, or if they would conflict with and default udev rules.

Toods 11-19-2007 12:27 PM

Many thanks.

It works with either /etc/udev/rules.d/10-local.rules or /etc/udev/rules.d/90-local.rules.


Perhaps one of the above is preferable, but I don't know enough about udev to decide myself.


Bill.

rg3 11-19-2007 12:42 PM

In the first versions of udev, it read the list of rules and applied the first one that matched. This is a similar behaviour to iptables rules and other situations. In these first versions, the best strategy to create, for example, a symbolic link to a device was to find out the rule matching the device, copying it adding the symbolic links, and finally putting the rule in a file which was read before the rest of files.

However, udev later changed for practical reasons to a model in which every matching rule is applied in order, and some attributes admit the += operator to add more content. Some others only admit the = operator, and some of them may be assigned a fixed value that can't be modified later, with the := operator (see man udev). With this new model the order doesn't matter as much as before, and it can be right or wrong to put your rule before or after the system rules, depending on what you want to do. In general, I'd say it's safer to put your rules after the system rules, and add symbolic links with the += operator.


All times are GMT -5. The time now is 06:10 PM.