Module device.input

An interface to get input events.

Functions

Input:disableRotationMap () Setup a rotation_map that does nothing (for platforms where the events we get are already translated).
Input:open (path, name) Wrapper for our Lua/C input module's open.
Input:fdopen (fd, path, name) Wrapper for our Lua/C input module's fdopen.
Input:close (path) Wrapper for our Lua/C input module's close.
Input:teardown () Wrapper for our Lua/C input module's closeAll.
Input:registerEventAdjustHook (hook, hook_params) Different device models can implement their own hooks and register them.
Input:adjustABS_SwitchXY (ev) Catalog of predefined hooks.
Input:handleTouchEv (ev) Parse each touch ev from kernel and build up tev.
Input:handleMiscGyroEv (ev) Accelerometer, in a platform-agnostic, custom format (EVMSC:MSCGYRO).
Input:toggleGyroEvents (toggle) Allow toggling the accelerometer at runtime.
Input:waitEvent (now, deadline) Main event handling.
Input:inhibitInputUntil (set_or_seconds) Request all input events to be ignored for some duration.

Issues

Input:adjustABS_SwitchXY-fixme3 Crappy event staggering!

The Forma & co 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...



Functions

Input:disableRotationMap ()
Setup a rotation_map that does nothing (for platforms where the events we get are already translated).
Input:open (path, name)
Wrapper for our Lua/C input module's open.

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

The name argument is optional, and used for logging purposes only.

Parameters:

  • path
  • name
Input:fdopen (fd, path, name)
Wrapper for our Lua/C input module's fdopen.

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

The name argument is optional, and used for logging purposes only. path is mandatory, though!

Parameters:

  • fd
  • path
  • name Make sure we don't open the same device twice.
Input:close (path)
Wrapper for our Lua/C input module's close.

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

Parameters:

  • path
Input:teardown ()
Wrapper for our Lua/C input module's closeAll.

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

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

Parameters:

  • hook
  • hook_params
Input:adjustABS_SwitchXY (ev)
Catalog of predefined hooks. These are not usable directly as hooks, they're just building blocks (c.f., Kobo)

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 C.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:handleMiscGyroEv (ev)
Accelerometer, in a platform-agnostic, custom format (EVMSC:MSCGYRO). (Translation should be done via registerEventAdjustHook in Device implementations). This needs to be called via handleGyroEv in a handleMiscEv implementation (c.f., Kobo, Kindle or PocketBook).

Parameters:

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

Parameters:

  • toggle
Input:waitEvent (now, deadline)
Main event handling. now corresponds to UIManager:getTime() (an fts time), and it's just been updated by UIManager. deadline (an fts time) is the absolute deadline imposed by UIManager:handleInput() (a.k.a., our main event loop ^^): it's either nil (meaning block forever waiting for input), or the earliest UIManager deadline (in most cases, that's the next scheduled task, in much less common cases, that's the earliest of UIManager.INPUTTIMEOUT (currently, only KOSync ever sets it) or UIManager.ZMQTIMEOUT if there are pending ZMQs).

Parameters:

  • now
  • deadline On the first iteration of the loop, we don't need to update now, we're following closely (a couple ms at most) behind UIManager.
Input:inhibitInputUntil (set_or_seconds)
Request all input events to be ignored for some duration.

Parameters:

  • set_or_seconds either true, in which case a platform-specific delay is chosen, or a duration in seconds (int).

Issues

Input:adjustABS_SwitchXY-fixme3
Crappy event staggering!

The Forma & co 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...

generated by LDoc 1.5.0 Last updated 2024-11-21 07:57:34