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