1 /* 2 * Copyright 2002-2010, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KEYBOARD_MOUSE_DRIVER_H 6 #define _KEYBOARD_MOUSE_DRIVER_H 7 8 9 #include <SupportDefs.h> 10 #include <Drivers.h> 11 12 13 #define KEY_Scroll 0x0f 14 #define KEY_Pause 0x10 15 #define KEY_Num 0x22 16 #define KEY_CapsLock 0x3b 17 #define KEY_ShiftL 0x4b 18 #define KEY_ShiftR 0x56 19 #define KEY_ControlL 0x5c 20 #define KEY_CmdL 0x5d 21 #define KEY_AltL 0x5d 22 #define KEY_CmdR 0x5f 23 #define KEY_AltR 0x5f 24 #define KEY_ControlR 0x60 25 #define KEY_OptL 0x66 26 #define KEY_WinL 0x66 27 #define KEY_OptR 0x67 28 #define KEY_WinR 0x67 29 #define KEY_Menu 0x68 30 #define KEY_NumEqual 0x6a 31 #define KEY_Power 0x6b 32 #define KEY_SysRq 0x7e 33 #define KEY_Break 0x7f 34 #define KEY_Spacebar 0x5e 35 36 #define KB_DEFAULT_CONTROL_ALT_DEL_TIMEOUT 4000000 37 38 enum { 39 KB_READ = B_DEVICE_OP_CODES_END, 40 KB_GET_KEYBOARD_ID, 41 KB_SET_LEDS, 42 KB_SET_KEY_REPEATING, 43 KB_SET_KEY_NONREPEATING, 44 KB_SET_KEY_REPEAT_RATE, 45 KB_GET_KEY_REPEAT_RATE, 46 KB_SET_KEY_REPEAT_DELAY, 47 KB_GET_KEY_REPEAT_DELAY, 48 KB_SET_CONTROL_ALT_DEL_TIMEOUT, 49 KB_RESERVED_1, 50 KB_CANCEL_CONTROL_ALT_DEL, 51 KB_DELAY_CONTROL_ALT_DEL, 52 KB_SET_DEBUG_READER, 53 54 MS_READ = B_DEVICE_OP_CODES_END + 100, 55 MS_NUM_EVENTS, 56 MS_GET_ACCEL, 57 MS_SET_ACCEL, 58 MS_GET_TYPE, 59 MS_SET_TYPE, 60 MS_GET_MAP, 61 MS_SET_MAP, 62 MS_GET_CLICKSPEED, 63 MS_SET_CLICKSPEED, 64 MS_NUM_SERIAL_MICE, 65 66 MS_IS_TOUCHPAD, 67 MS_READ_TOUCHPAD, 68 69 IIC_WRITE = B_DEVICE_OP_CODES_END + 200, 70 RESTART_SYSTEM, 71 SHUTDOWN_SYSTEM 72 }; 73 74 75 typedef struct { 76 bigtime_t timestamp; 77 uint32 keycode; 78 bool is_keydown; 79 } raw_key_info; 80 81 82 typedef struct { 83 bool num_lock; 84 bool caps_lock; 85 bool scroll_lock; 86 } led_info; 87 88 89 typedef struct { 90 int32 cookie; 91 uint32 buttons; 92 int32 xdelta; 93 int32 ydelta; 94 int32 clicks; 95 int32 modifiers; 96 bigtime_t timestamp; 97 int32 wheel_ydelta; 98 int32 wheel_xdelta; 99 } mouse_movement; 100 101 102 #define B_TIP_SWITCH 0x01 103 #define B_SECONDARY_TIP_SWITCH 0x02 104 #define B_BARREL_SWITCH 0x04 105 #define B_ERASER 0x08 106 #define B_TABLET_PICK 0x0F 107 108 109 typedef struct { 110 uint32 buttons; 111 uint32 switches; 112 float xpos; 113 float ypos; 114 bool has_contact; 115 float pressure; 116 int32 clicks; 117 bigtime_t timestamp; 118 int32 wheel_ydelta; 119 int32 wheel_xdelta; 120 float tilt_x; 121 float tilt_y; 122 } tablet_movement; 123 124 125 #define B_ONE_FINGER 0x01 126 #define B_TWO_FINGER 0x02 127 #define B_MULTI_FINGER 0x04 128 #define B_PEN 0x08 129 130 131 typedef struct { 132 uint16 edgeMotionWidth; 133 134 uint16 width; 135 uint16 areaStartX; 136 uint16 areaEndX; 137 uint16 areaStartY; 138 uint16 areaEndY; 139 140 uint16 minPressure; 141 // the value you reach when you hammer really hard on the touchpad 142 uint16 realMaxPressure; 143 uint16 maxPressure; 144 } touchpad_specs; 145 146 147 typedef struct { 148 uint8 buttons; 149 uint32 xPosition; 150 uint32 yPosition; 151 uint8 zPressure; 152 uint8 fingers; 153 bool gesture; 154 uint8 fingerWidth; 155 int32 wheel_ydelta; 156 int32 wheel_xdelta; 157 int32 wheel_zdelta; 158 int32 wheel_wdelta; 159 // 1 - 4 normal width 160 // 5 - 11 very wide finger or palm 161 // 12 maximum reportable width; extreme wide contact 162 } touchpad_movement; 163 164 165 typedef struct { 166 bigtime_t timeout; 167 int32 event; 168 union { 169 touchpad_movement touchpad; 170 mouse_movement mouse; 171 } u; 172 } touchpad_read; 173 174 175 #endif // _KB_MOUSE_DRIVER_H 176