<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpotGeek.net &#187; script</title>
	<atom:link href="http://spotgeek.net/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://spotgeek.net</link>
	<description>Tecnologia , Programação , web , internet, php</description>
	<lastBuildDate>Sun, 13 May 2012 19:38:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Howto run a script when a USB device IS Pluged</title>
		<link>http://spotgeek.net/howto-run-a-script-when-a-usb-device-is-pluged/</link>
		<comments>http://spotgeek.net/howto-run-a-script-when-a-usb-device-is-pluged/#comments</comments>
		<pubDate>Tue, 12 May 2009 08:23:22 +0000</pubDate>
		<dc:creator>Filipe Teixeira</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://spotgeek.net/?p=300</guid>
		<description><![CDATA[howto run a script when]]></description>
			<content:encoded><![CDATA[<div class="smallfont"><strong>howto run a script when a USB device is pluged in</strong></div>
<hr style="color: #ffffff; background-color: #ffffff;" size="1" /><!-- / icon and title --> <!-- message --></p>
<div id="post_message_3032927" class="vbclean_msgtext">This explains how you could run a script made by you (say /usr/local/my_script) when you plug a specific USB device.</p>
<p>1. First run lsusb to identify your device. Example:<br />
$lsusb<br />
Bus 004 Device 001: ID 0000:0000<br />
Bus 003 Device 001: ID <strong>040a:0576</strong> Kodak Co.<br />
Bus 002 Device 001: ID 0000:0000<br />
Bus 001 Device 001: ID 0000:0000</p>
<p>2. After doing this you know that<br />
– the vendor ID of your device is <strong>040a</strong><br />
– the product ID of your device is <strong>0576</strong></p>
<p>3. Now is time to create your UDEV rule:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Code:</div>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr">sudo nano /etc/udev/rules.d/85-my_rule.rules</pre>
</div>
<p>4. And add the text</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Code:</div>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;" dir="ltr">ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="040a", SYSFS{idProduct}=="0576", RUN+="/usr/local/my_script"</pre>
</div>
</div>
<div id="post_message_3032927" class="vbclean_msgtext">Explanation:<br />
When the <strong>usb_device</strong> product identified as <strong>0576</strong> of vendor <strong>040a</strong> is <strong>add</strong>ed, run <strong>/usr/local/my_script</strong><br />
Note that ‘==’ and “!=” are comparators, while = and += are assingments</div>
<div class="vbclean_msgtext"></div>
<div class="vbclean_msgtext"><a href="http://ubuntuforums.org/showthread.php?t=502864" target="_blank">via : ubuntuforums</a></div>
<div class="vbclean_msgtext"></div>
]]></content:encoded>
			<wfw:commentRss>http://spotgeek.net/howto-run-a-script-when-a-usb-device-is-pluged/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

