HID: uclogic: Add support for recent Huion tablets

Message ID PH7PR20MB49624FFCDF1F9382886933D3BB1E9@PH7PR20MB4962.namprd20.prod.outlook.com
State New
Headers
Series HID: uclogic: Add support for recent Huion tablets |

Commit Message

Inochi Amaoto Dec. 11, 2022, 8:37 a.m. UTC
  Since Huion uses a new device id for recent tablets, add a new
device id 0x0064 to support recent Huion tablets.

At least these tablets are using device id 0x0064:

Gaomon 1060 Pro (0x256c:0x0064)
Gaomon M6       (0x256c:0x0064)
Huion KD200     (0x256c:0x0064)
Huion KD100     (0x256c:0x0064)

This patch was tested on Gaomon 1060 Pro and Huion KD200. This patch
may affect other models with the same id, however, it's seems that the
other models of Huion do not have incompatible hardware changes, so
this patch should still work.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
---
 drivers/hid/hid-ids.h            | 1 +
 drivers/hid/hid-uclogic-core.c   | 2 ++
 drivers/hid/hid-uclogic-params.c | 2 ++
 3 files changed, 5 insertions(+)
  

Comments

José Expósito Dec. 19, 2022, 9:56 a.m. UTC | #1
Hi Inochi and thanks for the patch!

> Since Huion uses a new device id for recent tablets, add a new
> device id 0x0064 to support recent Huion tablets.
> 
> At least these tablets are using device id 0x0064:
> 
> Gaomon 1060 Pro (0x256c:0x0064)
> Gaomon M6       (0x256c:0x0064)
> Huion KD200     (0x256c:0x0064)
> Huion KD100     (0x256c:0x0064)
> 
> This patch was tested on Gaomon 1060 Pro and Huion KD200. This patch
> may affect other models with the same id, however, it's seems that the
> other models of Huion do not have incompatible hardware changes, so
> this patch should still work.

While this patch is correct, HUION always reuse the same vendor/product 
IDs, meaning that it'll affect a fairly big number of devices.

Checking some comments in DIGImend's issue tracker [1], users report
that their tablet works applying a similar patch. However, I think that 
it could be a good idea if you could build a version of the driver
including your patch and request them to test it.

I'm pretty sure it'll work, but it might be a good idea to test it on
more devices before merging it.

Best wishes,
Jose

[1] https://github.com/DIGImend/digimend-kernel-drivers/issues?q=0064
  
Inochi Amaoto Dec. 20, 2022, 11:47 p.m. UTC | #2
> While this patch is correct, HUION always reuse the same vendor/product 
> IDs, meaning that it'll affect a fairly big number of devices.

Yes, I agree. Not only recent devices are affected, but old devices with 
new firmware are also affected. [1] shows a firmware update can cause a 
new device id. It seems that HUION just uses new device id for new 
firmware, with nothing changed.

> Checking some comments in DIGImend's issue tracker [1], users report
> that their tablet works applying a similar patch. However, I think that 
> it could be a good idea if you could build a version of the driver
> including your patch and request them to test it.
> 
> I'm pretty sure it'll work, but it might be a good idea to test it on
> more devices before merging it.

That's sure. I have checked DIGImend's issue before submitting this patch.
There is also a pull request to provide the same functionality [2]. And 
the [2] says at least Gaomon M6 and Gaomon 1060pro worked. issue [3] and 
[4] seems to show that H580X and H1161 also works.

Nowadays I am working on my KD200, which is a typical devices of recent 
Huion tablets. This tablets has 3 usbif, so it is not fully recognized in 
the init process of the huion tablets in the kernel. This problem is also 
present in the 0x006d device (with invalid interface) [5]. I think it's OK
to delay this patch and do more test until the invalid interface problem 
is mitigated or solved.  

[1] https://github.com/DIGImend/digimend-kernel-drivers/issues/613
[2] https://github.com/DIGImend/digimend-kernel-drivers/pull/623
[3] https://github.com/DIGImend/digimend-kernel-drivers/issues/600
[4] https://github.com/DIGImend/digimend-kernel-drivers/issues/640
[5] https://github.com/DIGImend/digimend-kernel-drivers/issues?q=interface+is+invalid%2C+ignoring
  

Patch

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 8f58c3c1bec3..142186a6c14d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -620,6 +620,7 @@ 
 #define USB_VENDOR_ID_HUION		0x256c
 #define USB_DEVICE_ID_HUION_TABLET	0x006e
 #define USB_DEVICE_ID_HUION_TABLET2	0x006d
+#define USB_DEVICE_ID_HUION_TABLET3	0x0064
 
 #define USB_VENDOR_ID_IBM					0x04b3
 #define USB_DEVICE_ID_IBM_SCROLLPOINT_III			0x3100
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 7fa6fe04f1b2..0c31c13bfbfd 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -493,6 +493,8 @@  static const struct hid_device_id uclogic_devices[] = {
 				USB_DEVICE_ID_HUION_TABLET) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
 				USB_DEVICE_ID_HUION_TABLET2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_HUION,
+				USB_DEVICE_ID_HUION_TABLET3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_TRUST,
 				USB_DEVICE_ID_TRUST_PANORA_TABLET) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 34fa991e6267..f27292d71b6d 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -1514,6 +1514,8 @@  int uclogic_params_init(struct uclogic_params *params,
 		     USB_DEVICE_ID_HUION_TABLET):
 	case VID_PID(USB_VENDOR_ID_HUION,
 		     USB_DEVICE_ID_HUION_TABLET2):
+	case VID_PID(USB_VENDOR_ID_HUION,
+		     USB_DEVICE_ID_HUION_TABLET3):
 	case VID_PID(USB_VENDOR_ID_UCLOGIC,
 		     USB_DEVICE_ID_HUION_TABLET):
 	case VID_PID(USB_VENDOR_ID_UCLOGIC,