So the thing is, most JB ROMs for TF101 (I think that's actually all ROMs but AOKP) use a userspace hack to invert the dock lid state before propagating it to the power management code in the framework. It is, of course, a solution, but it's rather ugly and it clutters the global framework with code that's actually needed for one or two devices in total.
So I suggest that instead of messing around with the userspace, we need to fix the bug in device specific code, i.e. the kernel. I've made a kernel patch long ago for AOKP, but now I'm experiencing problems with other kernels on unmodified userspace, so I decided to post it here and see if other developers/ROMs accept it.
There is already a framework for 'inverting' the result in the kernel, so I reused that, and that made a very simple patch. All it does is check for any switch input (a.k.a. the dock lid) and set its active_low flag to 1, which makes the kernel invert the received data. Since the code is in gpio-keys, it's very unlikely to conflict with any external devices.
The source for the patch is available on my GitHub, it should work with kernel, though I built it for AOKP kernel, which is stock .39 + bcmdhd.
So, framework hacks vs. kernel hacks, discuss.
So I suggest that instead of messing around with the userspace, we need to fix the bug in device specific code, i.e. the kernel. I've made a kernel patch long ago for AOKP, but now I'm experiencing problems with other kernels on unmodified userspace, so I decided to post it here and see if other developers/ROMs accept it.
There is already a framework for 'inverting' the result in the kernel, so I reused that, and that made a very simple patch. All it does is check for any switch input (a.k.a. the dock lid) and set its active_low flag to 1, which makes the kernel invert the received data. Since the code is in gpio-keys, it's very unlikely to conflict with any external devices.
The source for the patch is available on my GitHub, it should work with kernel, though I built it for AOKP kernel, which is stock .39 + bcmdhd.
So, framework hacks vs. kernel hacks, discuss.