Thread: [DIGImend-devel] [PATCH 1/2] uclogic: factor out uclogic_append_suffix
Brought to you by:
spb_nick
|
From: Benjamin T. <ben...@re...> - 2015-03-17 13:13:31
|
.input_configured() will be used to make the device appear like a Wacom
tablet. We need to have a separate call for appending the suffix to keep
the code clear.
---
Not sure this one needs to go upstream. It's only required for the next patch
which should not go upstream.
hid-uclogic.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/hid-uclogic.c b/hid-uclogic.c
index cca77d8..e7ea0e3 100644
--- a/hid-uclogic.c
+++ b/hid-uclogic.c
@@ -753,18 +753,13 @@ static int uclogic_input_mapping(struct hid_device *hdev, struct hid_input *hi,
return 0;
}
-static void uclogic_input_configured(struct hid_device *hdev,
- struct hid_input *hi)
+static void uclogic_append_suffix(struct hid_device *hdev, struct hid_input *hi)
{
char *name;
const char *suffix = NULL;
struct hid_field *field;
size_t len;
- /* no report associated (HID_QUIRK_MULTI_INPUT not set) */
- if (!hi->report)
- return;
-
field = hi->report->field[0];
switch (field->application) {
@@ -798,6 +793,17 @@ static void uclogic_input_configured(struct hid_device *hdev,
}
}
+static void uclogic_input_configured(struct hid_device *hdev,
+ struct hid_input *hi)
+{
+ /* no report associated (HID_QUIRK_MULTI_INPUT not set) */
+ if (!hi->report)
+ return;
+
+ uclogic_append_suffix(hdev, hi);
+
+}
+
/**
* Enable fully-functional tablet mode and determine device parameters.
*
--
2.3.1
|
|
From: Benjamin T. <ben...@re...> - 2015-03-17 13:13:36
|
To have legacy xf86-input-wacom accepting the pad of the Huion tablets,
we need to set some bits on the Pad interface even if they are not used.
The following bits are activated:
ABS_MISC, ABS_X, ABS_Y and BTN_STYLUS
(because the Pad used to be a attached to the stylus interface, libwacom
and others expect the Pad to look like a tablet)
Not having the xf86-input-wacom driver handling the pad is not a regression,
so there is no absolute need for it upstream.
It however makes sense to include this in the digimend-kernel-tree drivers
given that the purpose is to have users try the drivers with their current
setup.
Note that if we add the BTN_RUBBER capability to the Pen interface,
gnome-control-center happily takes the device. However, this will break
users who have updated libwacom to current master, so better not export
such false capability.
---
I don't want to send this one upstream. I discussed with Peter about it,
and we both agree that the kernel should not advertise axes it does not have.
hid-uclogic.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/hid-uclogic.c b/hid-uclogic.c
index e7ea0e3..c259d79 100644
--- a/hid-uclogic.c
+++ b/hid-uclogic.c
@@ -793,6 +793,29 @@ static void uclogic_append_suffix(struct hid_device *hdev, struct hid_input *hi)
}
}
+static void uclogic_tweak_input(struct hid_device *hdev, struct hid_input *hi)
+{
+ struct input_dev *input_dev = hi->input;
+ struct hid_field *field;
+
+ field = hi->report->field[0];
+
+ /* xf86-input-wacom needs some more declarations */
+ if (field->application == HID_GD_KEYPAD) {
+ __set_bit(EV_ABS, input_dev->evbit);
+
+ /* forced to have legacy xf86-input-wacom working */
+ __set_bit(ABS_MISC, input_dev->absbit);
+
+ /* forced to have legacy xf86-input-wacom accepting the pad */
+ input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0);
+
+ /* forced to have udev and libwacom accepting the pad */
+ __set_bit(BTN_STYLUS, input_dev->keybit);
+ }
+}
+
static void uclogic_input_configured(struct hid_device *hdev,
struct hid_input *hi)
{
@@ -802,6 +825,7 @@ static void uclogic_input_configured(struct hid_device *hdev,
uclogic_append_suffix(hdev, hi);
+ uclogic_tweak_input(hdev, hi);
}
/**
--
2.3.1
|
|
From: Nikolai K. <sp...@gm...> - 2015-03-17 13:15:59
|
On 03/17/2015 03:13 PM, Benjamin Tissoires wrote: > To have legacy xf86-input-wacom accepting the pad of the Huion tablets, > we need to set some bits on the Pad interface even if they are not used. > > The following bits are activated: > ABS_MISC, ABS_X, ABS_Y and BTN_STYLUS > (because the Pad used to be a attached to the stylus interface, libwacom > and others expect the Pad to look like a tablet) Can we just expand the pad report descriptor? Nick |
|
From: Benjamin T. <ben...@re...> - 2015-03-17 14:50:28
|
On Mar 17 2015 or thereabouts, Nikolai Kondrashov wrote: > On 03/17/2015 03:13 PM, Benjamin Tissoires wrote: > >To have legacy xf86-input-wacom accepting the pad of the Huion tablets, > >we need to set some bits on the Pad interface even if they are not used. > > > >The following bits are activated: > >ABS_MISC, ABS_X, ABS_Y and BTN_STYLUS > >(because the Pad used to be a attached to the stylus interface, libwacom > >and others expect the Pad to look like a tablet) > > Can we just expand the pad report descriptor? > That's an idea. But that means that we will have to define those fake axes to every report descriptor we fix. Here, it will force it for every pad, no matter if the rdesc is fixed or not. Both solutions are tempting (I won't have the time to implement the pad fixup today though). BTW, speaking about extending the report descriptor, I noticed yesterday that the tablets with 8 buttons have a 0x7a string with the byte 3 (starting from 0) set to 0x08. Those of pictures are not showing any buttons have this byte set to 0x00. Unfortunately, I would like to check on the new 1060pro+ (12 buttons) and the H420 (3 buttons) to verify this theory. Anyway, we will have to differentiate those 2 tablets in some way to export only the proper buttons number. Cheers, Benjamin |
|
From: Nikolai K. <sp...@gm...> - 2015-03-22 14:55:58
|
On 03/17/2015 04:50 PM, Benjamin Tissoires wrote: > On Mar 17 2015 or thereabouts, Nikolai Kondrashov wrote: >> On 03/17/2015 03:13 PM, Benjamin Tissoires wrote: >>> To have legacy xf86-input-wacom accepting the pad of the Huion tablets, >>> we need to set some bits on the Pad interface even if they are not used. >>> >>> The following bits are activated: >>> ABS_MISC, ABS_X, ABS_Y and BTN_STYLUS >>> (because the Pad used to be a attached to the stylus interface, libwacom >>> and others expect the Pad to look like a tablet) >> >> Can we just expand the pad report descriptor? >> > > That's an idea. But that means that we will have to define those fake > axes to every report descriptor we fix. Here, it will force it for every > pad, no matter if the rdesc is fixed or not. > > Both solutions are tempting (I won't have the time to implement the pad > fixup today though). Sorry for the delay, I'll be looking at your new patches today. > BTW, speaking about extending the report descriptor, I noticed yesterday > that the tablets with 8 buttons have a 0x7a string with the byte 3 > (starting from 0) set to 0x08. Those of pictures are not showing any > buttons have this byte set to 0x00. That's a cool find! I'll check on the new dumps I received and perhaps add that to uclogic-decode. > Unfortunately, I would like to check on the new 1060pro+ (12 buttons) > and the H420 (3 buttons) to verify this theory. Anyway, we will have to > differentiate those 2 tablets in some way to export only the proper > buttons number. Sure. Thanks, Benjamin! Nick |
|
From: Nikolai K. <sp...@gm...> - 2015-03-22 21:56:29
|
On 03/22/2015 04:55 PM, Nikolai Kondrashov wrote: > On 03/17/2015 04:50 PM, Benjamin Tissoires wrote: >> On Mar 17 2015 or thereabouts, Nikolai Kondrashov wrote: >>> On 03/17/2015 03:13 PM, Benjamin Tissoires wrote: >>>> To have legacy xf86-input-wacom accepting the pad of the Huion tablets, >>>> we need to set some bits on the Pad interface even if they are not used. >>>> >>>> The following bits are activated: >>>> ABS_MISC, ABS_X, ABS_Y and BTN_STYLUS >>>> (because the Pad used to be a attached to the stylus interface, libwacom >>>> and others expect the Pad to look like a tablet) >>> >>> Can we just expand the pad report descriptor? >>> >> >> That's an idea. But that means that we will have to define those fake >> axes to every report descriptor we fix. Here, it will force it for every >> pad, no matter if the rdesc is fixed or not. >> >> Both solutions are tempting (I won't have the time to implement the pad >> fixup today though). > > Sorry for the delay, I'll be looking at your new patches today. > >> BTW, speaking about extending the report descriptor, I noticed yesterday >> that the tablets with 8 buttons have a 0x7a string with the byte 3 >> (starting from 0) set to 0x08. Those of pictures are not showing any >> buttons have this byte set to 0x00. > > That's a cool find! I'll check on the new dumps I received and perhaps add > that to uclogic-decode. I looked at some new dumps (see updates to the tablets repo) and it seems that if you get "HK On" for 0x7b string descriptor, the second byte of 0x7a bString is indeed the number of buttons. BTW, if you have any additions to the tablets repo, I'll be glad to accept patches :) Nick |