Module device.input

An interface to get input events.

Functions

Input.open (device, is_emu_events) Wrapper for FFI input open.
Input:registerEventAdjustHook (hook, hook_params) Different device models can implement their own hooks and register them.
Input:adjustTouchSwitchXY (ev) Catalog of predefined hooks.
Input:handleTouchEv (ev) Parse each touch ev from kernel and build up tev.
Input:handleMiscEvNTX (ev) Accelerometer on the Forma, c.f., drivers/hwmon/mma8x5x.c
Input:toggleMiscEvNTX (toggle) Allow toggling the accelerometer at runtime.
Input:waitEvent (timeout_us) Main event handling.

Issues

Input:adjustTouchSwitchXY-fixme3 Crappy event staggering!

The Forma repeats every 80ms after a 400ms delay, and 500ms roughly corresponds to a flashing update, so stuff is usually in sync when you release the key. Obvious downside is that this ends up slower than just mashing the key.

A better approach would be an onKeyRelease handler that flushes the Event queue...

Input:waitEvent-todo4 return an event that can be handled


Functions

Input.open (device, is_emu_events)
Wrapper for FFI input open.

Note that we adhere to the "." syntax here for compatibility.

Parameters:

  • device
  • is_emu_events
Input:registerEventAdjustHook (hook, hook_params)
Different device models can implement their own hooks and register them.

Parameters:

  • hook
  • hook_params
Input:adjustTouchSwitchXY (ev)
Catalog of predefined hooks.

Parameters:

  • ev
Input:handleTouchEv (ev)
Parse each touch ev from kernel and build up tev. tev will be sent to GestureDetector:feedEvent

Events for a single tap motion from Linux kernel (MT protocol B):

MT_TRACK_ID: 0
MT_X: 222
MT_Y: 207
SYN REPORT
MT_TRACK_ID: -1
SYN REPORT

Notice that each line is a single event.

From kernel document: For type B devices, the kernel driver should associate a slot with each identified contact, and use that slot to propagate changes for the contact. Creation, replacement and destruction of contacts is achieved by modifying the ABSMTTRACKING_ID of the associated slot. A non-negative tracking id is interpreted as a contact, and the value -1 denotes an unused slot. A tracking id not previously present is considered new, and a tracking id no longer present is considered removed. Since only changes are propagated, the full state of each initiated contact has to reside in the receiving end. Upon receiving an MT event, one simply updates the appropriate attribute of the current slot.

Parameters:

  • ev
Input:handleMiscEvNTX (ev)
Accelerometer on the Forma, c.f., drivers/hwmon/mma8x5x.c

Parameters:

  • ev
Input:toggleMiscEvNTX (toggle)
Allow toggling the accelerometer at runtime.

Parameters:

  • toggle
Input:waitEvent (timeout_us)
Main event handling.

Parameters:

  • timeout_us

Issues

Input:adjustTouchSwitchXY-fixme3
Crappy event staggering!

The Forma repeats every 80ms after a 400ms delay, and 500ms roughly corresponds to a flashing update, so stuff is usually in sync when you release the key. Obvious downside is that this ends up slower than just mashing the key.

A better approach would be an onKeyRelease handler that flushes the Event queue...

Input:waitEvent-todo4
return an event that can be handled
generated by LDoc 1.4.6 Last updated 2020-03-29 12:40:26