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 MS_IS_TOUCHPAD, 66 MS_SET_TOUCHPAD_SETTINGS, 67 68 IIC_WRITE = B_DEVICE_OP_CODES_END + 200, 69 RESTART_SYSTEM, 70 SHUTDOWN_SYSTEM 71 }; 72 73 74 typedef struct { 75 bigtime_t timestamp; 76 uint32 keycode; 77 bool is_keydown; 78 } raw_key_info; 79 80 81 typedef struct { 82 bool num_lock; 83 bool caps_lock; 84 bool scroll_lock; 85 } led_info; 86 87 88 typedef struct { 89 int32 cookie; 90 uint32 buttons; 91 int32 xdelta; 92 int32 ydelta; 93 int32 clicks; 94 int32 modifiers; 95 bigtime_t timestamp; 96 int32 wheel_ydelta; 97 int32 wheel_xdelta; 98 } mouse_movement; 99 100 101 #define B_TIP_SWITCH 0x01 102 #define B_SECONDARY_TIP_SWITCH 0x02 103 #define B_BARREL_SWITCH 0x04 104 #define B_ERASER 0x08 105 #define B_TABLET_PICK 0x0F 106 107 108 typedef struct { 109 uint32 buttons; 110 uint32 switches; 111 float xpos; 112 float ypos; 113 bool has_contact; 114 float pressure; 115 int32 clicks; 116 bigtime_t timestamp; 117 int32 wheel_ydelta; 118 int32 wheel_xdelta; 119 float tilt_x; 120 float tilt_y; 121 } tablet_movement; 122 123 124 #define B_ONE_FINGER 0x01 125 #define B_TWO_FINGER 0x02 126 #define B_MULTI_FINGER 0x04 127 #define B_PEN 0x08 128 129 130 typedef struct { 131 uint8 buttons; 132 uint32 xPosition; 133 uint32 yPosition; 134 uint8 zPressure; 135 uint8 fingers; 136 bool gesture; 137 uint8 fingerWidth; 138 // 1 - 4 normal width 139 // 5 - 11 very wide finger or palm 140 // 12 maximum reportable width; extrem wide contact 141 } touchpad_movement; 142 143 144 #endif // _KB_MOUSE_DRIVER_H 145