...
The pages in BAR0 contain a page for Global registers, one or more pages for event data, and a final page containing a device configuration space. These three sections are described in the three sections below.
Table of Contents |
---|
Global Registers (Range 0x00000 - 0x00FFF)
...
Code Block | ||
---|---|---|
| ||
DEV_RESET 0xFFFF DEV_CONF 4 /* The config associated indicates its a stylus */ DEV_CONF 7 /* The config associated indicates its an multi-touch device */ DEV_SET 4 ABS_X 345 ABS_Y 987 BTN_TOOL_PEN 1 /* Pen is hovering over the surface*/ SYN_REPORT ABS_X 346 SYN_REPORT ABS_Y 986 SNY_REPORT ABS_X 344 ABS_Y 985 ABS_PRUSSURE 45 BTN_TOUCH 1 /* Pen touches the surface */ SYN_REPORT ABS_PRESSURE 48 SYN_REPORT ABS_X 300 ABS_PRESSURE 20 SYN_REPORT BTN_TOUCH 0 /* Pen is no longer touching surface */ ABS_X 388 SYN_REPORT ABS_Y 810 ABS_X 320 BTN_TOOL_PEN 0 /* Pen is no longer hovering over the surface */ SYN_REPORT DEV_SET 7 ABS_MT_SLOT 0 /* First finger goes down */ ABS_MT_TRACKING_ID 45 ABS_MT_POSITION_X 200 ABS_MT_POSITION_Y 300 SYN_REPORT ABS_MT_POSITION_X 210 /* Still slot 0 */ SYN_REPORT ABS_MT_POSITION_X 220 ABS_MT_POSITION_Y 302 SYN_REPORT ABS_MT_POSITION_X 225 ABS_MT SLOT 1 /* Second finger goes down */ ABS_MT_TRACKING_ID 46 ABS_MT_POSITION_X 700 ABS_MT_POSITION_Y 800 SYN_REPORT ABS_MT_SLOT 0 ABS_MT_POSITION_X 226 ABS_MT_POSITION_Y 308 ABS_MT_SLOT 1 ABS_MT_POSITION_Y 810 SYN_REPORT ABS_MT_POSITION_Y 815 /* Still on slot 1! */ ABS_MT_POSITION_X 720 SYN_REPORT ABS_MT_SLOT 0 /* first finger lifted */ ABS_MT_TRACKING_ID -1 ABS_MT_SLOT 1 ABS_MT_POSITION_X 725 SYN_REPORT ABS_MT_POSITION_Y 816 /* Still on slot 1! */ ABS_MT_POSITION_X 740 SYN_REPORT ABS_MT_TRACKING_ID -1 /* Second finger is lifted */ ABS_MT_POSITION_X 741 SYN_REPORT |
Device configuration space
After receiving a DEV_CONF event, the details of the new device can be found in this space. The configuration space consists of an array of records in the format described below. The stride of the array should be taken as XMOU_CONF_SIZE, and not a calculation of the size of the device record. Although this may be programmatically inconvenient, it allows for record expansion, without breaking compatibility.
The index into this table is the device's slot number. Not all slots are necessarily filled. Entries into this array may be added or removed in real time, as devices are added or removed to the system. The DEV events are used to indicate when the array has been updated.
This array is located on the page immediately following the event record pages. That is the say it is located at the base address + n * 0x1000, where n = 1 + number of event pages.
Device Record
Code Block | ||
---|---|---|
| ||
char name[40] // This is the name of the device, in text.
uint32 evbits // A bit mask indicating which types are used. Eg, 0xB would indicate SYN events, KEY and ABS events,
// but not REL events (Or any other type). DEV events are alawys present, and not included in this bit mask.
uint32 absbits[2] // A bit mask (64 bits) indicating which absolute codes are used. Each bit corresponds to the code number,
// so 0x3 would indicate ABS_X codes and ABS_Y codes.
uint32 relbits // A bit mask indicating which relative codes are used. (At present, this is never used)
uint32 btnbits[3] // A bit mask (96 bits) indicating which button codes are in use. This bit mask starts at code 0x100, and not 0x0 as for the other bit mask.
// A bit mask of 0xC00 would indicate the device is capable of emitting BTN_LEFT and BTN_RIGHT events |
Examples
If a device support ABS_MT_POSITION_X, then that code is ordinal 0x35.
The bitmask that repressents this is 1 << 0x35 = 0x20000000000000
If it support BTN_FORWARD, then that ordinal code is 0x115.
The bitmask that represent this is: 1 << ( 0x115 - 0x100). = 0x200000
ABS_WHEEL (not mentioned in the tables above) is 0x8, so its mask is 0x100.
ABS_GAS (also not mentioned in the tables above) is 0x9, so its mask is 0x200.
If we had ABS_WHEEL and ABS_GAS its bitmask would be 0x100 | 0x200 = 0x300.