<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Duane Strong&#039;s Blog</title>
	<atom:link href="http://duanestrong.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://duanestrong.wordpress.com</link>
	<description>Er, Um, whatever.</description>
	<lastBuildDate>Fri, 12 Nov 2010 17:24:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='duanestrong.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Duane Strong&#039;s Blog</title>
		<link>http://duanestrong.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://duanestrong.wordpress.com/osd.xml" title="Duane Strong&#039;s Blog" />
	<atom:link rel='hub' href='http://duanestrong.wordpress.com/?pushpress=hub'/>
		<item>
		<title>UDEV for the masses</title>
		<link>http://duanestrong.wordpress.com/2009/08/12/udev-for-the-masses/</link>
		<comments>http://duanestrong.wordpress.com/2009/08/12/udev-for-the-masses/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 23:16:55 +0000</pubDate>
		<dc:creator>duanestrong</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://duanestrong.wordpress.com/?p=11</guid>
		<description><![CDATA[You have to be a geek to mess with UDEV, but non geeks plug in stuff all the time that the OS does not know what to do with. It seems to me that one could create some GUI goodness to help those non-geeky people out. I&#8217;m thinking of a program that (like UDEV) would [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duanestrong.wordpress.com&amp;blog=8983426&amp;post=11&amp;subd=duanestrong&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You have to be a geek to mess with UDEV, but non geeks plug in stuff all the time that the OS does not know what to do with. It seems to me that one could create some GUI goodness to help those non-geeky people out.</p>
<p>I&#8217;m thinking of a program that (like UDEV) would monitor D-Bus events and if something is plugged in that doesn&#8217;t have a rule apply to it (not sure how to do that) it could allow a rule to be created using a GUI form.</p>
<p>I&#8217;m thinking a Ruby program using GTK+ to parse the sysfs tree for a given device and present that in some kind of form.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duanestrong.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duanestrong.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duanestrong.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duanestrong.wordpress.com&amp;blog=8983426&amp;post=11&amp;subd=duanestrong&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duanestrong.wordpress.com/2009/08/12/udev-for-the-masses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f672f812341c52c9017d86f012baf340?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duanestrong</media:title>
		</media:content>
	</item>
		<item>
		<title>Playing with UDEV</title>
		<link>http://duanestrong.wordpress.com/2009/08/12/playing-with-udev/</link>
		<comments>http://duanestrong.wordpress.com/2009/08/12/playing-with-udev/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 22:39:25 +0000</pubDate>
		<dc:creator>duanestrong</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://duanestrong.wordpress.com/?p=3</guid>
		<description><![CDATA[On a recent furniture buying trip in Hawaii I was lamenting the fact that my  Navigon GPS does not have Hawaii maps (how continental!) &#8216;cus I don&#8217;t know where furniture stores are in Hawaii. Shaved ice stands yes, furniture no. Then I received the August Linux Pro magazine and there was an article on GPS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duanestrong.wordpress.com&amp;blog=8983426&amp;post=3&amp;subd=duanestrong&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On a recent furniture buying trip in Hawaii I was lamenting the fact that my  Navigon GPS does not have Hawaii maps (how continental!) &#8216;cus I don&#8217;t know where furniture stores are in Hawaii. Shaved ice stands yes, furniture no. Then I received the August Linux Pro magazine and there was an article on GPS tools for linux. I thought it might be cool to put one of these tools on my Dell netbook running Ubuntu and use that as my GPS. This means I have to plug in my Delorme USB GPS and deal with an unknown USB device. This is where UDEV comes in.</p>
<p>The first thing you need to know about UDEV (like fight club) is that nobody ever talks about UDEV. At least the things you will find on the web are not talking about the current state of UDEV, and so they are mostly all wrong. This one <a title="this one" href="http://reactivated.net/writing_udev_rules.html">http://reactivated.net/writing_udev_rules.html</a> is good. Using man udev is good too.</p>
<p>What is UDEV? It is a user space program that trys to solve the issues with hot-plug devices and the creation of /dev device nodes. This has been a problem for linux and unix-es in general in that static device nodes in the file system and major/minor device numbers were an idea created in a time before hot plug. The 2.6 kernel with sysfs and the udev program work together to make these dynamic. In general the kernel is responsible for seeing devices on the various busses come and go, and it reports all that it knows about them in the pseudo file system sysfs, and then executes a user program who&#8217;s path has been set in a procfs variable.  Udev is usually this program, and picks up where the kernel leaves off, creating device nodes and starting up necessary daemons.  This splits the responsibility so that policy issues such as device node naming and locations are not hard coded inside the kernel.</p>
<p>The way UDEV creates a device node (or does anything) is through a set of rule files. These files are kept in /etc/udev/rules.d and like init.d it uses the file system sort order when processing these rules so you name your rule file starting with a number such that you can control the order of rule application. A rule file contains one or more rules, each rule consisting of EXACTLY one line of text. On this line of text you write a series of key value pairs separated by commas to control UDEV behavior. The keys come in two flavors, match and assignment. Match keys are used to constrain your rule to only apply to what you want it to, and assignment keys are used to cause something to happen when your rule matches. When matching a rule, all of your match keys must match, and the match key values can use shell style regex symbols.</p>
<p>The most useful match keys are:</p>
<p><em>KERNEL==&#8221;value</em>&#8221; where value is the kernel name of the device like KERNEL==&#8221;tty[0-9]*&#8221;</p>
<p><em>SUBSYSTEM==&#8221;value&#8221; </em>where value is the kernel subsystem name the device is on like SUBSYSTEM==&#8221;scsi&#8221;</p>
<p><em>ATTR{sysfs name}==&#8221;value&#8221;</em> where sysfs name is a file name of an entry in the sysfs file system, and value is the contents of that file like ATTRS{product}==&#8221;DeLorme USB Earthmate&#8221;</p>
<p>The most useful assignment keys are:</p>
<p><em>NAME=&#8221;node name&#8221;</em> where node name is the file name to create the device node with like NAME=&#8221;hwrng&#8221;</p>
<p><em>SYMLINK=&#8221;link name&#8221;</em> where link name will be a symbolic link to the device node like SYMLINK+=&#8221;earthmate-gps&#8221;</p>
<p><em>OWNER=&#8221;user&#8221;, GROUP=&#8221;group&#8221;, MODE=&#8221;octal mode&#8221;</em> where user, group, and mode are used to set the device node permissions</p>
<p><em>RUN=&#8221;daemon path&#8221;</em> where daemon path is a path to an executable to run</p>
<p>It is imortant to note that all the rules that match will cause the assignment keys to evaluate, so you can write partial rules that match a subsection of devices followed by specific rules to match a specific device. In these cases you can use the operator += rather than = to accumulate values to keys.</p>
<p>So for example my Delorme Earthmate GPS rule became:</p>
<p>#earthmate gps<br />
ATTRS{product}==&#8221;DeLorme USB Earthmate&#8221;, MODE==&#8221;664&#8243;, SYMLINK+=&#8221;earthmate-gps&#8221;, RUN==&#8221;/usr/sbin/gpsd/dev/earthmate-gps&#8221;</p>
<p>This creates a symlink to the device node that UDEV  creates called earthmate-gps in the /dev directory, sets the permissions of the device node so that others can read it, and executes the daemon gpsd passing the device node symlink as an argument.</p>
<p>I put that line into the file /etc/udev/rules.d/10-local.rules. How did I figure out what to say in the rule? The first place to look is in your system log when you plug in a new device. It will dump out a bunch of information and you can decide what you want to match on. The other thing you can do is to take a look in the sysfs for the device to see all of its info, or use udevinfo to dump out the sysfs info like this for example: <em>udevinfo -a -p /devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/ttyUSB0/tty/ttyUSB0</em></p>
<p>Another useful utility is udevtest, this will show what UDEV would do with your rule without actually doing it. udevinfo and udevtest are actually simlinks to the udevadm utilty (it checks argv[0] to know what sub command to run ala busybox) so man udevadm will tell you how to work those.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duanestrong.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duanestrong.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duanestrong.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duanestrong.wordpress.com&amp;blog=8983426&amp;post=3&amp;subd=duanestrong&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duanestrong.wordpress.com/2009/08/12/playing-with-udev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f672f812341c52c9017d86f012baf340?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duanestrong</media:title>
		</media:content>
	</item>
	</channel>
</rss>
