Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 05-02-2012, 07:29 AM   #1
Registered: Feb 2009
Posts: 83

Rep: Reputation: 25
usb dongle / udev-rule


I try to create a very simple kind of usb-dongle. Just a usb stick with one special file on it.

When the usb-stick is connected to the computer there should be a script executed. The same thing if someone removes the stick.

I tried and tried, but it didn't work.

I just created a file '/etc/udev/rules.d/10-dongle.rules' with the following content:
SUBSYSTEM=="usb", KERNEL=="sd?1", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="date>>/tmp/out"
Has someone an idea?

best regards

Last edited by toredo; 05-02-2012 at 07:34 AM.
Old 05-02-2012, 11:11 AM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Two doubts.

IDK if the RUN string can do redirection. You could try writing a script that does what your existing RUN string does and give the full path to it in the RUN string. For good measure give the full path to the date command in the script -- probably not necessary but does no harm. Might be useful to make the script log the $PATH value too.

IDK if the ? wildcard in KERNEL=="sd?1" is valid.

Apart from that, assuming you used udevadm info to get the listed attributes, it looks good.
Old 05-02-2012, 04:04 PM   #3
Registered: Feb 2009
Posts: 83

Original Poster
Rep: Reputation: 25
Ok, now it works. I've got the attributes from the internet (every usb device should have a product- and vendorid), but i'll check them with udevadm.

I use now this line:
SUBSYSTEM=="usb", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="/root/"
Thx for the fast help

Best regards


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
usb detail via udev rule Kashif_Bash Programming 1 04-19-2012 02:05 PM
[SOLVED] Creating an udev rule mounting all usb drive as 666 Linux.tar.gz Linux - Hardware 20 11-23-2010 05:56 AM
Automating detection of Internet USB dongle via udev Sylvester Incognito 5 07-03-2009 10:02 PM
Can I make a udev rule for a particular usb port? kairen Slackware 3 02-15-2008 08:30 AM
Udev Rule Help Please Toods Slackware 1 11-23-2007 08:55 AM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:13 PM.

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