Thread: [DIGImend-devel] huoin kernel module
Brought to you by:
spb_nick
|
From: Vince H. <Vi...@Pl...> - 2014-12-06 02:49:08
|
I tried changing the report id from 7 -> 6. Didn't work. In the if statement where you check for report->id == 7 and also the report descriptor. I added code to include the 0x7b probe. Seems to be working fine. What can I do to make some progress on this? ----------- Vince |
|
From: Nikolai K. <sp...@gm...> - 2014-12-06 21:17:41
|
Hi Vince, On 12/06/2014 04:49 AM, Vince Herried wrote: > I tried changing the report id from 7 -> 6. > Didn't work. > > In the if statement where you check for report->id == 7 > and also the report descriptor. > > > I added code to include the 0x7b probe. Seems to be working fine. > > What can I do to make some progress on this? Can you send a patch with your changes? If you can't make a patch, can you send the modified code? Thank you. Nick |
|
From: Nikolai K. <sp...@gm...> - 2014-12-13 16:42:01
|
Hi Vince,
On 12/07/2014 04:26 AM, Vince Herried wrote:
> Here is my patch containing both the attempt to change the report id to 6
> and the additional probe that I discovered.
Thanks! Although, could you please send patches uncompressed? They're not that
big, and this way they're easier to reply to. Thank you.
First of all, to make this work you'll need to add a description of the button
report to the report descriptor, under a new ID. From your description of
reports and from what I see in the kernel source (drivers/hid/hid-input.c,
hidinput_configure_usage) you'll need 24 constant bits and
then 8 input bits mapped to the button usage page codes 1-8. Both application
and physical collections of this report need to be non-general desktop to be
mapped to BTN_0-BTN_9, perhaps vendor-specific will do.
Then you'll need to change ID of button reports from 7 to the ID of the report
you added in huion_raw_report. Note that you should leave pen input reports
arriving with the same ID unmodified.
See some comments on the patch below.
> --- hid-huion.c 2014-10-28 12:01:32.000000000 -0400
> +++ /home/vince/Documents/Huion/digimend-kernel-drivers-master/hid-huion.c 2014-12-06 21:18:07.767367504 -0500
> static const __u8 huion_tablet_rdesc_template[] = {
> 0x05, 0x0D, /* Usage Page (Digitizer), */
> 0x09, 0x02, /* Usage (Pen), */
> 0xA1, 0x01, /* Collection (Application), */
> +#ifdef Report6
> + 0x85, 0x06,
> +#else
> 0x85, 0x07, /* Report ID (7), */
> +#endif
Instead of changing the ID of the pen report description, you need to add
another report description with different ID.
> 0x09, 0x20, /* Usage (Stylus), */
> 0xA0, /* Collection (Physical), */
> 0x14, /* Logical Minimum (0), */
> @@ -65,7 +80,7 @@
> 0xA4, /* Push, */
> 0x05, 0x01, /* Usage Page (Desktop), */
> 0x65, 0x13, /* Unit (Inch), */
> - 0x55, 0xFD, /* Unit Exponent (-3), */
> + 0x55, 0xFD, /* Unit Exponent (-3), 0x55,0x0d ? */
0xFD is correct. The official report descriptor tool is violating the
specification by storing unit exponent as 0x0D, although the drivers follow
suit.
> @@ -259,10 +297,14 @@
> /* If this is a pen input report */
> if (intf->cur_altsetting->desc.bInterfaceNumber == 0 &&
> report->type == HID_INPUT_REPORT &&
> - report->id == 0x07 && size >= 2)
> + report->id == 0x07 && size >= 2)
> + {
> /* Invert the in-range bit */
> data[1] ^= 0x40;
> -
> + #ifdef Report6
> + report->id = 0x06;
> + #endif
> + }
You should replace report ID for button reports only. Conversely, you should
invert the in-range bit for pen reports only.
Still, I'm not sure if replacing report ID in this way will work.
Nick
> On Sat, Dec 6, 2014 at 4:17 PM, Nikolai Kondrashov <sp...@gm... <mailto:sp...@gm...>> wrote:
>
> Hi Vince,
>
>
> On 12/06/2014 04:49 AM, Vince Herried wrote:
>
> I tried changing the report id from 7 -> 6.
> Didn't work.
>
> In the if statement where you check for report->id == 7
> and also the report descriptor.
>
>
> I added code to include the 0x7b probe. Seems to be working fine.
>
> What can I do to make some progress on this?
>
>
> Can you send a patch with your changes?
> If you can't make a patch, can you send the modified code?
>
> Thank you.
>
> Nick
>
>
|
|
From: Nikolai K. <sp...@gm...> - 2014-12-14 16:13:36
Attachments:
button_rd.xml
|
Hi Vince, I've made a quick change to digimend-kernel-drivers to make the hid-huion report buttons as BTN_0-BTN_7, on the same event device. It also made it possible to ignore other interfaces and thus remove extra event devices, which should fix problems with The GIMP. However, I'm not sure if this will allow using the tablet with xf86-input-wacom, or not. I'll try testing it. Another drawback is that the tablet frame buttons become unusable with xf86-input-evdev. The change is now available in "huion-abstract-keyboard" branch on GitHub, which you can download here: https://github.com/DIGImend/digimend-kernel-drivers/archive/huion-abstract-keyboard.zip Here is the change I did: https://github.com/DIGImend/digimend-kernel-drivers/commit/9b7d972e838b71ee805af424025ff88250b91139 I wrote the attached report descriptor XML to generate the binary descriptor addition used in the driver. Nick On 12/13/2014 07:14 PM, Vince Herried wrote: > On Sat, Dec 13, 2014 at 11:41 AM, Nikolai Kondrashov <sp...@gm...> wrote: >> Hi Vince, >> >> On 12/07/2014 04:26 AM, Vince Herried wrote: >>> >>> Here is my patch containing both the attempt to change the report id to 6 >>> and the additional probe that I discovered. >> >> >> Thanks! Although, could you please send patches uncompressed? They're not >> that >> big, and this way they're easier to reply to. Thank you. > > > Certainly. > > >> >> First of all, to make this work you'll need to add a description of the >> button >> report to the report descriptor, under a new ID. From your description of >> reports and from what I see in the kernel source (drivers/hid/hid-input.c, >> hidinput_configure_usage) you'll need 24 constant bits and >> then 8 input bits mapped to the button usage page codes 1-8. Both >> application >> and physical collections of this report need to be non-general desktop to be >> mapped to BTN_0-BTN_9, perhaps vendor-specific will do. >> >> Then you'll need to change ID of button reports from 7 to the ID of the >> report >> you added in huion_raw_report. Note that you should leave pen input reports >> arriving with the same ID unmodified. > > > yes. I understand that but I didn't know how to identify the data as > coming from a button. Or maybe more correclty > I know how to identify it by looking at the outputs of the hid dump, > but I didn't know how to write the C if statement. > Something like this to identify the data stream as a button press. > > if ( 0x07E001 == ??? ) { > blah > } > > So I was attempting to see if I this segment of code was called at the > appropriate times such that it would be possible > to change the report id. I didn't know if perhaps this segment was > only called once during the initialization of the tablet. > Since my attempt didn't work, that is what I suspected. > > If it had worked then I was going to try to create a report id of 6 > for the buttons and 7 for the stylus data. > > >> >> See some comments on the patch below. >> >>> --- hid-huion.c 2014-10-28 12:01:32.000000000 -0400 >>> +++ /home/vince/Documents/Huion/digimend-kernel-drivers-master/hid-huion.c >>> 2014-12-06 21:18:07.767367504 -0500 >>> static const __u8 huion_tablet_rdesc_template[] = { >>> 0x05, 0x0D, /* Usage Page (Digitizer), >>> */ >>> 0x09, 0x02, /* Usage (Pen), >>> */ >>> 0xA1, 0x01, /* Collection (Application), >>> */ >>> +#ifdef Report6 >>> + 0x85, 0x06, >>> +#else >>> 0x85, 0x07, /* Report ID (7), >>> */ >>> +#endif >> >> >> Instead of changing the ID of the pen report description, you need to add >> another report description with different ID. > > > Right I struggled with it a while trying to generate one. > Would this report ID be part of the existing report description? or a > totally separate one? > If you can help by saying which.. a new report description or an > embeded one I'll return to try and > build it. > > > >> >>> 0x09, 0x20, /* Usage (Stylus), >>> */ >>> 0xA0, /* Collection (Physical), >>> */ >>> 0x14, /* Logical Minimum (0), >>> */ >>> @@ -65,7 +80,7 @@ >>> 0xA4, /* Push, >>> */ >>> 0x05, 0x01, /* Usage Page (Desktop), >>> */ >>> 0x65, 0x13, /* Unit (Inch), >>> */ >>> - 0x55, 0xFD, /* Unit Exponent (-3), >>> */ >>> + 0x55, 0xFD, /* Unit Exponent (-3), 0x55,0x0d >>> ? */ >> >> >> 0xFD is correct. The official report descriptor tool is violating the >> specification by storing unit exponent as 0x0D, although the drivers follow >> suit. >> >>> @@ -259,10 +297,14 @@ >>> /* If this is a pen input report */ >>> if (intf->cur_altsetting->desc.bInterfaceNumber == 0 && >>> report->type == HID_INPUT_REPORT && >>> - report->id == 0x07 && size >= 2) >>> + report->id == 0x07 && size >= 2) >>> + { >>> /* Invert the in-range bit */ >>> data[1] ^= 0x40; >>> - >>> + #ifdef Report6 >>> + report->id = 0x06; >>> + #endif >>> + } >> >> >> You should replace report ID for button reports only. Conversely, you should >> invert the in-range bit for pen reports only. > > > OK, I didn't understand that part. Thanks. > > >> >> Still, I'm not sure if replacing report ID in this way will work. >> >> Nick >> > > > That is why I was trying to make a simple test with my changes. > Do you see any reason why my change didn't work? > > ---------------- > Vince > |