linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: Backport HID-logitech to 3.10?
@ 2016-09-01  0:56 Simon Wood
  2016-09-02  9:32 ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wood @ 2016-09-01  0:56 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

Hi all,
I received a question regarding back-porting the support for the G29
racing wheel to 3.10 (Android in particular), and after some collaborative
work we determined that changes between 3.10 and 4.7 are actually pretty
minimal and self contained.

After copying the HEAD 'hid-lg.[ch]' and 'hid-lg4ff.[ch]' from 4.7, there
is a minimal patch (example attached) required to get the build working.


My question to the list would be how this would/could be implemented, and
how the process works as 3.10 moves through the mainline patches to reach
current HEAD.

Any hints that anyone has would be appreciated.
Simon.

[-- Attachment #2: 0002-HID-hid-logitech-backported-from-v4.7-to-v3.10.102.patch --]
[-- Type: application/octet-stream, Size: 4665 bytes --]

From c787af2beed23b38f80deb87e9d8b9ea37b326b0 Mon Sep 17 00:00:00 2001
From: Simon Wood <simon@mungewell.org>
Date: Mon, 29 Aug 2016 22:10:53 -0600
Subject: [PATCH 2/2] HID: hid-logitech backported from v4.7 to v3.10.102

Fix build after grabbing HEAD from v4.7. MD5Sums of 'imported' files:
--
047a99a2273916fc997b1e35cee4201b  drivers/hid/hid-lg4ff.h
8095fd840a2716a4cbc97b5015e28c66  drivers/hid/hid-lg.c
7d84dd914a0c7dabf714eb6c668ca974  drivers/hid/hid-lgff.c
3349257e93faac304de8202844f14972  drivers/hid/hid-lg.h
--
---
 drivers/hid/hid-core.c  |  2 ++
 drivers/hid/hid-ids.h   |  2 ++
 drivers/hid/hid-lg.c    | 11 +++++++++++
 drivers/hid/hid-lg4ff.c |  6 ++++++
 4 files changed, 21 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c1a8cf2..78f4481 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1705,10 +1705,12 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 45c593d..ac4a081 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -537,8 +537,10 @@
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD	0xc20a
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD	0xc211
 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D	0xc215
+#define USB_DEVICE_ID_LOGITECH_DUAL_ACTION	0xc216
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2	0xc218
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2	0xc219
+#define USB_DEVICE_ID_LOGITECH_G29_WHEEL	0xc24f
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D	0xc283
 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO	0xc286
 #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940	0xc287
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index feb2be7..9c4bbd4 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -23,6 +23,7 @@
 #include <linux/sched.h>
 #include <linux/usb.h>
 #include <linux/wait.h>
+#include <linux/version.h>
 
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
@@ -703,8 +704,13 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) {
 		unsigned char buf[] = { 0x00, 0xAF,  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
+/* backport from v4.7 - locally revert b0dd72aafd785785bedbb6db932955807e454a65 */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,14,0)
+		ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
+#else
 		ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
 					HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+#endif
 
 		if (ret >= 0) {
 			/* insert a little delay of 10 jiffies ~ 40ms */
@@ -717,8 +723,13 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
 			buf[1] = 0xB2;
 			get_random_bytes(&buf[2], 2);
 
+/* backport from v4.7 - locally revert b0dd72aafd785785bedbb6db932955807e454a65 */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,14,0)
+			ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
+#else
 			ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
 					HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+#endif
 		}
 	}
 
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index af3a8ec..4122646 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -33,6 +33,12 @@
 #include "hid-lg4ff.h"
 #include "hid-ids.h"
 
+/* Backport from v4.7 - locally revert d8ce9bf5551bfea431893bdd0a943f24a5170828 */
+#include <linux/version.h>
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,0)
+#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
+#endif
+
 #define LG4FF_MMODE_IS_MULTIMODE 0
 #define LG4FF_MMODE_SWITCHED 1
 #define LG4FF_MMODE_NOT_MULTIMODE 2
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: RFC: Backport HID-logitech to 3.10?
  2016-09-01  0:56 RFC: Backport HID-logitech to 3.10? Simon Wood
@ 2016-09-02  9:32 ` Benjamin Tissoires
  2016-09-02 14:59   ` Simon Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2016-09-02  9:32 UTC (permalink / raw)
  To: Simon Wood; +Cc: linux-input, linux-kernel

Hi Simon,

On Thu, Sep 1, 2016 at 2:56 AM, Simon Wood <simon@mungewell.org> wrote:
> Hi all,
> I received a question regarding back-porting the support for the G29
> racing wheel to 3.10 (Android in particular), and after some collaborative
> work we determined that changes between 3.10 and 4.7 are actually pretty
> minimal and self contained.
>
> After copying the HEAD 'hid-lg.[ch]' and 'hid-lg4ff.[ch]' from 4.7, there
> is a minimal patch (example attached) required to get the build working.

Don't you need hid-logitech-hidpp too?

>
>
> My question to the list would be how this would/could be implemented, and
> how the process works as 3.10 moves through the mainline patches to reach
> current HEAD.

Not sure I understand exactly what you want from us here.

The stable rules are detailed in
Documentation/stable_kernel_rules.txt. And unfortunately, I don't
think adding these patches will be acceptable for upstream 3.10.
The rule of thumb is that if a distribution wants to backport changes,
they can have their own rules but the official stable tree is only for
fixing issues, not adding new device support, unless it's *very* small
("- New device IDs and quirks are also accepted.")

So if you need to backport the changes to the 3.10 tree, see the rules
of the distribution you are working on. Some prefer backporting full
commits only (to keep closer to upstream), others will accept some #if
LINUX_VERSION. In those case, I'd personally rather have a small
header that makes the glue between old code and new one to keep the
code closer to upstream.

Cheers,
Benjamin

>
> Any hints that anyone has would be appreciated.
> Simon.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: Backport HID-logitech to 3.10?
  2016-09-02  9:32 ` Benjamin Tissoires
@ 2016-09-02 14:59   ` Simon Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Wood @ 2016-09-02 14:59 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Simon Wood, linux-input, linux-kernel

On Fri, September 2, 2016 3:32 am, Benjamin Tissoires wrote:
> On Thu, Sep 1, 2016 at 2:56 AM, Simon Wood <simon@mungewell.org> wrote:
>> After copying the HEAD 'hid-lg.[ch]' and 'hid-lg4ff.[ch]' from 4.7,
>> there is a minimal patch (example attached) required to get the build
>> working.
>
> Don't you need hid-logitech-hidpp too?

Hi Benjamin,
Nope, the 'hid-logitech-hidpp.ko' driver is separate and (for wheels) only
has support for the G920 wheel. Other Logitech wheels are handled by
'hid-logitech.ko'.

> Not sure I understand exactly what you want from us here.

A puppy. ;-)

> The stable rules are detailed in
> Documentation/stable_kernel_rules.txt. And unfortunately, I don't
> think adding these patches will be acceptable for upstream 3.10.

After reading through these I would agree with you, that this is a
nice-to-have not a need-to-have. So, the patch is here if anyone wants to
use it personally or for a distribution.

Thank you for your comments,
Simon.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-02 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01  0:56 RFC: Backport HID-logitech to 3.10? Simon Wood
2016-09-02  9:32 ` Benjamin Tissoires
2016-09-02 14:59   ` Simon Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).