Android keyreset driver upstreaming

Registered by John Stultz

Follows the usptreaming efforts for the Android keyreset.c driver

Blueprint information

John Stultz
Series goal:
Accepted for kernel-merge-window
Good progress
Milestone target:
milestone icon 3.11
Started by
John Stultz

Related branches



Roadmap id: CARD-207
Headline: Android keyreset driver upstreamed
   * Code implementing key reset functionality is accepted into upstream kernel
   * with Sign-off from Google engineering (specifically Arve Hjønnevåg)
   * Since this code requires human interaction for testing, it will not be tested in LAVA; however, engineering will validate that the modified keyreset driver works on the latest Google Nexus phone.

Answer from Dmity Torokhov on initial patch submission:

This sounds a lot like SYSRQ handler, but with configurable key sequence.
Why don't you extend drivers/tty/sysrq.c instead?

Initial key reset capabilities will be part of 3.9. Remaining items for full coverage of original code functionality:
   * Add multiple key combo, currently only one is supported.
   * Allow for any type of function to be called when a valid key combo is detected.

Before work start on the above a consensus needs to be reached between Linaro, the input subsystem maintainer and Google.

[jstultz] Mathieu: You might also take a look at the keychord driver (something I've overlooked previously, but may have some funcitonal overlap here). See the patch here:;a=commitdiff;h=9cc8899de3cf51d04bca3bd324400a561a335dd6

The keychord driver allows userspace to be notified of key press sequences by reading/polling "/dev/keychord". I'll send Arve an email to see what he wants to do with it. If it should be upstreamed I'll open a new blueprint.

[jstultz] Timeout functionality landed in 3.10:

[jakub-pavelek 20013-02-26] Moving from 3.9 (part of work got there) to 3.11

[mpoirier 2013-05-25] Exchanged email with Arve on keyreset/sysrq. Arve won't use the __weak interface even if it has the same implications as a platform_data and the sysfs interface is too late in the boot process. Spinning off a new userspace (with specific key combo) for each supported platform was also deemed cumbersome.

[mpoirier 2013-05-31] More emails with Arve and this time he makes a very compelling case for a platform_data over a __weak symbol. If they are using the same kernel on different devices a platform_data will offer the flexibility to have different key combos while a __weak symbol won't.

[mpoirier 2013-06-03] Sent new proposal to Arve. The sysrq driver is already using 'register_sysrq_key()' to add new sysrq functions on top of the default ones - I really don't see why we couldn't do the same for key combo and timeouts. That would cover the case of using the same kernel on multiple device and avoid the need to spin-off a new user space just to change the key combo on a specific device. This idea was abandoned to favour the DT approach (Jul 10th).

[mpoirier 2013-07-10] Agreed on exact specification to biding at Connect with Grant. Grant gave public feedback. Next step is to push a v3 of the patch. This can be done if the internet can finally start working. Worse case scenario is a patch in the week of Jul 15th.


Work Items

Work items for 12.06:
Locate keyreset code, identify author and look for upstream submission (June 12): DONE
Contact author to know their plans with regards to upstreaming (June 12): DONE
Rebase keyreset code on top of linus/master (June 13): DONE
Get general understanding of what the driver does: DONE
Look for obvious flaw/errors in the code: DONE
Send patches upstream (June 19): DONE
Got feedback from upstream (June 25): DONE

Work items for 12.07:
Get familiar with SYSRQ driver (Jul 17th): DONE
Breathe life in keyreset driver with platform data (Jul 17th): DONE

Work items for 12.08:
Experiment with keyreset driver: DONE
Add platform_data to SYSRQ driver (Aug 3rd): DONE
Connect platform_data with internal sysRQ structure (Aug 6th): DONE
Keyreset driver functionality implemented in SYSRQ driver (Aug 10th): DONE
Send patch for initial review within the team (Aug 10th): DONE
Send initial RFC for broad audience review (Aug 16th): DONE
Send official patch with corrections (Aug 27th): DONE
Send version 2 of the path with corrections (Aug 30th): DONE

Work items for 12.09:
Implement module interface as per sub-system maintainer's request (Sept 7th): DONE
Sent new patch with module interface to mailing list (Sept 16): DONE
Sent RESEND patch to mailing list (Sept 24th): DONE
Sent patch to Andrew Morton (Oct 5th): DONE

Work items for 12.10:
Sent new RFC to mailing list after Arve's latest comment (Oct 20th): DONE
Settle on using platform data or __weak symbol in driver based on feedback: DONE

Work items for 12.11:
Implement and send __weak symbol implementation to mailing list (Nov 11th): DONE
Received new implementation fron Dmitry - found bug in his code (Nov 25th): DONE

Work items for 13.01:
Fix bug in Dmitry's version (Jan 06): DONE
Send counter proposal to Dmitry's code (Jan 06): DONE
Ping'eg maintainer after no feedback was given to Jan 06's submission (Jan 15): DONE
Got feedback from maintainer (Jan 16): DONE
Reviewed maintainer's version of the patch - found a possible flaw (Jan 16): DONE
Communicated with maintanier detailing the flaw and scenario to reproduce (Jan 16): DONE
Version of the latest patch was queued for 3.9, even with potential flaw (Jan 16): DONE

Work items for 13.02:
Reach out to Arve to work out what critical funcitonality is still missing from work queued for 3.9 (Feb 2nd): DONE
Portions of the work merged in 3.9 as of (;a=commit;h=154b7a489a5b1d808323b933b04864958c2f1056 ): DONE

Work items for 13.03:
Research how timer functionality Arve would like could be implemented: DONE
Added timer functionality and sent patch upstream for review (Mar 11th): DONE
Reworked patch based on comments and sent V2 for review (Mar 16th): DONE

Work items for 13.04:
Address Arve's comments: DONE
Get timer functionality queued for 3.10 (Apr 2nd): DONE
Added filesystem sync before rebooting the system - patch sent upstream for review (Apr 5th): DONE
Got reply from maintainer, sent another email asking for clarification (Apr 16th): DONE
Sent another email to maintainer explaining my position and still asking for an answer (Apr 23rd): DONE
Get graceful reboot patch queued for 3.11 (Apr 24th): DONE
Sync-up with Arve to see if he really wants a better way to configure the feature (Apr 24rd): DONE
Timer functionality was merged in 3.10-rc1 (April 30th): DONE

Work items for 13.06:
Study actual bindings to see how sysrq key combo and timeout values can be introduced as generically as possible (Jun 10th): DONE
Working on binding definition with Grant before sending to the list (Jul 10th): DONE
Send patch that will introduce DT capabilities to the sysrq driver: TODO
Get android team endorsement of the feature: TODO

Work items for backlog:
Received confirmation from Dmirty that sync feature would be in 3.11 (Jun 6th): DONE
Watch for sync functionality to land in 3.11: TODO

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.