12 January 2005

GKOS IR packet formats

The GKOS IR remote control is a pocket sized unit with a keyboard and a pointer control. The unit is a universal personal tool to access different types of devices. It consists of  6 keys on the back and, if implemented, two mouse buttons and a pointer control stick or alike on the front panel.

The IR transmitter of the controller may send three types of data packets: GKOS chord value packets, GKOS key code packets and pointer control data packets.

If GKOS chord values are sent, it is totally up to the receiving device what to do with this data. For example, it is possible after reception to analyze the chords, decide on characters and further convert this data to match the protocols of the keyboard/mouse (PS/2) connector(s) of a PC, or to have a small (connector size) IR interface on a PDA to facilitate fast text entry.

If GKOS key codes are sent, the key scanning that detects the chords and chordons (strings of chords) and the corresponding characters must be implemented at the transmitting device. The receiving end has not much more to do than map the received key codes to characters or functions, one by one.

In addition, the GKOS IR transmitter may include a pointer control and will then send mouse data packets.

  

IR modulation, start pulse and bits

Each packet consists of a start pulse followed by 11, 21 or 29 bits using pulse width coding. Basic time period T is 550 microseconds. A pulse is a burst of IR light modulated (on/off) with a frequency of 36 kHz ('carrier frequency'). A start pulse duration is 4T (2.2ms). Information bits consist of a gap of length T followed by a pulse with length T for a logical 0 and 2T for a logical 1. The bits will then have different lengths: 1.1ms for zeros and 1.65ms for ones.
 


 

Chord value packet   (11 bits)
 

[start pulse] D0 D1 D2 D3 D4 D5 G '1' A0 A1 A2
 

D0...D5  The present chord value. It is sent repeatedly as
         long as any key is pressed and follows the state
         of the keypad in 'real time' (GKOS IR chord mode).

G        A toggle bit that changes every time a new
         non-zero chord value is sent (new character).
         *) see note 1

'1'      A bit with a value of one to indicate the packet
         type (chord value).

A0...A2  The device address to facilitate operation of 7 GKOS IR
         devices near each other. Address ranges for A2 A1 A0 are
          - 000 to 011 for key code packets (default is 011) and
          - 100 to 111 for chord value packets (default is 111).

 

This packet sends the keypad status once per 30 ms. This simple approach lets the receiving end do the further analysis and decision on possible detected chords and chord sequencies.

Transmission of chord value packets continues as long as there are any keys pressed by repeating this procedure: check keyboard status > wait 10 ms > check keyboard status > send chord value packet with the ORred value of the two checks. Any time even a single check gives a zero chord value the toggle bit must be changed for the next non-zero chord value. When all keys are released for a longer time, 32 packets with zero chord value are still sent.
 

Key code packet   (11 bits)
 

[start pulse] D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2
 

D0...D7  The key code value (1...255). It is sent only once
         per key code and represents a single character or a
         function entered on the GKOS keypad (GKOS IR byte mode).

A0...A2  The device address to facilitate operation of 7 GKOS
         IR devices near each other. Address ranges for A2 A1 A0 are
          - 000 to 011 for key code/mouse packets (default is 011),
          - 100 to 111 for chord value & mouse data packets (default 111).

Key codes are sent by a GKOS IR transmitter that is capable of scanning
the GKOS keyboard using intelligent key scanning and chordon detection.
There is at least 10 ms pause between packets. One byte of data (D0-D7)
corresponds to one character or function.


Identifying Packets

Between Key code packets or Chord value packets, Mouse data packets can
be sent. They are detected as mouse data by the fact that A2=1 and the
bit before A0 is '0':

...0/1 A0 A1 A2...
... 0  x  x  1... Mouse data packet
... 1  x  x  1    Chord value packet
...D7  x  x  0    Key code packet

Default for x x is 1 1. These bits define the device (4 adjacent pairs).
   

Mouse Data Packet  (29 or 21 bits)
 

[start pulse] D0 D1 D2 D3 D4 D5  G  '0'  A0 A1 A2 A3  Z
X0 X1 X2 X3 X4 X5 X6 X7  Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
for pointer movement data, 29 bits, or
 

[start pulse] D0 D1 D2 D3 D4 D5  G  '0'  A0 A1 A2 A3  Z
Z0 Z1 Z2 Z3 Z4 Z5 Z6 Z7
for scroll wheel data, 21 bits.
 

D0     Left/upper mouse button state (1 = pressed)
D1     Right/lower mouse button state (1 = pressed)
D2     X sign bit
D3     Y sign bit
D4     X overflow bit
D5     Y overflow bit
G      Toggle bit that changes for each new mouse report.
'0'    Indicates that this is a mouse/scroll wheel data packet (if A3=0).
A0...A2    Device address (same as in the chord value packet, A2-A0: 100-111)
A3         Special optional use:
             A3=0 (default) for all mouse/scroll wheel data packets;
             A3=1 [indicates that this is a chord packet with only three
             extra bits following A3: SHIFT, SYMB and one spare bit.
             This option can be used if the two extra keys are implemented.]
Z          Z = 0 if pointer movement data (16 bits) follows and
           Z = 1 if scroll wheel data (8 bits) follows.
X0...X7    X movement since previous report
Y0...Y7    Y movement since previous report
Z0...Z7    Scroll wheel data that is a 2's complement number representing the wheels movement since previous report. Possible values are -8 to +7 represented by bits Z0...Z3 (while bits Z4...Z7 are just spare sign extension bits, i.e. repeated sign bits). Vertical scroll increments/decrements the Z counter by one and horizontal scroll increments/decrements the Z counter by two.
 
 

If there are no scroll wheels present, the scroll wheel operation may be implemented by using the pointer control while pressing the right/lower mouse button. In this case, pressing the right mouse button is only reported when releasing the button, before the right button release report, if the pointer control has not been used before that. For better compatibilty, a third button could be used instead on the left between the two mouse buttons to activate scroll wheel functions.

*) Note 1: The toggle bit need not necessarily be detected at the reception if the IR link is used just for manual entering of characters (several IR packets for a single character). If, however, also automated character strings are sent with a new character for each IR packet, the changing of the toggle bit is necessary for indicating the next character. Else, an idle packet (all keys up) is required after each character.