Handle button presses and backlight in charging-sdl (remove triggerhappy dependency)
Created by: ollieparanoid
Discussion split from #20.
it could be something like the init script just checks cmdline and then launches charging sdl, which can handle backlight and button detection itself
Then we would have to perform everything in the C code, which isn't the way it's currently done. I have been thinking about this a bit, and I think these extras are better handled in a bash script.
The only thing we could gain as a result of handling everything in C would be some marginally better performance, making the phone more responsive when pushing the power button, but that doesn't seem to be an issue right now (I also toyed with the idea of sending some messages to the charging-sdl PID, but arrived to the same conclusion).
Yeah... I do think it would be nice to have input handling functionality though as it would kinda make it more portable
Well, I am actually not sure it would make it more portable... I haven't looked at triggerhappy yet, but it sounds like its functionality would be quite hard to replicate properly.
So, I went ahead and started to address one of the issues with C code (I'm a bit rusty -- by all meanings -- so please bear with my code) and I have noticed the following issues with doing everything in C :
- Trivial file manipulation is more complicated (which is a shame for system operations... have a look at my initial patch for writing into two different files: https://github.com/MayeulC/charging-sdl/commit/22b49563bd62f977a62f09bc95b2c9d2dcbbf196 )
- It might make testing more complicated, as we now probably have to include additional command line switches to disable backlight deactivation (the program contains more than a UI, so it is).
- The barrier to entry for new contributors is probably higher (I've seen that many people don't know C very well, though that would probably be enough for minor fixes).
However, it also has some other advantages, like the fact that it is self-contained. I would like someone else to weight on this.
SDL should provide stuff for backlight and input events so it should be pretty simple