You are not logged in.

#1 2019-02-08 08:00:38

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

[SOLVED] udev rule not executing

My goal is to do different things, whenever a usb device is plugged in. I found out the kernel-path to my usb-stick when i plug it in which is

/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/block/sda

I can now run

udevadm info -a -p /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/block/sda

which gives me a lot of useful stuff that i won't post here, unless it's necessary (please tell me, if it is!). I wrote a simple udev rule:

tim@x1carbon ~> cat /etc/udev/rules.d/10-rule.rules
 SUBSYSTEMS=="usb",ACTION=="add", ATTRS{ID_SERIAL}=="SanDisk_Ultra_Fit_4C530123260812112220", RUN+="/usr/bin/touch /home/tim/test.txt"⏎
tim@x1carbon ~>

And ran

udevadm control -R

to reload udev. When i now test with

udevadm test /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/host0/target0:0:0/0:0:0:0/block/sda

My rule shows up, but when i plug in my device, nothing happens. Can someone help me out?

Last edited by Tim.Hilt (2019-02-12 21:57:37)

Offline

#2 2019-02-10 16:00:08

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: [SOLVED] udev rule not executing

Post the output of the 'udevadm info' command.

You can monitor udev with 'udevadm monitor' in another console, to see what happens when you plug the device in.

Post also the output of the 'udevadm test' command.

Offline

#3 2019-02-10 16:34:49

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] udev rule not executing

Are you plugging it into the same USB port?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2019-02-12 21:57:12

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

Re: [SOLVED] udev rule not executing

I think that it had something to do with how cluttered my system was. I did a clean install and now everything works as it should. Marking as solved.

Offline

Board footer

Powered by FluxBB