Changes

Jump to navigation Jump to search
1,317 bytes added ,  16:27, 23 March 2008
Useful info arrives!
Line 8: Line 8:  
==Write==
 
==Write==
   −
Writes are used the send commands to the driver. Most likely, this is to control keyboard LEDs. Writes are always 5 bytes in length.
+
Writes are used the send commands to the driver. This is for controlling the keyboard LEDs. Writes are always 5 bytes in length.
    
{| border="1"
 
{| border="1"
Line 34: Line 34:  
==Ioctl==
 
==Ioctl==
   −
Ioctls can be send to the driver. All parameters are ignored. This appears to be for receiving keyboard events in the reply.
+
Ioctls are used to read keyboard events. All parameters except the output buffer are ignored. The buffer should be 16 bytes in size and will be filled with the event data. Note that the ioctl will block.
    +
{| border="1"
 +
|+ Event data format
 +
|-
 +
! Offset
 +
! Length
 +
! Contents
 +
|-
 +
| 8
 +
| 1 or 2?
 +
| [[#Modifiers|Modifiers]]
 +
|-
 +
| 10
 +
| 6
 +
| [[#Key data|Pressed keys]]
 +
|}
 +
 +
===Modifiers===
 +
The modifiers are a bitmask of the following:
 +
 +
{| border="1"
 +
|+ Modifiers bits
 +
|-
 +
! Bit no.
 +
! Hex value
 +
! Description
 +
! Bit no.
 +
! Hex value
 +
! Description
 +
|-
 +
| 1
 +
| 0x01
 +
| Left control
 +
| 5
 +
| 0x10
 +
| Right control
 +
|-
 +
| 2
 +
| 0x02
 +
| Left shift
 +
| 6
 +
| 0x20
 +
| Right shift
 +
|-
 +
| 3
 +
| 0x04
 +
| Left alt / left meta
 +
| 7
 +
| 0x40
 +
| Right alt / right meta / alt gr
 +
|-
 +
| 4
 +
| 0x08
 +
| Left super / left windows key
 +
| 8
 +
| 0x80
 +
| Right super / right windows key
 +
|}
 +
 +
===Key data===
 +
 +
The key data is an array of bytes with key codes. These do not seem to match common scancodes, but are more like values in a character table (like ASCII, but not).
 +
 +
Each byte represents a pressed key. When a key is pressed, a new event will arrive with the key added to the array. Once a key is released, a new event will arrive with the key simply removed from the array.
 +
 +
The array is 6 bytes long, so no more than 6 simultaneous key presses can be detected. On top of that, most keyboards will barf on certain combinations. If an error occurs, a new event will arrive with all elements of the array set to 0x01.
    
[[Category:IOS API documentation]]
 
[[Category:IOS API documentation]]
15

edits

Navigation menu