Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gaomon M106K Support #609

Closed
TacticalCode opened this issue Dec 3, 2023 · 4 comments
Closed

Add Gaomon M106K Support #609

TacticalCode opened this issue Dec 3, 2023 · 4 comments

Comments

@TacticalCode
Copy link

Hello,

I'm using a Gaomon M106K pad, which is recognized as Gaomon S620 due to identical hardware IDs.

The M106K is a "clone" of the Huion New 1060 Plus (see https://digimend.github.io/tablets/). The Gaomon M106K is already in wacom-hid-descriptors: https://github.com/linuxwacom/wacom-hid-descriptors/tree/master/Gaomon%20M106K
I've copied over the S620 data + Huion layout files to /etc/libwacom and modified the DeviceMatch and Buttons, now my pad is recognized correctly and I can configure all buttons in gnome settings.

My question is: Can we add support for the M106K without regression for the S620 support?

dmesg when I plug in the pad via USB:

usb 1-2: new full-speed USB device number 4 using xhci_hcd
usb 1-2: New USB device found, idVendor=256c, idProduct=006d, bcdDevice= 1.00
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product: Gaomon Tablet
usb 1-2: Manufacturer: GAOMON
hid-generic 0003:256C:006D.0006: hiddev96,hidraw1: USB HID v1.11 Device [GAOMON Gaomon Tablet] on usb-0000:00:14.0-2/input0
input: GAOMON Gaomon Tablet Stylus as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:256C:006D.0007/input/input27
input: GAOMON Gaomon Tablet Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:256C:006D.0007/input/input28
hid-generic 0003:256C:006D.0007: input,hidraw2: USB HID v1.11 Keyboard [GAOMON Gaomon Tablet] on usb-0000:00:14.0-2/input1
input: GAOMON Gaomon Tablet Pen as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:256C:006D.0006/input/input29
input: GAOMON Gaomon Tablet Pad as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:256C:006D.0006/input/input30
input: GAOMON Gaomon Tablet Touch Strip as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:256C:006D.0006/input/input31
input: GAOMON Gaomon Tablet Dial as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:256C:006D.0006/input/input32
uclogic 0003:256C:006D.0006: input,hidraw1: USB HID v1.11 Keypad [GAOMON Gaomon Tablet] on usb-0000:00:14.0-2/input0
input: GAOMON Gaomon Tablet Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/0003:256C:006D.0007/input/input34
uclogic 0003:256C:006D.0007: input,hidraw2: USB HID v1.11 Keyboard [GAOMON Gaomon Tablet] on usb-0000:00:14.0-2/input1

lsusb -tv

/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 002: Dev 005, If 0, Class=Human Interface Device, Driver=usbhid, 12M
	ID 256c:006d [unknown] [unknown]
    |__ Port 002: Dev 005, If 1, Class=Human Interface Device, Driver=usbhid, 12M
	ID 256c:006d [unknown] [unknown]

My custom gaomon-m106k.tablet definition (layout SVG is just a copy of huion-new-1060-plus.svg):

[Device]
Name=GAOMON M106K
ModelName=
DeviceMatch=usb:256c:006d:GAOMON Gaomon Tablet Pen;usb:256c:006d:GAOMON Gaomon Tablet Pad;
Class=Bamboo
Width=10
Height=6
Layout=gaomon-m106k.svg
IntegratedIn=
Styli=@generic-no-eraser;

[Features]
Stylus=true
Reversible=true
Buttons=12

[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;K;L
EvdevCodes=0x100;0x101;0x102;0x103;0x104;0x105;0x106;0x107;0x108;0x109;0x130;0x131

Original DeviceMatch from the S620 model:

DeviceMatch=usb:256c:006d:GAOMON Gaomon Tablet Pen;usb:256c:006d:GAOMON Gaomon Tablet Pad;

libwacom-list-local-devices with my custom M106K.tablet:

(libwacom-list-local-devices:100627): libwacom-CRITICAL **: 11:35:15.436: file ../libwacom/libwacom.c: line 1005 (libwacom_set_default_match): should not be reached
/dev/input/event23 is a tablet but not supported by libwacom
/dev/input/event22 is a tablet but not supported by libwacom
devices:
- name: 'GAOMON M106K'
  bus: 'usb'
  vid: '0x256c'
  pid: '0x006d'
  nodes: 
  - /dev/input/event21: 'GAOMON Gaomon Tablet Pad'
- name: 'GAOMON M106K'
  bus: 'usb'
  vid: '0x256c'
  pid: '0x006d'
  nodes: 
  - /dev/input/event20: 'GAOMON Gaomon Tablet Pen'

When I include the "Dial" and "Touch Strip" devices in the DeviceMatch rule, libwacom-list-local-devices lists those too, but gnome settings displays 3x Pads + 1x Pen.

I suppose my M106K config would cause all S620 devices the be recognized as M106K because of the identical hardware IDs... Is there any way in libwacom to differentiate between the S620 and M106K models?
If that's not possible, can we ship the M106K definition anyway, so users can at least copy over the existing file to /etc to override the S620 definition?

@whot
Copy link
Member

whot commented Dec 4, 2023

The "best" solution here is to drop the S620 file and update to the M106K instead. This will make any S620 show up as M106K but it's better to expose buttons that don't exist than to limit the number of buttons. We've done this in the past with some other devices though don't ask me which one :)

Mind you, that only pushes the problem out by a bit, sooner or later those vendors will have the great idea of shipping backwards incompatible changes with the same ID. They do work under windows I'd expect which means there's something on the device level that tells the host which specific model is connected, we need to get this exported into userspace. Let's see what #610 amounts to over the next few days.

JoseExposito added a commit to JoseExposito/digimend-kernel-drivers that referenced this issue Dec 9, 2023
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names.

This patch exposes the firmware version name via sysfs attribute.

[1] linuxwacom/libwacom#609
Link: linuxwacom/libwacom#610
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to JoseExposito/digimend-kernel-drivers that referenced this issue Mar 21, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name via sysfs attribute.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to JoseExposito/digimend-kernel-drivers that referenced this issue Mar 21, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name via sysfs attribute.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to JoseExposito/linux that referenced this issue Mar 21, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name via sysfs attribute.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 21, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name via sysfs attribute.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to JoseExposito/digimend-kernel-drivers that referenced this issue Mar 22, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Mar 22, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
jonhunter pushed a commit to jonhunter/linux that referenced this issue Apr 4, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
JoseExposito added a commit to JoseExposito/linux that referenced this issue Apr 13, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to JoseExposito/digimend-kernel-drivers that referenced this issue Apr 13, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
JoseExposito added a commit to DIGImend/digimend-kernel-drivers that referenced this issue Apr 13, 2024
Some vendors reuse the same product ID for different tablets, making it
difficult for userspace to figure out which table is connected.
While matching the device name has been used in the past by userspace to
workaround this limitation, some devices have shown that this is not
always a valid approach [1].

However, if userspace could access the firmware version name, it would
be possible to know which tablet is actually connected by matching it
against a list of known firmware names [2].

This patch exposes the firmware version name in the hid->uniq field.

Link: linuxwacom/libwacom#609  [1]
Link: linuxwacom/libwacom#610  [2]
Signed-off-by: José Expósito <[email protected]>
jexposit added a commit to jexposit/libwacom that referenced this issue Apr 18, 2024
This tablet has the same name as Gaomon M106K [1], making it impossible
to differentiate between them without matching by their firmware name.

Add an extra match including the firmware to facilitate matching the
Gaomon M106K.

[1] linuxwacom#609
@jexposit
Copy link
Contributor

jexposit commented Apr 18, 2024

@TacticalCode I created a PR matching by firmware name the Gaomon S620, the tablet that clashed with your M106K:
#657

Now that we can match by firmware name, you should be able to add a .tablet file for your tablet. Your tablet's firmware should be OEM02_T151.

EDIT: Useful links:

whot pushed a commit that referenced this issue Apr 18, 2024
This tablet has the same name as Gaomon M106K [1], making it impossible
to differentiate between them without matching by their firmware name.

Add an extra match including the firmware to facilitate matching the
Gaomon M106K.

[1] #609
@AesaraB
Copy link
Contributor

AesaraB commented Apr 18, 2024

The link hash doesn't work nicely when I resolve the relevant conversation in PR #654, so I'm going to post José's comment here for posterity.

DeviceMatch=usb|256c|006e|Tablet Monitor Pen|HUION_M184;usb|256c|006e|Tablet Monitor Pad|HUION_M184;usb|256c|006e|Tablet Monitor Touch Strip|HUION_M184;

And checking if your device is detected (after updating libwacom's database as described in the readme) by running libwacom-list-local-devices or checking your GNOME/KDE table settings.

Have in mind that you'd need to compile and install the latest libwacom code. I don't know if it is documented, but, to run the latest libwacom-list-local-devices without overriding your system's libwacom:

$ git clone https://github.com/linuxwacom/libwacom.git
$ cd libwacom
$ meson setup builddir --prefix=$(pwd)/builddir/install # It might require installing some dependencies
$ ninja -C builddir
$ ninja -C builddir install
$ LD_LIBRARY_PATH=$(pwd)/builddir/install/lib64:$LD_LIBRARY_PATH \
   ./builddir/install/bin/libwacom-list-local-devices

That last command should (hopefully) detect your tablet correctly.

If you want GNOME/KDE settings to recognize your tablet, you'd need to override your distro libwacom with the latest master, which I won't recommend unless you are testing in a VM or in a test PC that you plan to format.

Originally posted by @jexposit in #654 (comment)

@whot
Copy link
Member

whot commented May 8, 2024

We now have the M106K and M106K Pro both in the tablet files thaks to #659. It may not work yet (you'll need kernel 6.10 or Jose's kernel patches locally) but from the libwacom side I think we're good now, so let's close this. (If I'm wrong please re-open).

Any fixes to the tablet file please feel free to submit as MR.

@whot whot closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants