162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * HID driver for UC-Logic devices not fully compliant with HID standard 462306a36Sopenharmony_ci * - original and fixed report descriptors 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (c) 2010-2018 Nikolai Kondrashov 762306a36Sopenharmony_ci * Copyright (c) 2013 Martin Rusko 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 1262306a36Sopenharmony_ci * under the terms of the GNU General Public License as published by the Free 1362306a36Sopenharmony_ci * Software Foundation; either version 2 of the License, or (at your option) 1462306a36Sopenharmony_ci * any later version. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifndef _HID_UCLOGIC_RDESC_H 1862306a36Sopenharmony_ci#define _HID_UCLOGIC_RDESC_H 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#include <linux/usb.h> 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci/* Size of the original descriptor of WPXXXXU tablets */ 2362306a36Sopenharmony_ci#define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* Fixed WP4030U report descriptor */ 2662306a36Sopenharmony_ciextern __u8 uclogic_rdesc_wp4030u_fixed_arr[]; 2762306a36Sopenharmony_ciextern const size_t uclogic_rdesc_wp4030u_fixed_size; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* Fixed WP5540U report descriptor */ 3062306a36Sopenharmony_ciextern __u8 uclogic_rdesc_wp5540u_fixed_arr[]; 3162306a36Sopenharmony_ciextern const size_t uclogic_rdesc_wp5540u_fixed_size; 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* Fixed WP8060U report descriptor */ 3462306a36Sopenharmony_ciextern __u8 uclogic_rdesc_wp8060u_fixed_arr[]; 3562306a36Sopenharmony_ciextern const size_t uclogic_rdesc_wp8060u_fixed_size; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* Size of the original descriptor of the new WP5540U tablet */ 3862306a36Sopenharmony_ci#define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE 232 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* Size of the original descriptor of WP1062 tablet */ 4162306a36Sopenharmony_ci#define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* Fixed WP1062 report descriptor */ 4462306a36Sopenharmony_ciextern __u8 uclogic_rdesc_wp1062_fixed_arr[]; 4562306a36Sopenharmony_ciextern const size_t uclogic_rdesc_wp1062_fixed_size; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* Size of the original descriptor of PF1209 tablet */ 4862306a36Sopenharmony_ci#define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* Fixed PF1209 report descriptor */ 5162306a36Sopenharmony_ciextern __u8 uclogic_rdesc_pf1209_fixed_arr[]; 5262306a36Sopenharmony_ciextern const size_t uclogic_rdesc_pf1209_fixed_size; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* Size of the original descriptors of TWHL850 tablet */ 5562306a36Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG0_SIZE 182 5662306a36Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG1_SIZE 161 5762306a36Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */ 6062306a36Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed0_arr[]; 6162306a36Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed0_size; 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */ 6462306a36Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed1_arr[]; 6562306a36Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed1_size; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */ 6862306a36Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed2_arr[]; 6962306a36Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed2_size; 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* Size of the original descriptors of TWHA60 tablet */ 7262306a36Sopenharmony_ci#define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE 254 7362306a36Sopenharmony_ci#define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 0 (stylus) */ 7662306a36Sopenharmony_ciextern __u8 uclogic_rdesc_twha60_fixed0_arr[]; 7762306a36Sopenharmony_ciextern const size_t uclogic_rdesc_twha60_fixed0_size; 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */ 8062306a36Sopenharmony_ciextern __u8 uclogic_rdesc_twha60_fixed1_arr[]; 8162306a36Sopenharmony_ciextern const size_t uclogic_rdesc_twha60_fixed1_size; 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci/* Report descriptor template placeholder head */ 8462306a36Sopenharmony_ci#define UCLOGIC_RDESC_PEN_PH_HEAD 0xFE, 0xED, 0x1D 8562306a36Sopenharmony_ci#define UCLOGIC_RDESC_FRAME_PH_BTN_HEAD 0xFE, 0xED 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* Apply report descriptor parameters to a report descriptor template */ 8862306a36Sopenharmony_ciextern __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, 8962306a36Sopenharmony_ci size_t template_size, 9062306a36Sopenharmony_ci const s32 *param_list, 9162306a36Sopenharmony_ci size_t param_num); 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/* Report descriptor template placeholder IDs */ 9462306a36Sopenharmony_cienum uclogic_rdesc_ph_id { 9562306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_ID_X_LM, 9662306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_ID_X_PM, 9762306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_ID_Y_LM, 9862306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_ID_Y_PM, 9962306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM, 10062306a36Sopenharmony_ci UCLOGIC_RDESC_FRAME_PH_ID_UM, 10162306a36Sopenharmony_ci UCLOGIC_RDESC_PH_ID_NUM 10262306a36Sopenharmony_ci}; 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci/* Report descriptor pen template placeholder */ 10562306a36Sopenharmony_ci#define UCLOGIC_RDESC_PEN_PH(_ID) \ 10662306a36Sopenharmony_ci UCLOGIC_RDESC_PEN_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci/* Report descriptor frame buttons template placeholder */ 10962306a36Sopenharmony_ci#define UCLOGIC_RDESC_FRAME_PH_BTN \ 11062306a36Sopenharmony_ci UCLOGIC_RDESC_FRAME_PH_BTN_HEAD, UCLOGIC_RDESC_FRAME_PH_ID_UM 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/* Report ID for v1 pen reports */ 11362306a36Sopenharmony_ci#define UCLOGIC_RDESC_V1_PEN_ID 0x07 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v1 pen reports */ 11662306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v1_pen_template_arr[]; 11762306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v1_pen_template_size; 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* Report ID for v2 pen reports */ 12062306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_PEN_ID 0x08 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v2 pen reports */ 12362306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v2_pen_template_arr[]; 12462306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v2_pen_template_size; 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci/* Report ID for tweaked v1 frame reports */ 12762306a36Sopenharmony_ci#define UCLOGIC_RDESC_V1_FRAME_ID 0xf7 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* Fixed report descriptor for (tweaked) v1 frame reports */ 13062306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v1_frame_arr[]; 13162306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v1_frame_size; 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci/* Report ID for tweaked v2 frame button reports */ 13462306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID 0xf7 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 frame button reports */ 13762306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v2_frame_buttons_arr[]; 13862306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v2_frame_buttons_size; 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/* Report ID for tweaked v2 frame touch ring/strip reports */ 14162306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_FRAME_TOUCH_ID 0xf8 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 frame touch ring reports */ 14462306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[]; 14562306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v2_frame_touch_ring_size; 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 frame touch strip reports */ 14862306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v2_frame_touch_strip_arr[]; 14962306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v2_frame_touch_strip_size; 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci/* Device ID byte offset in v2 frame touch ring/strip reports */ 15262306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_FRAME_TOUCH_DEV_ID_BYTE 0x4 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci/* Report ID for tweaked v2 frame dial reports */ 15562306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_FRAME_DIAL_ID 0xf9 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 frame dial reports */ 15862306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_v2_frame_dial_arr[]; 15962306a36Sopenharmony_ciextern const size_t uclogic_rdesc_v2_frame_dial_size; 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci/* Device ID byte offset in v2 frame dial reports */ 16262306a36Sopenharmony_ci#define UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE 0x4 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci/* Report ID for tweaked UGEE v2 battery reports */ 16562306a36Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_V2_BATTERY_ID 0xba 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci/* Magic data expected by UGEEv2 devices on probe */ 16862306a36Sopenharmony_ciextern const __u8 uclogic_ugee_v2_probe_arr[]; 16962306a36Sopenharmony_ciextern const size_t uclogic_ugee_v2_probe_size; 17062306a36Sopenharmony_ciextern const int uclogic_ugee_v2_probe_endpoint; 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* Fixed report descriptor template for UGEE v2 pen reports */ 17362306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_v2_pen_template_arr[]; 17462306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_v2_pen_template_size; 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* Fixed report descriptor template for UGEE v2 frame reports (buttons only) */ 17762306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[]; 17862306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci/* Fixed report descriptor template for UGEE v2 frame reports (dial) */ 18162306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[]; 18262306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci/* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ 18562306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[]; 18662306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size; 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci/* Fixed report descriptor template for UGEE v2 battery reports */ 18962306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_v2_battery_template_arr[]; 19062306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_v2_battery_template_size; 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/* Fixed report descriptor for Ugee EX07 frame */ 19362306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[]; 19462306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_ex07_frame_size; 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/* Fixed report descriptor for XP-Pen Deco 01 frame controls */ 19762306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[]; 19862306a36Sopenharmony_ciextern const size_t uclogic_rdesc_xppen_deco01_frame_size; 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci/* Fixed report descriptor for Ugee G5 frame controls */ 20162306a36Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_g5_frame_arr[]; 20262306a36Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_g5_frame_size; 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* Report ID of Ugee G5 frame control reports */ 20562306a36Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_ID 0x06 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci/* Device ID byte offset in Ugee G5 frame report */ 20862306a36Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE 0x2 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci/* Least-significant bit of Ugee G5 frame rotary encoder state */ 21162306a36Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB 38 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci#endif /* _HID_UCLOGIC_RDESC_H */ 214