Adding new gpio key event in Oreo 8.1

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding new gpio key event in Oreo 8.1

Gopinath Sathasivam
I am new to android,I want to create an one gpio event and expose that to the application layer.
Can any help to add custom key event or provide the steps ?
Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding new gpio key event in Oreo 8.1

Satish Patel


On Mon, Jun 25, 2018 at 8:19 PM, Gopinath Sathasivam <[hidden email]> wrote:
I am new to android,I want to create an one gpio event and expose that to the application layer.
Can any help to add custom key event or provide the steps ?
Thanks in advance.

​The good starting point is -

- make sure your key is getting detected using getevent
- first try to map the key using exiting key code e.g. VOL_UP/DOWN etc. inside the device/<>/.kl file
- Once its works fine, add the new key code inside  - frameworks/native/include/android/keycodes.h
 
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
satish patel

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding new gpio key event in Oreo 8.1

Gopinath Sathasivam
Thanks for your support.
Getevent -l lists event for newly added key with linux code but it's not mapping the android scan code name like "VOLUMEUP".

I have added in device/<>/gpio-key.kl file and native layer.

For understanding I have commented volume key mapping in device/<>/gpio-keys.kl  file and framework/native  , if I try getevent-l for volume key ,still "VOLUMEUP" label is mapped with key event.

Do we need to add in any other place to map linux code to android scan code ?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding new gpio key event in Oreo 8.1

Satish Patel

On Thu, Jun 28, 2018 at 4:13 PM, Gopinath Sathasivam <[hidden email]> wrote:
Thanks for your support.
Getevent -l lists event for newly added key with linux code but it's not mapping the android scan code name like "VOLUMEUP".

I have added in device/<>/gpio-key.kl file and native layer.

For understanding I have commented volume key mapping in device/<>/gpio-keys.kl  file and framework/native  , if I try getevent-l for volume key ,still "VOLUMEUP" label is mapped with key event.

​what is the output of getevent when you press the gpio key ?
its VOLUME_UP (not VOLUMEUP)

refere 
for more details​

Do we need to add in any other place to map linux code to android scan code ?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
satish patel

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding new gpio key event in Oreo 8.1

Gopinath Sathasivam
It was typo mistake.actual output for volume key event is "KEY_VOLUME_UP".

But I am wondering how it's possible to get android scan code name  "KEY_VOLUME_UP" for event,even after commenting in device/<>/.kl file , linux/input.h and frameworks/native/.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding new gpio key event in Oreo 8.1

Satish Patel


On Thu, Jun 28, 2018 at 10:59 PM, Gopinath Sathasivam <[hidden email]> wrote:
It was typo mistake.actual output for volume key event is "KEY_VOLUME_UP".

But I am wondering how it's possible to get android scan code name  "KEY_VOLUME_UP" for event,even after commenting in device/<>/.kl file , linux/input.h and frameworks/native/.
​I am not sure if I am able to get the context in right way, but if you are looking on how keycode are mapped even thought no entry in kl file. Android does make use of Generic.kl file to map this - in case device.kl file is missing and events are coming. In android context its not KEY_ --> its KEYCODE_
 

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
satish patel

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.