Skip to contentSkip to conversation

udev_rules_init

DISCUSSION vijay manchala 2 participants 2 messages Aug 7, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I have written one udev rule in the file 10-local.rules for my driver and placed in /etc/udev/rules.d/

I reloaded the udevcontrol command and even rebooted also

But My module is not getting inserted, instead I saw error message in /var/log/messages as below

udev_rules_init: could not read '/etc/udev/rules.d/10-local.rules': No such file or directory

below is my udev rule

BUS!="usb", ACTION!="add", GOTO="test_add_end"
BUS="usb", SYSFS{idVendor}="xxxx", SYSFS{idProduct}="xxxx", ACTION="add", RUN+="/sbin/insmod /lib/modules/2.6.18-92.el5.1/kernel/drivers/usb/input/testpedal.ko" LABEL="test_add_end"

KERNEL="event*", SYSFS{idVendor}="ffff", SYSFS{idProduct}="0000", \
ACTION="add", NAME="input/%k", SYMLINK+="test_pedal", OPTIONS="remove_symlinks"

BUS!="usb", ACTION!="remove", GOTO="test_remove_end" BUS="usb", SYSFS{idVendor}="ffff", SYSFS{idProduct}="0000", \
ACTION="remove", RUN+="/sbin/rmmod testpedal"

LABEL="test_remove_end"

am not getting what exactly happening, but able read that file properless with less command

please let me know if am doing wrong.

Thanks & Regards
Kumar

#1 lore raw
Quoted 1 line · vijay manchala

I reloaded the udevcontrol command and even rebooted also

Udev picks up changes by itself, no command or resboot is needed.

Quoted 1 line

But My module is not getting inserted,

Adding a rule does not cause any event to happen which executes the rule. You have to re-trigger or re-plug the device to get the rule executed.

Quoted 2 lines

instead I saw error message in /var/log/messages as    below
udev_rules_init: could not read '/etc/udev/rules.d/10-local.rules': No such file or directory

Are you sure it's a plain and readable file?

Quoted 3 lines

below is my udev rule

BUS!="usb", ACTION!="add", GOTO="test_add_end"

The two negations need both be true to get active. That does not look like it will do what you want.

BUS is SUBSYSTEMS since long. BUS might go away at any time.

Quoted 1 line

BUS="usb", SYSFS{idVendor}="xxxx",

SYSFS is ATTRS since long, SYSFS might also go away at any time.

Quoted 2 lines

SYSFS{idProduct}="xxxx", ACTION="add", RUN+="/sbin/insmod /lib/modules/2.6.18-92.el5.1/kernel/drivers/usb/input/testpedal.ko" LABEL="test_add_end"

Modules are loaded by modprobe configuration, by supplying an alias from the module itself or a modprobe config. Doing it with udev rules seems kinda wrong.

Quoted 2 lines

KERNEL="event*", SYSFS{idVendor}="ffff", SYSFS{idProduct}="0000", \
 ACTION="add", NAME="input/%k", SYMLINK+="test_pedal", OPTIONS="remove_symlinks"

There is no such OPTION as "remove_symlinks".

Quoted 3 lines

BUS!="usb", ACTION!="remove", GOTO="test_remove_end" BUS="usb", SYSFS{idVendor}="ffff", SYSFS{idProduct}="0000", \
 ACTION="remove", RUN+="/sbin/rmmod  testpedal"

You can never match on sysfs properties with a remove event, there is no sysfs anymore at that time.

Also we usually do not remove any loaded modules ever. If you have two devices, removing one of the devices might kill the second one, this sounds pretty bad to do.

Quoted 1 line

please let me know if am doing wrong.

Well, ... :)

Good luck,
Kay