LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-10-2016, 06:47 PM   #1
utomsig
LQ Newbie
 
Registered: Feb 2011
Distribution: LUbuntu, Raspbian
Posts: 1

Rep: Reputation: 0
Udev rules triggers multiple times


Hi!
I'm trying to start a SNES emulator on my Raspberry Pi 2 when I connect my USB joystick. So I don't have to use the keyboard at all. The thing itself is not important, obviesly. I don't even use the emulator, but my girlfriend does. And more importantly, it's irritating not understanding what is happening.
So, my udev rule looks like this:
Code:
ACTION=="add", KERNELS=="1-1.4", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0079", ATTRS{idProduct}=="0011", ATTRS{product}=="USB Gamepad ", RUN+="/home/pi/bin/udevrunsnes.sh"
I have tried to put more ATTRS (30 or so) and using different parent devices. The result is more or less the same. The udev rule gets triggered several times. With the current setup, 7 times. Is udev broken on my machine or have I missed something?

Heres what I'm running (Noobs/Raspbian):
Code:
$ uname -a
Linux raspberrypi 4.1.17-v7+ #838 SMP Tue Feb 9 13:15:09 GMT 2016 armv7l GNU/Linux
I haven't used udev before and I'm not a expert at linux, but I have used it at home for some years now. Thanks!
 
Old 02-12-2016, 03:52 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Perhaps worth monitoring udev to see what events are occurring when the device is attached
Code:
udevadm monitor
Maybe the re-triggering just exposes how the device itself is behaving eg disconnecting and connecting multiple times? To expand on that - is it continuously re-triggering, or just a burst of activity when first connected?

The only workaround I can think of is to invoke a wrapper script that only runs your desired script once, and sets a flag accordingly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RKHunter ASCII text in /dev/.udev/rules.d/root.rules metrx Linux - Security 2 03-07-2014 08:37 AM
Why UDEV ignores multiple rules for the same device? arctgx Linux - Hardware 5 01-16-2013 05:47 AM
Udev Rules To Differentiate Between Multiple Identical Devices anon185 Linux - General 15 08-26-2010 09:12 AM
udev: Making rules for device with multiple virtual USB-Serial Ports damien_d Linux - Hardware 1 07-12-2009 11:28 AM
Multiple External camera flash memory card readers, udev rules best way? Old_Fogie Slackware 1 11-02-2006 06:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration