![]() |
Clean way to add/remove LED patterns to mce.ini
The idea is that I have an application and I would like to add a custom LED pattern, this means manipulating the mce.ini, adding first the pattern definition to correct section and then the pattern to the patterns to be loaded list.
I can do this in python via the ConfigParser module, but it will strip all comments when writing the modified file (which is kind of obvious and I was expecting it to happen), this is undesirable. There have been suggested patches to ConfigParser for "surgical" editing but nothing has come of them. Basically idea is to add a new mySuperCoolLedPattern at postinstall and remove it at postrm without messing up rest of the mce.ini. So I wonder what would be the cleanest way to do this (writing my own config file parser that supports only the very small subset of features required to do this? anyway there needs to be some extra logic since the LEDPatterns variable is not a proper dictionary but just semicolon separate values) |
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
So unless someone has made such a tool already it seems I will have to write one. |
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
I'll look at removing later (it requires a bit more sophistication to do it the way I would like to). |
Re: Clean way to add/remove LED patterns to mce.ini
|
Re: Clean way to add/remove LED patterns to mce.ini
There is a helper binary shipped with the LED pattern editor that can check patterns for correctness, overwrite mce.ini and restart mce. But it only supports changing existing patterns, not adding new ones (because the pattern editor doesn't need that). So the two tools have kind of orthogonal functionality.
|
Re: Clean way to add/remove LED patterns to mce.ini
u have to search forum better hehe
http://talk.maemo.org/showthread.php?t=46054 |
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
The editor is a nice idea and I was thinking of something simple along the lines as well, need to check it out at some point (for example if it would allow copying the pattern to clipboard instead of overwriting mce.ini it would be a handy tool for generating patterns to be used with my tool later). edit: pattern format correctness check I was planning on adding as well. |
Re: Clean way to add/remove LED patterns to mce.ini
Removal seems to work cleanly now too, basically only pattern sanity-checking remains and then this tool is ready.
|
Re: Clean way to add/remove LED patterns to mce.ini
Ok, the package is in extras-devel, since it's meant mainly to be used by other programs it's in system not user/system section.
|
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
|
Re: Clean way to add/remove LED patterns to mce.ini
Promoted mceledpattern to extras-testing (again; it's not in user sections so to test you need to "apt-get install mceledpattern" instead of using HAM)
As for changing from python to a compiled language, we have had some PM discussions about this with ph5 and I agree it's a good idea but right now I don't have resources. |
Re: Clean way to add/remove LED patterns to mce.ini
Sleep be damned, been reading some Vala tutorials and though my weekend is fully booked already (budo seminar) it is possible that a Vala rewrite of my tool is coming at the end of the week anyway (especially if ph5 has time to help as he suggested he might)
|
Re: Clean way to add/remove LED patterns to mce.ini
Vala rewrite WIP, I'm learning Vala as I go so this is a bit of a stub still...
|
Re: Clean way to add/remove LED patterns to mce.ini
Thanks to a little help from ph5 I managed to finish the rewrite, new version should be landing to extras testing soon.
|
Re: Clean way to add/remove LED patterns to mce.ini
So now can you expand your tool to be a more generic mce editor? I would like to do the same thing, except I'd like to add vibrator patterns.
|
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
|
Re: Clean way to add/remove LED patterns to mce.ini
Added a very ugly copy-paste solution for vibra patterns (not even tested yet), this raises the code smellines factor so high that refactoring needs to be done Real Soon Now.
|
Re: Clean way to add/remove LED patterns to mce.ini
not able to install from the site
|
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
You need to install it via dpkg (first download the deb) or via apt-get (extras-testing repo), if you don't know how to do these things then this tool is not for you. |
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
Don't have time to wait for it to land in devel repo so I could promote it, so if you want to test the latest version check the -devel repo. |
Re: Clean way to add/remove LED patterns to mce.ini
Quote:
I'll promote the 0.4.0 version to extras testing when I get back from sauna. ph5: we could probably add use of your more sophisticated pattern sanity checks but the live-test code should be a separate tool (and doing mce.ini update+mce daemon restart should probably be a small shell script first calling my tool and then if exit code is ok restart mce [this is what I intent to do on postinstall of the prog I needed this tool for...]) |
Re: Clean way to add/remove LED patterns to mce.ini
Made some packaging adjustments and promoted as 1.0.0 to extras-testing.
Edit: Made announcement thread. |
All times are GMT. The time now is 17:06. |
vBulletin® Version 3.8.8