me176c-dev / android_device_asus_K013

Android device configuration for ASUS MeMO Pad 7 (ME176C(X))
https://forum.xda-developers.com/memo-pad-7/orig-development/rom-unofficial-lineageos-16-0-asus-memo-t3929600
Other
26 stars 5 forks source link

Add hall sensor support #30

Closed jerbmega closed 7 years ago

jerbmega commented 7 years ago

I have a folding case with a magnet in the front of the cover. In the stock ROM the magnet triggers sleep mode, but that is not the case on Lineage.

This means the functionality should be broken on the first party MagSmart Covers as well.

lambdadroid commented 7 years ago

I have a similar case and I sometimes used that functionality on the ASUS system. However, at least with my case it was always a bit unstable (it went to sleep too quickly) so I had it disabled most of the time.

This is probably something ASUS-specific so I'd need to port the driver from the old kernel but I might try it when I have time (I think LineageOS has an app called FlipFlap which might be helpful for the Android implementation part).

lambdadroid commented 7 years ago

I just checked the kernel source and the implementation looks rather simple (just a single file with ~200 lines) so it should be quite easy to port that over to the new kernel. The actual difficulty might be to integrate it into FlipFlap because there is no standardized interface for these things.

lambdadroid commented 7 years ago

Never mind, now checked the Android side and it seems like the base is already in AOSP. Should be easy to integrate though I'd like to clean up the driver a bit because the code is messy (like the whole kernel from ASUS).

lambdadroid commented 7 years ago

Thanks for the suggestion! I decided to implement a custom driver instead of copying the crappy ASUS driver (85 vs 235 lines for the same thing): https://github.com/me176c-dev/kernel_asus_me176c/commit/4a65424645f20efe9b2ca7980d146725451f7add

I should push the necessary device configuration changes in a few seconds.....