6UL Express power mode control

Dear colleagues,

I’m working with 6UL express module. There is possibility to manage system by pressing power key input which works perfectly as described in documentation here: https://www.digi.com/resources/documentation/digidocs/90002286/#reference/bsp/v4-9_6ul/r_mca_power_key_input_6ul.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto|System%2520development|Linux%2520kernel|Linux%2520%2520v4.9%2520Board%2520Support%2520Package|Devices%2520and%2520interfaces|Micro%2520Controller%2520Assist%2520(MCA)|_____5

In my application I would like to get some notification when system goes to sleep (suspend) or wakes up. I couldn’t find any tools or events that provide such a notification.

Could you please advise what tools, programs can I use to get notified when systems goes to suspend mode or wakes up?

Thanks and best regards,
Gennady Zubkov

on cc6ul the mca/linux is currently:
o when a short press is done in the power button, it is calling mca_pwrkey_sleep_irq_handler() in drivers/input/misc/pwrkey-mca.c
The implementation that Digi does here signals the KEY_SLEEP press so the system goes to sleep.
o when a long press is done in the power button, it is calling mca_pwrkey_power_off_irq_handler() in drivers/input/misc/pwrkey-mca.c
The implementation that Digi does here signals the KEY_POWER press so the system goes to power-off.

So it looks like you should be able to implement some logic in mca_pwrkey_power_off_irq_handler() in drivers/input/misc/pwrkey-mca-cc6ul.c to do what you want
https://github.com/digi-embedded/linux/blob/v4.9/dey-2.6/maint/drivers/input/misc/pwrkey-mca-cc6ul.c

Hi Leonid,

thank you for your response. Could you please provide some more details, what should I do in order to fix this?

Is this correct that I have to rebuilt a new yocto image with new driver functionality as you mentioned? Is this possible at all to build this pwrkey-mca-cc6ul driver separately and load it afterwards?

Is there any possibility to obtain the information about KEY_SLEPP and KEY_POWER events from user space application?

Thanks, and best regards,
Gennady Zubkov