<br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 11:05 AM, Dan Nicholson <span dir="ltr">&lt;<a href="mailto:dbn.lists@gmail.com">dbn.lists@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Wed, Nov 25, 2009 at 6:43 AM, Victor Lowther<br>
&lt;<a href="mailto:victor.lowther@gmail.com">victor.lowther@gmail.com</a>&gt; wrote:<br>
&gt; On Wed, Nov 25, 2009 at 6:10 AM, Martin Pitt &lt;<a href="mailto:martin.pitt@ubuntu.com">martin.pitt@ubuntu.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hello Victor,<br>
&gt;&gt;<br>
&gt;&gt; sorry for the late response; conference and all that..<br>
&gt;&gt;<br>
&gt;&gt; Victor Lowther [2009-11-15 21:59 -0600]:<br>
&gt;&gt; &gt; And now, a version that actaully works.  With a bit of glue code, this<br>
&gt;&gt; &gt; can replace auto quirk and smart kernel driver handling in pm-utils.<br>
&gt;&gt;<br>
&gt;&gt; I just tried your script, but AFAIK it just figures out the quirks<br>
&gt;&gt; that are necessary on the _current_ system by parsing the .fdi<br>
&gt;&gt; directly, right?<br>
&gt;<br>
&gt; No, it translates the .fdi files that are currently on the system into a<br>
&gt; native format that uses bash-style extended regular expressions instead of<br>
&gt; the .fdi ad-hoc pattern matching scheme..  The translation is fairly<br>
&gt; simplistic right now (and could certainly do with being rewritten, in a<br>
&gt; language that acctually understands xml) but it only reads the .fdi files to<br>
&gt; translate them, and it only does that if they are newer than the native<br>
&gt; format files.  If there are no .fdi files, or they are older than the native<br>
&gt; ones, it just uses the native format files.<br>
&gt;<br>
&gt; Take a look at maybe_update_native(), translate_xml() and their callers in<br>
&gt; the script for more details.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; What I actually had in mind was that we should do a static conversion<br>
&gt;&gt; to produce a simple-to-parse text file map which can then be put into,<br>
&gt;&gt; and maintained within (well, it&#39;s not going to change often any more),<br>
&gt;&gt; pm-utils itself, so that we can get rid of hal/hal-info completely.<br>
&gt;&gt;<br>
&gt;&gt; Would you want to change your script accordingly, or want me to work<br>
&gt;&gt; on such a static conversion script?<br>
&gt;<br>
&gt; No need, I already do that in the current script for convienence.  Once we<br>
&gt; actually decide that this is the way forward, moving the XML translation<br>
&gt; into its own script or rewriting it in a language that actually understands<br>
&gt; XML will be pretty easy.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; I thought about having one file per vendor, such as<br>
&gt;&gt;<br>
&gt;&gt;  /usr/share/pm-utils/video-quirks/ibm<br>
&gt;<br>
&gt; I already do this.<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; and each file would have a list of (dmi property:value)* → quirks map like<br>
&gt;&gt;<br>
&gt;&gt;  product_name:.*X31;bios-version:INET17WW      s3_bios s3_mode<br>
&gt;&gt;<br>
&gt;&gt; which can then be matched against /sys/class/dmi/id/* with grep.<br>
&gt;<br>
&gt; I tried that, it is hideously expensive -- you end up having to parse each<br>
&gt; line in the file in the shell, and then run grep on the specific DMI<br>
&gt; property you are looking at with the bits you parse out, which ends up<br>
&gt; running grep several hundred times. Since bash already knows about regular<br>
&gt; expressions, I cut out the middleman, and keeping the current treeish<br>
&gt; structure makes it easier to save a little time by not comparing the bits<br>
&gt; you do not actually care about.<br>
<br>
</div></div>I think if this is really the way to go, then shell is not the right<br>
tool for the job at runtime. You could write a trivial C program to<br>
parse that out and spit out the quirks on stdout for pm-utils to use.<br>
Bash is great, but it is not the right tool for all jobs.<br></blockquote><div><br>I think bash works great for this little task. :)<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

--<br>
<font color="#888888">Dan<br>
</font></blockquote></div><br>