2015-04-21, 02:50
EDIT: See updated documentation at http://forum.kodi.tv/showthread.php?tid=230276
The peripheral input system allows keyboards and game controllers to control Kodi, game add-ons, and button mapping utilities. The documentation is a series of procedures:
1. Scanning keyboards and joysticks

2. Mapping a button

3. Mapping a keyboard key

4. Handling joystick event
Joystick events are mapped to virtual game controller (using button map data). Controller input is then:
* sent to a game add-on, or
* converted to an action and sent to Kodi

5. Handling keyboard events
Keyboards are abstracted as joysticks with many buttons so that joystick input handlers can be re-used. Kodi input is handled elsewhere, so keyboard input is only sent to game add-ons.

The full system in all its glory

EDIT: Split thread, updated diagrams
The peripheral input system allows keyboards and game controllers to control Kodi, game add-ons, and button mapping utilities. The documentation is a series of procedures:
1. Scanning keyboards and joysticks

2. Mapping a button

3. Mapping a keyboard key

4. Handling joystick event
Joystick events are mapped to virtual game controller (using button map data). Controller input is then:
* sent to a game add-on, or
* converted to an action and sent to Kodi

5. Handling keyboard events
Keyboards are abstracted as joysticks with many buttons so that joystick input handlers can be re-used. Kodi input is handled elsewhere, so keyboard input is only sent to game add-ons.

The full system in all its glory

EDIT: Split thread, updated diagrams