maemo-leste / bugtracker

Issue tracking repository
62 stars 3 forks source link

N900: Port proximity sensor to iio #134

Open MerlijnWajer opened 6 years ago

MerlijnWajer commented 6 years ago

It is part of the gpio-keys event interface, but I have not been able to make it do anything yet (that is, produce an event)

pavelmachek commented 6 years ago

Last time I played with that, it worked for me. Example code is at

https://github.com/pavelmachek/unicsy_demo/blob/master/hacks/keyd

According to that:

event6:

Event type 1 (EV_KEY)

Event code 152 (KEY_SCREENLOCK)

Event code 212 (KEY_CAMERA)

Event code 528 (?) ... KEY_CAMERA_FOCUS

Event type 5 (EV_SW)

Event code 9 (SW_CAMERA_LENS_COVER)

Event code 10 (SW_KEYPAD_SLIDE)

Event code 11 (SW_FRONT_PROXIMITY)

...event6 device, code 11 should be proximity switch. If keypad_slide works for you, that one should work, too.

MerlijnWajer commented 6 years ago

I can't get it to fire an event for it, though:

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 152 (KEY_SCREENLOCK)
    Event code 212 (KEY_CAMERA)
    Event code 528 (KEY_CAMERA_FOCUS)
  Event type 5 (EV_SW)
    Event code 9 (SW_CAMERA_LENS_COVER) state 1
    Event code 10 (SW_KEYPAD_SLIDE) state 0
    Event code 11 (SW_FRONT_PROXIMITY) state 0
Properties:
Testing ... (interrupt to exit)
Event: time 1529313012.758919, type 5 (EV_SW), code 10 (SW_KEYPAD_SLIDE), value 1
Event: time 1529313012.758919, -------------- SYN_REPORT ------------
Event: time 1529313014.052908, type 5 (EV_SW), code 10 (SW_KEYPAD_SLIDE), value 0
Event: time 1529313014.052908, -------------- SYN_REPORT ------------
Event: time 1529313040.062914, type 5 (EV_SW), code 10 (SW_KEYPAD_SLIDE), value 1
Event: time 1529313040.062914, -------------- SYN_REPORT ------------
Event: time 1529313061.955513, type 1 (EV_KEY), code 152 (KEY_SCREENLOCK), value 1
Event: time 1529313061.955513, -------------- SYN_REPORT ------------
Event: time 1529313062.112676, type 1 (EV_KEY), code 152 (KEY_SCREENLOCK), value 0
Event: time 1529313062.112676, -------------- SYN_REPORT ------------

Might just be me being silly.

pavelmachek commented 5 years ago

Interesting. I retested on maemo-leste, and it is indeed broken.

Linux devuan-n900 4.15.7+ #1 PREEMPT Mon May 7 09:17:10 UTC 2018 armv7l GNU/Linux evtest /dev/input/by-path/platform-gpio_keys-event

pavelmachek commented 5 years ago

...I checked my kernel patches, and I don't see anything related. A this uses gpio_keys, I suspect problem would be in arch/arm/boot/dts/omap3-n900.dts . Do you have some changes against mainline there?

MerlijnWajer commented 5 years ago

Just these two: https://github.com/maemo-leste/n9xx-linux/commit/e2ffaf459deb30d28e00a7a84cd4d93e8c2874e0#diff-fb8cf9a1a0b868557516caf54f4e966b and https://github.com/maemo-leste/n9xx-linux/commit/2930ef0869da7940a41b95a3e488a51f2fb63c03#diff-fb8cf9a1a0b868557516caf54f4e966b

These should already be in mainline. We should upgrade to newer kernel than 4.15.7, maybe it's fixed since.

MerlijnWajer commented 5 years ago

I think it seems to work on my device now, using 5.0 kernel. Maybe the sensor was just dirty?

MerlijnWajer commented 3 years ago

So the sensor works in kernel, but it's not supported by iio, so we need to make that work before it will work with our mce again, see https://github.com/maemo-leste/mce/pull/17

sicelo commented 9 months ago

https://lore.kernel.org/linux-iio/ZVevR_ajeB1jfDS9@tp440p.steeds.sam/T/#u

tldr; we need to get iio-sensor-proxy to support it

freemangordon commented 9 months ago

https://lore.kernel.org/linux-iio/ZVevR_ajeB1jfDS9@tp440p.steeds.sam/T/#u

tldr; we need to get iio-sensor-proxy to support it

Umm... why? All I got from the above discussion is that n900 proximity switch best fits where it is now. I don't see a reason why not keep it there and put back proximity switch support in mce.

IMbackK commented 9 months ago

this is about adding evdev prox. to iio-sensor-proxy to allow iio-sensor-proxy to abstract away the imo extreamly stupid insitance of the kernel devs to use 2 different interfaces for the same information

sicelo commented 8 months ago

initial attempt at supporting evdev proximity sensors in iio-s-p, https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/375

sicelo commented 1 month ago

merged upstream, https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/commit/9833a28080d539ca541c9b6721fa5608fe71e335

backporting to our version of iio-sensor-proxy is possible, but not sure whether to do that, or wait until devuan upgrades to something more recent