Skip to content

Commit 2f834f1

Browse files
committed
uclogic: Support touch ring reports
Support touch ring reports found in Huion HS610 to the UC-Logic driver.
1 parent 84abef8 commit 2f834f1

3 files changed

Lines changed: 104 additions & 20 deletions

File tree

hid-uclogic-params.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,22 +737,47 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
737737
goto cleanup;
738738
} else if (found) {
739739
hid_dbg(hdev, "pen v2 parameters found\n");
740-
/* Create v2 frame parameters */
740+
/* Create v2 frame button parameters */
741741
rc = uclogic_params_frame_init_with_desc(
742742
&p.frame_list[0],
743-
uclogic_rdesc_v2_frame_arr,
744-
uclogic_rdesc_v2_frame_size,
745-
UCLOGIC_RDESC_V2_FRAME_ID);
743+
uclogic_rdesc_v2_frame_buttons_arr,
744+
uclogic_rdesc_v2_frame_buttons_size,
745+
UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID);
746746
if (rc != 0) {
747747
hid_err(hdev,
748-
"failed creating v2 frame parameters: %d\n",
748+
"failed creating v2 frame button "
749+
"parameters: %d\n",
749750
rc);
750751
goto cleanup;
751752
}
752-
/* Link frame button subreports from pen reports */
753+
754+
/* Create v2 frame dial parameters */
755+
rc = uclogic_params_frame_init_with_desc(
756+
&p.frame_list[1],
757+
uclogic_rdesc_v2_frame_dial_arr,
758+
uclogic_rdesc_v2_frame_dial_size,
759+
UCLOGIC_RDESC_V2_FRAME_DIAL_ID);
760+
if (rc != 0) {
761+
hid_err(hdev,
762+
"failed creating v2 frame dial "
763+
"parameters: %d\n",
764+
rc);
765+
goto cleanup;
766+
}
767+
p.frame_list[1].suffix = "Touch Ring";
768+
p.frame_list[1].dev_id_byte =
769+
UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE;
770+
p.frame_list[1].touch_ring_byte = 5;
771+
p.frame_list[1].touch_ring_max = 12;
772+
p.frame_list[1].touch_ring_flip_at = 6;
773+
774+
/* Link button and dial subreports from pen reports */
753775
p.pen.subreport_list[0].value = 0xe0;
754776
p.pen.subreport_list[0].id =
755-
UCLOGIC_RDESC_V2_FRAME_ID;
777+
UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID;
778+
p.pen.subreport_list[1].value = 0xf0;
779+
p.pen.subreport_list[1].id =
780+
UCLOGIC_RDESC_V2_FRAME_DIAL_ID;
756781
goto output;
757782
}
758783
hid_dbg(hdev, "pen v2 parameters not found\n");

hid-uclogic-rdesc.c

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,12 @@ const size_t uclogic_rdesc_v2_pen_template_size =
652652
sizeof(uclogic_rdesc_v2_pen_template_arr);
653653

654654
/**
655-
* Expand to the contents of a generic frame report descriptor.
655+
* Expand to the contents of a generic frame buttons report descriptor.
656656
*
657657
* @_id: The report ID to use.
658658
* @_size: Size of the report to pad to, including report ID, bytes.
659659
*/
660-
#define UCLOGIC_RDESC_FRAME_BYTES(_id, _size) \
660+
#define UCLOGIC_RDESC_FRAME_BUTTONS_BYTES(_id, _size) \
661661
0x05, 0x01, /* Usage Page (Desktop), */ \
662662
0x09, 0x07, /* Usage (Keypad), */ \
663663
0xA1, 0x01, /* Collection (Application), */ \
@@ -700,17 +700,66 @@ const size_t uclogic_rdesc_v2_pen_template_size =
700700

701701
/* Fixed report descriptor for (tweaked) v1 frame reports */
702702
const __u8 uclogic_rdesc_v1_frame_arr[] = {
703-
UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_V1_FRAME_ID, 8)
703+
UCLOGIC_RDESC_FRAME_BUTTONS_BYTES(UCLOGIC_RDESC_V1_FRAME_ID, 8)
704704
};
705705
const size_t uclogic_rdesc_v1_frame_size =
706706
sizeof(uclogic_rdesc_v1_frame_arr);
707707

