LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices

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

Rep: Reputation: 25
usb dongle / udev-rule


Hello,

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:
Code:
SUBSYSTEM=="usb", KERNEL=="sd?1", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="date>>/tmp/out"
Has someone an idea?

best regards
toredo

Last edited by toredo; 05-02-2012 at 07:34 AM.
 
Old 05-02-2012, 11:11 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,520
Blog Entries: 27

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
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
toredo
Member
 
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:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="/root/test.sh"
Thx for the fast help

Best regards
toredo
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration