^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * HID driver for UC-Logic devices not fully compliant with HID standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * - original and fixed report descriptors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2010-2018 Nikolai Kondrashov
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2013 Martin Rusko
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * This program is free software; you can redistribute it and/or modify it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * under the terms of the GNU General Public License as published by the Free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Software Foundation; either version 2 of the License, or (at your option)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #ifndef _HID_UCLOGIC_RDESC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define _HID_UCLOGIC_RDESC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* Size of the original descriptor of WPXXXXU tablets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* Fixed WP4030U report descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern const size_t uclogic_rdesc_wp4030u_fixed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Fixed WP5540U report descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) extern const size_t uclogic_rdesc_wp5540u_fixed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* Fixed WP8060U report descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern const size_t uclogic_rdesc_wp8060u_fixed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Size of the original descriptor of the new WP5540U tablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE 232
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Size of the original descriptor of WP1062 tablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* Fixed WP1062 report descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern const size_t uclogic_rdesc_wp1062_fixed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* Size of the original descriptor of PF1209 tablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* Fixed PF1209 report descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) extern const size_t uclogic_rdesc_pf1209_fixed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /* Size of the original descriptors of TWHL850 tablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define UCLOGIC_RDESC_TWHL850_ORIG0_SIZE 182
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define UCLOGIC_RDESC_TWHL850_ORIG1_SIZE 161
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) extern const size_t uclogic_rdesc_twhl850_fixed0_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern const size_t uclogic_rdesc_twhl850_fixed1_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) extern const size_t uclogic_rdesc_twhl850_fixed2_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* Size of the original descriptors of TWHA60 tablet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE 254
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* Fixed TWHA60 report descriptor, interface 0 (stylus) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) extern const size_t uclogic_rdesc_twha60_fixed0_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) extern const size_t uclogic_rdesc_twha60_fixed1_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Report descriptor template placeholder head */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define UCLOGIC_RDESC_PH_HEAD 0xFE, 0xED, 0x1D
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Apply report descriptor parameters to a report descriptor template */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) size_t template_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) const s32 *param_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) size_t param_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* Pen report descriptor template placeholder IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) enum uclogic_rdesc_pen_ph_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) UCLOGIC_RDESC_PEN_PH_ID_X_LM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) UCLOGIC_RDESC_PEN_PH_ID_X_PM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) UCLOGIC_RDESC_PEN_PH_ID_Y_LM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) UCLOGIC_RDESC_PEN_PH_ID_Y_PM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) UCLOGIC_RDESC_PEN_PH_ID_NUM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* Report descriptor pen template placeholder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define UCLOGIC_RDESC_PEN_PH(_ID) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /* Report ID for v1 pen reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define UCLOGIC_RDESC_PEN_V1_ID 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /* Fixed report descriptor template for (tweaked) v1 pen reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) extern const __u8 uclogic_rdesc_pen_v1_template_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) extern const size_t uclogic_rdesc_pen_v1_template_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /* Report ID for v2 pen reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define UCLOGIC_RDESC_PEN_V2_ID 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Fixed report descriptor template for (tweaked) v2 pen reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) extern const __u8 uclogic_rdesc_pen_v2_template_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) extern const size_t uclogic_rdesc_pen_v2_template_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /* Fixed report descriptor for (tweaked) v1 buttonpad reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) extern const __u8 uclogic_rdesc_buttonpad_v1_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) extern const size_t uclogic_rdesc_buttonpad_v1_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /* Report ID for tweaked v1 buttonpad reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /* Fixed report descriptor for (tweaked) v2 buttonpad reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) extern const __u8 uclogic_rdesc_buttonpad_v2_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) extern const size_t uclogic_rdesc_buttonpad_v2_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /* Report ID for tweaked v2 buttonpad reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* Fixed report descriptor for Ugee EX07 buttonpad */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /* Fixed report descriptor for XP-Pen Deco 01 frame controls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern const size_t uclogic_rdesc_xppen_deco01_frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Fixed report descriptor for Ugee G5 frame controls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) extern const __u8 uclogic_rdesc_ugee_g5_frame_arr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) extern const size_t uclogic_rdesc_ugee_g5_frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /* Report ID of Ugee G5 frame control reports */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define UCLOGIC_RDESC_UGEE_G5_FRAME_ID 0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /* Device ID byte offset in Ugee G5 frame report */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /* Least-significant bit of Ugee G5 frame rotary encoder state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #define UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB 38
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #endif /* _HID_UCLOGIC_RDESC_H */