Thread: [DIGImend-users] [PATCH 1/1] HID: waltop: Extend barrel button fix
Brought to you by:
spb_nick
|
From: Nikolai K. <sp...@gm...> - 2012-05-20 18:24:01
|
Extend Waltop barrel button fix to all models: ignore reported pressure when a
barrel button is pressed, because it is rarely correct. Report zero pressure in
such cases instead.
Signed-off-by: Nikolai Kondrashov <sp...@gm...>
---
drivers/hid/hid-waltop.c | 45 +++++++--------------------------------------
1 file changed, 7 insertions(+), 38 deletions(-)
diff --git a/drivers/hid/hid-waltop.c b/drivers/hid/hid-waltop.c
index 9a48438..745e4e9 100644
--- a/drivers/hid/hid-waltop.c
+++ b/drivers/hid/hid-waltop.c
@@ -638,28 +638,10 @@ static __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-struct waltop_state {
- u8 pressure0;
- u8 pressure1;
-};
-
static int waltop_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
int ret;
- struct waltop_state *s;
-
- s = kzalloc(sizeof(*s), GFP_KERNEL);
- if (s == NULL) {
- hid_err(hdev, "can't allocate device state\n");
- ret = -ENOMEM;
- goto err;
- }
-
- s->pressure0 = 0;
- s->pressure1 = 0;
-
- hid_set_drvdata(hdev, s);
ret = hid_parse(hdev);
if (ret) {
@@ -675,7 +657,6 @@ static int waltop_probe(struct hid_device *hdev,
return 0;
err:
- kfree(s);
return ret;
}
@@ -732,27 +713,18 @@ static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
static int waltop_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *data, int size)
{
- /* If this is a pen input report of a tablet with PID 0038 */
- if (hdev->product == USB_DEVICE_ID_WALTOP_PID_0038 &&
- report->type == HID_INPUT_REPORT &&
- report->id == 16 &&
- size == 8) {
- struct waltop_state *s = hid_get_drvdata(hdev);
-
+ /* If this is a pen input report */
+ if (report->type == HID_INPUT_REPORT && report->id == 16 && size >= 8) {
/*
- * Ignore maximum pressure reported when a barrel button is
- * pressed.
+ * Ignore reported pressure when a barrel button is pressed,
+ * because it is rarely correct.
*/
/* If a barrel button is pressed */
if ((data[1] & 0xF) > 1) {
- /* Use the last known pressure */
- data[6] = s->pressure0;
- data[7] = s->pressure1;
- } else {
- /* Remember reported pressure */
- s->pressure0 = data[6];
- s->pressure1 = data[7];
+ /* Report zero pressure */
+ data[6] = 0;
+ data[7] = 0;
}
}
@@ -806,10 +778,7 @@ static int waltop_raw_event(struct hid_device *hdev, struct hid_report *report,
static void waltop_remove(struct hid_device *hdev)
{
- struct waltop_state *s = hid_get_drvdata(hdev);
-
hid_hw_stop(hdev);
- kfree(s);
}
static const struct hid_device_id waltop_devices[] = {
--
1.7.10
|
|
From: Nikolai K. <sp...@gm...> - 2012-05-20 18:28:38
|
Hi Eduardo, On 05/20/2012 09:23 PM, Nikolai Kondrashov wrote: > Extend Waltop barrel button fix to all models: ignore reported pressure when a > barrel button is pressed, because it is rarely correct. Report zero pressure in > such cases instead. I've modified the fix for your tablet pen barrel buttons slightly before submitting it to the kernel. Although I'm pretty sure it's correct and I've tested it on the models I have (which are without this issue), it would be best if you could test the new version, when you have time. Could you do it? Thanks! Sincerely, Nick |
|
From: Jiri K. <jk...@su...> - 2012-05-21 11:23:20
|
On Sun, 20 May 2012, Nikolai Kondrashov wrote: > Extend Waltop barrel button fix to all models: ignore reported pressure when a > barrel button is pressed, because it is rarely correct. Report zero pressure in > such cases instead. > > Signed-off-by: Nikolai Kondrashov <sp...@gm...> Applied, thanks. -- Jiri Kosina SUSE Labs |
|
From: Eduardo H. S. <hob...@gm...> - 2012-05-21 12:13:32
|
2012/5/20 Nikolai Kondrashov <sp...@gm...>: > Hi Eduardo, > > > On 05/20/2012 09:23 PM, Nikolai Kondrashov wrote: >> >> Extend Waltop barrel button fix to all models: ignore reported pressure >> when a >> barrel button is pressed, because it is rarely correct. Report zero >> pressure in >> such cases instead. > > > I've modified the fix for your tablet pen barrel buttons slightly before > submitting it to the kernel. > > Although I'm pretty sure it's correct and I've tested it on the models I > have (which are without this issue), it would be best if you could test the > new version, when you have time. Could you do it? Apply this patch? Yes, of course, though it may take time to compile. Eduardo > > Thanks! > > Sincerely, > Nick |
|
From: Eduardo H. S. <hob...@gm...> - 2012-05-22 17:37:46
|
2012/5/21 Eduardo H. Silva <hob...@gm...>: > 2012/5/20 Nikolai Kondrashov <sp...@gm...>: >> Hi Eduardo, >> >> >> On 05/20/2012 09:23 PM, Nikolai Kondrashov wrote: >>> >>> Extend Waltop barrel button fix to all models: ignore reported pressure >>> when a >>> barrel button is pressed, because it is rarely correct. Report zero >>> pressure in >>> such cases instead. >> >> >> I've modified the fix for your tablet pen barrel buttons slightly before >> submitting it to the kernel. >> >> Although I'm pretty sure it's correct and I've tested it on the models I >> have (which are without this issue), it would be best if you could test the >> new version, when you have time. Could you do it? > > Apply this patch? Yes, of course, though it may take time to compile. > > Eduardo > >> >> Thanks! >> >> Sincerely, >> Nick Hm, the patch is inline with the e-mail, and I'm not sure when to start copying the text to paste in a file. Could you attach it? I'll apply it as soon as I can afterwards. Thanks, Eduardo |
|
From: Nikolai K. <sp...@gm...> - 2012-05-22 19:10:16
Attachments:
0001-HID-waltop-Extend-barrel-button-fix.patch
|
On 05/22/2012 08:37 PM, Eduardo H. Silva wrote: > Hm, the patch is inline with the e-mail, and I'm not sure when to > start copying the text to paste in a file. Could you attach it? I'll > apply it as soon as I can afterwards. Sure. Here it is. You'll need revert the previous version I sent you before applying it. Thanks. Sincerely, Nick |
|
From: Eduardo H. S. <hob...@gm...> - 2012-05-22 19:43:00
|
2012/5/22 Nikolai Kondrashov <sp...@gm...>: > On 05/22/2012 08:37 PM, Eduardo H. Silva wrote: >> >> Hm, the patch is inline with the e-mail, and I'm not sure when to >> start copying the text to paste in a file. Could you attach it? I'll >> apply it as soon as I can afterwards. > > > Sure. Here it is. > You'll need revert the previous version I sent you before applying it. > > Thanks. > > Sincerely, > Nick Hm, I'm using the same compiling instructions as before (http://fedoraproject.org/wiki/Building_a_custom_kernel) , but get a error when building the kernel, at the phase of applying the patch: [...] Patch22017: 0001-drm-radeon-don-t-mess-with-hot-plug-detect-for-eDP-o.patch + case "$patch" in + patch -p1 -F1 -s + ApplyPatch 0001-HID-waltop-Extend-barrel-button-fix.patch + local patch=0001-HID-waltop-Extend-barrel-button-fix.patch + shift + '[' '!' -f /home/jobezone/rpmbuild/SOURCES/0001-HID-waltop-Extend-barrel-button-fix.patch ']' Patch99999: 0001-HID-waltop-Extend-barrel-button-fix.patch + case "$patch" in + patch -p1 -F1 -s 4 out of 4 hunks FAILED -- saving rejects to file drivers/hid/hid-waltop.c.rej Eduardo |
|
From: Nikolai K. <sp...@gm...> - 2012-05-22 19:49:22
|
On 05/22/2012 10:42 PM, Eduardo H. Silva wrote: > Hm, I'm using the same compiling instructions as before > (http://fedoraproject.org/wiki/Building_a_custom_kernel) , but get a > error when building the kernel, at the phase of applying the patch: > > 4 out of 4 hunks FAILED -- saving rejects to file drivers/hid/hid-waltop.c.rej Did you remove the old patch? Sincerely, Nick |
|
From: Nikolai K. <sp...@gm...> - 2012-05-22 19:53:04
|
On 05/22/2012 10:42 PM, Eduardo H. Silva wrote: > Hm, I'm using the same compiling instructions as before > (http://fedoraproject.org/wiki/Building_a_custom_kernel) , but get a > error when building the kernel, at the phase of applying the patch: > > 4 out of 4 hunks FAILED -- saving rejects to file drivers/hid/hid-waltop.c.rej Oh, sorry, I forgot that you were using an older kernel. I'll redo the patch for you right now. Sincerely, Nick |
|
From: Nikolai K. <sp...@gm...> - 2012-05-22 19:56:01
Attachments:
waltop_button_fix_v2.patch
|
On 05/22/2012 10:52 PM, Nikolai Kondrashov wrote: > Oh, sorry, I forgot that you were using an older kernel. I'll redo the patch > for you right now. Please find the updated patch attached. Sorry for the confusion. Thanks for testing! Sincerely, Nick |
|
From: Eduardo H. S. <hob...@gm...> - 2012-05-24 19:06:11
|
2012/5/22 Nikolai Kondrashov <sp...@gm...>: > On 05/22/2012 10:52 PM, Nikolai Kondrashov wrote: >> >> Oh, sorry, I forgot that you were using an older kernel. I'll redo the >> patch >> for you right now. > > > Please find the updated patch attached. Sorry for the confusion. > > Thanks for testing! > > Sincerely, > Nick Works great :) Eduardo |
|
From: Nikolai K. <sp...@gm...> - 2012-05-24 20:32:46
|
On 05/24/2012 10:06 PM, Eduardo H. Silva wrote: > Works great :) Thanks a lot, Eduardo! Sincerely, Nick |