-
Notifications
You must be signed in to change notification settings - Fork 1
/
hid-asus-mouse.h
91 lines (82 loc) · 3.52 KB
/
hid-asus-mouse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __HID_ASUS_MOUSE_H
#define __HID_ASUS_MOUSE_H
/*
* Copyright (c) 2022 Kyoken <kyoken@kyoken.ninja>
*/
/* TODO: move to hid-ids.h */
#define USB_VENDOR_ID_ASUSTEK 0x0b05
#define USB_DEVICE_ID_ASUSTEK_ROG_BUZZARD 0x1816
#define USB_DEVICE_ID_ASUSTEK_ROG_CHAKRAM_RF 0x18e5
#define USB_DEVICE_ID_ASUSTEK_ROG_CHAKRAM_USB 0x18e3
#define USB_DEVICE_ID_ASUSTEK_ROG_CHAKRAM_X_RF 0x1a1a
#define USB_DEVICE_ID_ASUSTEK_ROG_CHAKRAM_X_USB 0x1a18
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS2 0x1845
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS2_CORE 0x18dd
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS2_ORIGIN 0x1877
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS2_ORIGIN_PINK 0x18cd
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS3 0x197b
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS3_WIRELESS 0x197f
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS3_WIRELESS_AIMPOINT_RF 0x1a70
#define USB_DEVICE_ID_ASUSTEK_ROG_GLADIUS3_WIRELESS_AIMPOINT_USB 0x1a72
#define USB_DEVICE_ID_ASUSTEK_ROG_KERIS_WIRELESS_RF 0x1960
#define USB_DEVICE_ID_ASUSTEK_ROG_KERIS_WIRELESS_USB 0x195e
#define USB_DEVICE_ID_ASUSTEK_ROG_KERIS_WIRELESS_AIMPOINT_RF 0x1a68
#define USB_DEVICE_ID_ASUSTEK_ROG_KERIS_WIRELESS_AIMPOINT_USB 0x1a66
#define USB_DEVICE_ID_ASUSTEK_ROG_PUGIO 0x1846
#define USB_DEVICE_ID_ASUSTEK_ROG_PUGIO2_RF 0x1906
#define USB_DEVICE_ID_ASUSTEK_ROG_PUGIO2_USB 0x1908
#define USB_DEVICE_ID_ASUSTEK_ROG_SPATHA_RF 0x1824
#define USB_DEVICE_ID_ASUSTEK_ROG_SPATHA_USB 0x181c
#define USB_DEVICE_ID_ASUSTEK_ROG_SPATHA_X_RF 0x1879
#define USB_DEVICE_ID_ASUSTEK_ROG_SPATHA_X_USB 0x1877
#define USB_DEVICE_ID_ASUSTEK_ROG_STRIX_CARRY 0x18b4
#define USB_DEVICE_ID_ASUSTEK_ROG_STRIX_IMPACT 0x1847
#define USB_DEVICE_ID_ASUSTEK_ROG_STRIX_IMPACT2_ELECTRO_PUNK 0x1956
#define USB_DEVICE_ID_ASUSTEK_ROG_STRIX_IMPACT2_WIRELESS_RF 0x1949
#define USB_DEVICE_ID_ASUSTEK_ROG_STRIX_IMPACT2_WIRELESS_USB 0x1947
#define USB_DEVICE_ID_ASUSTEK_TUF_GAMING_M3 0x1910
/* #define ASUS_MOUSE_DEBUG 1 */
#define ASUS_MOUSE_KEYS_BITMASK_EVENT_SIZE 17
#define ASUS_MOUSE_MOUSE_WHEEL_RES 120 /* generic mouse wheel resolution */
#define ASUS_MOUSE_KP_WHEEL_RES 30 /* keypad emulated wheel resolution */
#define ASUS_MOUSE_JOYSTICK_DEADZONE 16
#define ASUS_MOUSE_DATA_KEY_STATE_BITS 32 /* size of "key_state" item in bits */
#define ASUS_MOUSE_DATA_KEY_STATE_NUM 4 /* number of "key_state" items */
struct asus_mouse_data {
struct input_dev *input;
__u32 key_state[ASUS_MOUSE_DATA_KEY_STATE_NUM];
};
struct asus_mouse_joystick {
int x;
int y;
};
#define ASUS_MOUSE_MAPPING_SIZE 98
static unsigned char asus_mouse_key_mapping[] = {
/* 00 */ 0, 0, 0, 0,
/* 04 */ KEY_A, KEY_B, KEY_C, KEY_D,
/* 08 */ KEY_E, KEY_F, KEY_G, KEY_H,
/* 0C */ KEY_I, KEY_J, KEY_K, KEY_L,
/* 0E */ KEY_M, KEY_N, KEY_O, KEY_P,
/* 14 */ KEY_Q, KEY_R, KEY_S, KEY_T,
/* 18 */ KEY_U, KEY_V, KEY_W, KEY_X,
/* 1C */ KEY_Y, KEY_Z, KEY_1, KEY_2,
/* 1E */ KEY_3, KEY_4, KEY_5, KEY_6,
/* 24 */ KEY_7, KEY_8, KEY_9, KEY_0,
/* 28 */ KEY_ENTER, KEY_ESC, KEY_BACKSPACE, KEY_TAB,
/* 2C */ KEY_SPACE, KEY_MINUS, KEY_KPPLUS, 0,
/* 2E */ 0, 0, 0, 0,
/* 34 */ 0, KEY_GRAVE, KEY_EQUAL, 0,
/* 38 */ KEY_SLASH, 0, KEY_F1, KEY_F2,
/* 3C */ KEY_F3, KEY_F4, KEY_F5, KEY_F6,
/* 3E */ KEY_F7, KEY_F8, KEY_F9, KEY_F10,
/* 44 */ KEY_F11, KEY_F12, 0, 0,
/* 48 */ 0, 0, KEY_HOME, KEY_PAGEUP,
/* 4C */ KEY_DELETE, 0, KEY_PAGEDOWN, KEY_RIGHT,
/* 4E */ KEY_LEFT, KEY_DOWN, KEY_UP, 0,
/* 54 */ 0, 0, 0, 0,
/* 58 */ 0, KEY_KP1, KEY_KP2, KEY_KP3,
/* 5C */ KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7,
/* 5E */ KEY_KP8, KEY_KP9, 0,
};
#endif