Skip to content

Huion Kamvas 16 Gen 3 cannot exceed 16-bit X coordinates #917

@higginsdragon

Description

@higginsdragon
  • Device name: Huion Kamvas 16 (Gen 3)

  • Device model identifier: GS1563

  • libwacom version: master branch

  • I understand that libwacom does not affect whether the device works (see Troubleshooting)

Bug description

I am not sure if this is something in libwacom, seems like it might be more of a udev-hid-bpf issue, just trying to track it down, and would be more than happy to file a bug there as long as I knew what I was looking for specifically. Might even be deeper than that.

I commented on this briefly in #881, but since it's not directly related to the Kavmas 13 opened this issue for better tracking.

The problem seems to be that udev-hid-bpf may not handle horizontal scale beyond 16-bits. The size of the Kamvas 16 is 69920. I wrote a .c testing file for the Kamvas 16 in udev-hid-bpf (master branch) and after compiling most everything works fine, the buttons, dials, etc. The stylus works too, with this one problem.

From hid-reporter:

E: 000001.294037 14 08 80 23 fe e0 12 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65137 | Y:   4841 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.298038 14 08 80 71 fe e9 12 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65215 | Y:   4850 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.301037 14 08 80 bf fe f2 12 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65294 | Y:   4859 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.306018 14 08 80 0e ff fb 12 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65373 | Y:   4867 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.309049 14 08 80 5d ff 03 13 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65451 | Y:   4875 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.313035 14 08 80 ab ff 0b 13 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:  65527 | Y:   4883 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.317036 14 08 80 f7 ff 13 13 00 00 00 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:     67 | Y:   4891 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.321026 14 08 80 43 00 1b 13 00 00 01 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:    142 | Y:   4899 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 
E: 000001.324034 14 08 80 8e 00 23 13 00 00 01 00 0a 0b 03 00
# ReportID: 8 / Tip Switch: 0 | Barrel Switch: 0 | Secondary Barrel Switch: 0  0 | # | In Range: 1 | X:    217 | Y:   4907 | Tip Pressure:      0 | # | X Tilt:   10 | Y Tilt:   11 

From the magic bytes I got from huion-switcher:

* 	HUION_FIRMWARE_ID="HUION_M22d_241101"
 * 	HUION_MAGIC_BYTES="1403201101ac9900ff3fd81305080080083c4010"
 *
 * 	MAGIC BYTES
 * 	          [LogicalMaximum, X   ] [LogicalMaximum, Y   ] [LogicalMaximum, Pressure] [  LPI]
 * 	    14 03 [            20 11 01] [            ac 99 00] [                   ff 3f] [d8 13] 05 08 00 80 08 3c 40 10

The LogicalMaximum is actually a 24-bit value, though in the other files it's referenced as a 16-bit value. In this case, it all checks out.

LogicalMaximum is 69920 which when divided by the LPI (5080 LPI == 200 lines/mm) is 349.6mm which matches the Kamvas 16 specs at 350mm width.

Just changing the values in udev-hid-bpf from LogicalMaximum_i16 to LogicalMaximum_i32 results in the hid-reporter output above. As I suspected, it's rolling over at 65535.

I am looking for the place to fix this, not sure if it's in libwacom, udev-hid-bpf, or even lower than that at the udev or kernel level?

Or maybe I'm missing something obvious, which is also a high possibility. Just looking to be pointed in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    not libwacomUsed to label a bug in the rest of the stack

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions