[gpm] RFC: new event protocol

Enrico Weigelt weigelt@metux.de
Fri Oct 9 04:01:38 CEST 2009


Hi folks,


as I already said, I'm going to make gpm a little 9P server,
which also provides some event file/stream sending the mouse
events in ascii text lines.

The protocol should not just handle mice, but quite any kind 
of positioning device (joysticks, touchpanel, gradometer, 
gps, velocitymeter, gyrometer, etc).

Here's little start for the proto spec:

* text-based pipe stream (readonly)
* one line per message, starting with msg class
* multiple mice/josticks/gyros/etc supported (ptr-id)
* protocol could be extended for keyboards later
* id's are C-alike identifiers or numbers
* message structure: <timestamp> <msg-class> <parameters...> 

Msg class: BUTTON - button pressed, etc

    BUTTON <ptr-id> <btn-id> [up|down|click] <modifier>

    * subsequent down+up (w/o intermediate movement) followed by click
      (application doesnt have to detect clicks on its own)
    
Msg class: MOVE

    MOVE <ptr-id> <axis-id> [linear|logarithmic|angle] <rel-pos> <abs-pos>

    * if the abs pos is unknown, an asterisk is sent
    * pure absolute pos.devs. calculate relpos on their own

Msg class: CONNECT

    CONNECT <ptr-id> <axis-id> [on|off]

    * only used if some axis or a whole pointer gets disconnected and
      tracked abspos might be lost
    * on "CONNECT on", an move with the assumed abs pos should be sent


Device class: Mouse

    * linear coords, positions are device/config dependent 
      (acc.factor, etc)
    * simple movement produces MOVE messages, buttons produce BUTTON messages
    * axis-ids: are X and Y, optional wheel for Z
    * CONNECT should not happen

Device class: Touchpad/Touchscreen/Lightpen (when not in mouse emulation)

    * has abs and rel coords
    * simple touch produces MOVE to the touched position
    * tapping produces MOVE and BUTTON click message
    * the first button (tapping) most likely has no up/down messages
    * additional send may produce BUTTON messages

Device class: Joystick (when not in mouse emulation)

    * has abs and rel coords (might be linear or angle)
    * MOVE messages are sent when stick position changes
    * BUTTON messages just like on mice
    
Device class: Radial field sensor (gravitometer, dradius, etc)
    
    * has 2 radial and 1 (or more) scalar cords, rel and/or abs
    * radial coords are floats in range [0..2pi]
    * multiple contacts (eg. different forces or sensed objects)
      are represented by different ptr-ids
    * contact found/lost notified via CONNECT

Device class: keyboard

    * no MOVE messages, only BUTTON (up/down/click)
    * simple keyb input just checks for BUTTON click

All these device classes (except keyboard) should be mappable to 
others , at least to some generic (mouse-alike) pointing device.


Well, should be enough for now. Comments/suggestions appreciated.


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service - http://www.metux.de/
---------------------------------------------------------------------
 Please visit the OpenSource QM Taskforce:
 	http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
	http://patches.metux.de/
---------------------------------------------------------------------


More information about the gpm mailing list