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 typedef struct { 102 uint32 buttons; 103 float xpos; 104 float ypos; 105 bool has_contact; 106 float pressure; 107 int32 clicks; 108 bool eraser; 109 bigtime_t timestamp; 110 int32 wheel_ydelta; 111 int32 wheel_xdelta; 112 float tilt_x; 113 float tilt_y; 114 } tablet_movement; 115 116 117 #define B_ONE_FINGER 0x01 118 #define B_TWO_FINGER 0x02 119 #define B_MULTI_FINGER 0x04 120 #define B_PEN 0x08 121 122 123 typedef struct { 124 uint8 buttons; 125 uint32 xPosition; 126 uint32 yPosition; 127 uint8 zPressure; 128 uint8 fingers; 129 bool gesture; 130 uint8 fingerWidth; 131 // 1 - 4 normal width 132 // 5 - 11 very wide finger or palm 133 // 12 maximum reportable width; extrem wide contact 134 } touchpad_movement; 135 136 137 #endif // _KB_MOUSE_DRIVER_H 138