On Android development board, I am trying to wake up the AP based on an interrupt received on a GPIO, can anybody help me with this?
My understanding on this is:
We need to create an input device and update an event to this device based on the interrupt received. Then from the application I believe OS will send an event occur notification and then we need to use the wakelock to wake up the AP.
Please let me know if my understanding is correct? If yes, then can you tell me which kind of input device needs to be registered (EV_PWR, EV_KEY ..), how the application will get a notification, and can we wake up the AP from the driver?
General input event propagation model (simplified): When an input occurs an event is generated by the kernel. The input event is read by input event handler and it is dispatched to the foreground application. Few keys are sent to some specific application instead of being sent to foreground application. For example Windows button in keyboard is sent to start menu, play / pause button is sent to media player app even if it is not in foreground.
In case of Android system_server reads events from kernel, it is passes to foreground application / view. This is done for all input events except for power key, home button etc which is handled by Android's window manager or systemui. PhoneWindowManager.java has the window manager code, it gets KEYCODE_POWER event when power key is pressed. In that case if the screen is on and no wake lock for display is held then screen is locked (by calling goToSleep in PowerManager), similarly if the screen is off then screen is turned on (by calling wakeUp in PowerManager).
isWakeKey at http://androidxref.com/5.1.0_r1/xref/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#4512 will be set to true when power button is pressed & released. The code will call wakeUp or goToSleep depending on the current screen state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With