708-
/* Fixed report descriptor for (tweaked) v2 frame reports */
709-
const __u8 uclogic_rdesc_v2_frame_arr[] = {
710-
UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_V2_FRAME_ID, 12)
708+
/* Fixed report descriptor for (tweaked) v2 frame button reports */
709+
const __u8 uclogic_rdesc_v2_frame_buttons_arr[] = {
710+
UCLOGIC_RDESC_FRAME_BUTTONS_BYTES(UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID,
711+
12)
711712
};
712-
const size_t uclogic_rdesc_v2_frame_size =
713-
sizeof(uclogic_rdesc_v2_frame_arr);
713+
const size_t uclogic_rdesc_v2_frame_buttons_size =
714+
sizeof(uclogic_rdesc_v2_frame_buttons_arr);
715+
716+
/* Fixed report descriptor for (tweaked) v2 frame dial reports */
717+
const __u8 uclogic_rdesc_v2_frame_dial_arr[] = {
718+
0x05, 0x01, /* Usage Page (Desktop), */
719+
0x09, 0x07, /* Usage (Keypad), */
720+
0xA1, 0x01, /* Collection (Application), */
721+
0x85, UCLOGIC_RDESC_V2_FRAME_DIAL_ID,
722+
/* Report ID (DIAL_ID), */
723+
0x14, /* Logical Minimum (0), */
724+
0x05, 0x0D, /* Usage Page (Digitizer), */
725+
0x09, 0x39, /* Usage (Tablet Function Keys), */
726+
0xA0, /* Collection (Physical), */
727+
0x25, 0x01, /* Logical Maximum (1), */
728+
0x75, 0x01, /* Report Size (1), */
729+
0x05, 0x09, /* Usage Page (Button), */
730+
0x09, 0x01, /* Usage (01h), */
731+
0x95, 0x01, /* Report Count (1), */
732+
0x81, 0x02, /* Input (Variable), */
733+
0x95, 0x07, /* Report Count (7), */
734+
0x81, 0x01, /* Input (Constant), */
735+
0x75, 0x08, /* Report Size (8), */
736+
0x95, 0x02, /* Report Count (2), */
737+
0x81, 0x01, /* Input (Constant), */
738+
0x05, 0x0D, /* Usage Page (Digitizer), */
739+
0x0A, 0xFF, 0xFF, /* Usage (FFFFh), */
740+
0x26, 0xFF, 0x00, /* Logical Maximum (255), */
741+
0x95, 0x01, /* Report Count (1), */
742+
0x81, 0x02, /* Input (Variable), */
743+
0x05, 0x01, /* Usage Page (Desktop), */
744+
0x09, 0x38, /* Usage (Wheel), */
745+
0x95, 0x01, /* Report Count (1), */
746+
0x15, 0x00, /* Logical Minimum (0), */
747+
0x25, 0x0B, /* Logical Maximum (11), */
748+
0x81, 0x02, /* Input (Variable), */
749+
0x09, 0x30, /* Usage (X), */
750+
0x09, 0x31, /* Usage (Y), */
751+
0x14, /* Logical Minimum (0), */
752+
0x25, 0x01, /* Logical Maximum (1), */
753+
0x75, 0x01, /* Report Size (1), */
754+
0x95, 0x02, /* Report Count (2), */
755+
0x81, 0x02, /* Input (Variable), */
756+
0x95, 0x2E, /* Report Count (46), */
757+
0x81, 0x01, /* Input (Constant), */
758+
0xC0, /* End Collection, */
759+
0xC0 /* End Collection */
760+
};
761+
const size_t uclogic_rdesc_v2_frame_dial_size =
762+
sizeof(uclogic_rdesc_v2_frame_dial_arr);
714763

715764
/* Fixed report descriptor for Ugee EX07 frame */
716765
const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = {

hid-uclogic-rdesc.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,22 @@ extern const size_t uclogic_rdesc_v2_pen_template_size;
124124
extern const __u8 uclogic_rdesc_v1_frame_arr[];
125125
extern const size_t uclogic_rdesc_v1_frame_size;
126126

127-
/* Report ID for tweaked v2 frame reports */
128-
#define UCLOGIC_RDESC_V2_FRAME_ID 0xf7
127+
/* Report ID for tweaked v2 frame button reports */
128+
#define UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID 0xf7
129129

130-
/* Fixed report descriptor for (tweaked) v2 frame reports */
131-
extern const __u8 uclogic_rdesc_v2_frame_arr[];
132-
extern const size_t uclogic_rdesc_v2_frame_size;
130+
/* Fixed report descriptor for (tweaked) v2 frame button reports */
131+
extern const __u8 uclogic_rdesc_v2_frame_buttons_arr[];
132+
extern const size_t uclogic_rdesc_v2_frame_buttons_size;
133+
134+
/* Report ID for tweaked v2 frame dial reports */
135+
#define UCLOGIC_RDESC_V2_FRAME_DIAL_ID 0xf8
136+
137+
/* Fixed report descriptor for (tweaked) v2 frame dial reports */
138+
extern const __u8 uclogic_rdesc_v2_frame_dial_arr[];
139+
extern const size_t uclogic_rdesc_v2_frame_dial_size;
140+
141+
/* Device ID byte offset in v2 frame dial reports */
142+
#define UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE 0x4
133143

134144
/* Fixed report descriptor for Ugee EX07 frame */
135145
extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[];

0 commit comments

Comments
 (0)