linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] few reverts and fixes for 5.2
@ 2019-06-05 12:44 Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 1/4] Revert "HID: Increase maximum report size allowed by hid_field_extract()" Benjamin Tissoires
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2019-06-05 12:44 UTC (permalink / raw)
  To: Jiri Kosina, Hans de Goede, Dave Hansen, Kai-Heng Feng
  Cc: linux-input, linux-kernel, Benjamin Tissoires

This has been already publicly discussed here, so I am just posting
for completeness.

patch 1:
request to revert it:
https://patchwork.kernel.org/patch/10844177/#22651385

patch 2&3:
related thread:
https://lkml.org/lkml/2019/5/28/778

patch 4:
bug link: https://bugzilla.kernel.org/show_bug.cgi?id=203619
and related thread: https://lkml.org/lkml/2019/5/28/778

Cheers,
Benjamin

Benjamin Tissoires (3):
  Revert "HID: Increase maximum report size allowed by
    hid_field_extract()"
  Revert "HID: core: Do not call request_module() in async context"
  Revert "HID: core: Call request_module before doing device_add"

Hans de Goede (1):
  HID: logitech-dj: Fix 064d:c52f receiver support

 drivers/hid/hid-core.c        | 16 +++----------
 drivers/hid/hid-logitech-dj.c | 42 ++++++++++++++++++++++-------------
 2 files changed, 30 insertions(+), 28 deletions(-)

-- 
2.19.2


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

* [PATCH 1/4] Revert "HID: Increase maximum report size allowed by hid_field_extract()"
  2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
@ 2019-06-05 12:44 ` Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 2/4] Revert "HID: core: Do not call request_module() in async context" Benjamin Tissoires
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2019-06-05 12:44 UTC (permalink / raw)
  To: Jiri Kosina, Hans de Goede, Dave Hansen, Kai-Heng Feng
  Cc: linux-input, linux-kernel, Benjamin Tissoires, stable

This reverts commit 94a9992f7dbdfb28976b565af220e0c4a117144a.

The commit allows for more than 32 bits in hid_field_extract(),
but the return value is a 32 bits int.
So basically what this commit is doing is just silencing those
legitimate errors.

Revert to a previous situation in the hope that a proper
fix will be impletemented.

Fixes: 94a9992f7dbd ("HID: Increase maximum report size allowed by hid_field_extract()")
Cc: stable@vger.kernel.org # v5.1
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 08d310723e96..205d6b82a706 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1311,10 +1311,10 @@ static u32 __extract(u8 *report, unsigned offset, int n)
 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
 			unsigned offset, unsigned n)
 {
-	if (n > 256) {
-		hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n",
+	if (n > 32) {
+		hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
 			 n, current->comm);
-		n = 256;
+		n = 32;
 	}
 
 	return __extract(report, offset, n);
-- 
2.19.2


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

* [PATCH 2/4] Revert "HID: core: Do not call request_module() in async context"
  2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 1/4] Revert "HID: Increase maximum report size allowed by hid_field_extract()" Benjamin Tissoires
@ 2019-06-05 12:44 ` Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 3/4] Revert "HID: core: Call request_module before doing device_add" Benjamin Tissoires
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2019-06-05 12:44 UTC (permalink / raw)
  To: Jiri Kosina, Hans de Goede, Dave Hansen, Kai-Heng Feng
  Cc: linux-input, linux-kernel, Benjamin Tissoires

This reverts commit 4ceabaf7909d109db6afbffc4ed182741fc32043.

This patch and a025a18fe are giving extended timeouts
on boot for at least Ubuntu and OpenSuse.

Revert them until we get a better fix.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 205d6b82a706..fd9e7a4c107d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -27,7 +27,6 @@
 #include <linux/vmalloc.h>
 #include <linux/sched.h>
 #include <linux/semaphore.h>
-#include <linux/async.h>
 
 #include <linux/hid.h>
 #include <linux/hiddev.h>
@@ -2367,9 +2366,8 @@ int hid_add_device(struct hid_device *hdev)
 	 * not first have hid-generic binding only to have it replaced
 	 * immediately afterwards with a specialized driver.
 	 */
-	if (!current_is_async())
-		request_module("hid:b%04Xg%04Xv%08Xp%08X", hdev->bus,
-			       hdev->group, hdev->vendor, hdev->product);
+	request_module("hid:b%04Xg%04Xv%08Xp%08X",
+		       hdev->bus, hdev->group, hdev->vendor, hdev->product);
 
 	hid_debug_register(hdev, dev_name(&hdev->dev));
 	ret = device_add(&hdev->dev);
-- 
2.19.2


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

* [PATCH 3/4] Revert "HID: core: Call request_module before doing device_add"
  2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 1/4] Revert "HID: Increase maximum report size allowed by hid_field_extract()" Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 2/4] Revert "HID: core: Do not call request_module() in async context" Benjamin Tissoires
@ 2019-06-05 12:44 ` Benjamin Tissoires
  2019-06-05 12:44 ` [PATCH 4/4] HID: logitech-dj: Fix 064d:c52f receiver support Benjamin Tissoires
  2019-06-05 13:07 ` [PATCH 0/4] few reverts and fixes for 5.2 Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2019-06-05 12:44 UTC (permalink / raw)
  To: Jiri Kosina, Hans de Goede, Dave Hansen, Kai-Heng Feng
  Cc: linux-input, linux-kernel, Benjamin Tissoires

This reverts commit a025a18fecd4429f4ca66b1746001263c052ecbb.

This patch and 4ceabaf79 are giving extended timeouts
on boot for at least Ubuntu and OpenSuse.

Revert them until we get a better fix.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203741
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-core.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index fd9e7a4c107d..210b81a56e1a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2361,14 +2361,6 @@ int hid_add_device(struct hid_device *hdev)
 	dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
 		     hdev->vendor, hdev->product, atomic_inc_return(&id));
 
-	/*
-	 * Try loading the module for the device before the add, so that we do
-	 * not first have hid-generic binding only to have it replaced
-	 * immediately afterwards with a specialized driver.
-	 */
-	request_module("hid:b%04Xg%04Xv%08Xp%08X",
-		       hdev->bus, hdev->group, hdev->vendor, hdev->product);
-
 	hid_debug_register(hdev, dev_name(&hdev->dev));
 	ret = device_add(&hdev->dev);
 	if (!ret)
-- 
2.19.2


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

* [PATCH 4/4] HID: logitech-dj: Fix 064d:c52f receiver support
  2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
                   ` (2 preceding siblings ...)
  2019-06-05 12:44 ` [PATCH 3/4] Revert "HID: core: Call request_module before doing device_add" Benjamin Tissoires
@ 2019-06-05 12:44 ` Benjamin Tissoires
  2019-06-05 13:07 ` [PATCH 0/4] few reverts and fixes for 5.2 Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Tissoires @ 2019-06-05 12:44 UTC (permalink / raw)
  To: Jiri Kosina, Hans de Goede, Dave Hansen, Kai-Heng Feng
  Cc: linux-input, linux-kernel, Benjamin Tissoires

From: Hans de Goede <hdegoede@redhat.com>

The c52f nano receiver is a mouse only receiver. This means that it needs
some special handling compared to the c534 nano receiver:

1) It sends unnumbered mouse reports with a size of 8 bytes, so we need
   to extend the unnumbered mouse report handling to support reports upto
   8 bytes large

2) It mouse reports have the same high-resolution format as those from the
   gaming mouse receivers

3) It can report consumer/multimedia buttons on its second interface, since
   this is a mouse-only receiver these must be forwarded to the mouse child
   device and not to the keyboard child-device (which will not exist)

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203619
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/hid-logitech-dj.c | 42 ++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 41baa4dbbfcc..c48e7030d3c9 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -128,6 +128,7 @@ enum recvr_type {
 	recvr_type_dj,
 	recvr_type_hidpp,
 	recvr_type_gaming_hidpp,
+	recvr_type_mouse_only,
 	recvr_type_27mhz,
 	recvr_type_bluetooth,
 };
@@ -879,9 +880,12 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev,
 	schedule_work(&djrcv_dev->work);
 }
 
-static void logi_hidpp_dev_conn_notif_equad(struct hidpp_event *hidpp_report,
+static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
+					    struct hidpp_event *hidpp_report,
 					    struct dj_workitem *workitem)
 {
+	struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
+
 	workitem->type = WORKITEM_TYPE_PAIRED;
 	workitem->device_type = hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] &
 				HIDPP_DEVICE_TYPE_MASK;
@@ -895,6 +899,8 @@ static void logi_hidpp_dev_conn_notif_equad(struct hidpp_event *hidpp_report,
 		break;
 	case REPORT_TYPE_MOUSE:
 		workitem->reports_supported |= STD_MOUSE | HIDPP;
+		if (djrcv_dev->type == recvr_type_mouse_only)
+			workitem->reports_supported |= MULTIMEDIA;
 		break;
 	}
 }
@@ -938,7 +944,7 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev,
 	case 0x01:
 		device_type = "Bluetooth";
 		/* Bluetooth connect packet contents is the same as (e)QUAD */
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		if (!(hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] &
 						HIDPP_MANUFACTURER_MASK)) {
 			hid_info(hdev, "Non Logitech device connected on slot %d\n",
@@ -952,18 +958,18 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev,
 		break;
 	case 0x03:
 		device_type = "QUAD or eQUAD";
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		break;
 	case 0x04:
 		device_type = "eQUAD step 4 DJ";
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		break;
 	case 0x05:
 		device_type = "DFU Lite";
 		break;
 	case 0x06:
 		device_type = "eQUAD step 4 Lite";
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		break;
 	case 0x07:
 		device_type = "eQUAD step 4 Gaming";
@@ -973,11 +979,11 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev,
 		break;
 	case 0x0a:
 		device_type = "eQUAD nano Lite";
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		break;
 	case 0x0c:
 		device_type = "eQUAD Lightspeed";
-		logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
+		logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem);
 		workitem.reports_supported |= STD_KEYBOARD;
 		break;
 	}
@@ -1330,7 +1336,8 @@ static int logi_dj_ll_parse(struct hid_device *hid)
 	if (djdev->reports_supported & STD_MOUSE) {
 		dbg_hid("%s: sending a mouse descriptor, reports_supported: %llx\n",
 			__func__, djdev->reports_supported);
-		if (djdev->dj_receiver_dev->type == recvr_type_gaming_hidpp)
+		if (djdev->dj_receiver_dev->type == recvr_type_gaming_hidpp ||
+		    djdev->dj_receiver_dev->type == recvr_type_mouse_only)
 			rdcat(rdesc, &rsize, mse_high_res_descriptor,
 			      sizeof(mse_high_res_descriptor));
 		else if (djdev->dj_receiver_dev->type == recvr_type_27mhz)
@@ -1573,15 +1580,19 @@ static int logi_dj_raw_event(struct hid_device *hdev,
 			data[0] = data[1];
 			data[1] = 0;
 		}
-		/* The 27 MHz mouse-only receiver sends unnumbered mouse data */
+		/*
+		 * Mouse-only receivers send unnumbered mouse data. The 27 MHz
+		 * receiver uses 6 byte packets, the nano receiver 8 bytes.
+		 */
 		if (djrcv_dev->unnumbered_application == HID_GD_MOUSE &&
-		    size == 6) {
-			u8 mouse_report[7];
+		    size <= 8) {
+			u8 mouse_report[9];
 
 			/* Prepend report id */
 			mouse_report[0] = REPORT_TYPE_MOUSE;
-			memcpy(mouse_report + 1, data, 6);
-			logi_dj_recv_forward_input_report(hdev, mouse_report, 7);
+			memcpy(mouse_report + 1, data, size);
+			logi_dj_recv_forward_input_report(hdev, mouse_report,
+							  size + 1);
 		}
 
 		return false;
@@ -1652,6 +1663,7 @@ static int logi_dj_probe(struct hid_device *hdev,
 	case recvr_type_dj:		no_dj_interfaces = 3; break;
 	case recvr_type_hidpp:		no_dj_interfaces = 2; break;
 	case recvr_type_gaming_hidpp:	no_dj_interfaces = 3; break;
+	case recvr_type_mouse_only:	no_dj_interfaces = 2; break;
 	case recvr_type_27mhz:		no_dj_interfaces = 2; break;
 	case recvr_type_bluetooth:	no_dj_interfaces = 2; break;
 	}
@@ -1825,10 +1837,10 @@ static const struct hid_device_id logi_dj_receivers[] = {
 	{HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
 		USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2),
 	 .driver_data = recvr_type_dj},
-	{ /* Logitech Nano (non DJ) receiver */
+	{ /* Logitech Nano mouse only receiver */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
 			 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER),
-	 .driver_data = recvr_type_hidpp},
+	 .driver_data = recvr_type_mouse_only},
 	{ /* Logitech Nano (non DJ) receiver */
 	  HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
 			 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_2),
-- 
2.19.2


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

* Re: [PATCH 0/4] few reverts and fixes for 5.2
  2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
                   ` (3 preceding siblings ...)
  2019-06-05 12:44 ` [PATCH 4/4] HID: logitech-dj: Fix 064d:c52f receiver support Benjamin Tissoires
@ 2019-06-05 13:07 ` Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2019-06-05 13:07 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Hans de Goede, Dave Hansen, Kai-Heng Feng, linux-input, linux-kernel

On Wed, 5 Jun 2019, Benjamin Tissoires wrote:

> This has been already publicly discussed here, so I am just posting
> for completeness.
> 
> patch 1:
> request to revert it:
> https://patchwork.kernel.org/patch/10844177/#22651385
> 
> patch 2&3:
> related thread:
> https://lkml.org/lkml/2019/5/28/778
> 
> patch 4:
> bug link: https://bugzilla.kernel.org/show_bug.cgi?id=203619
> and related thread: https://lkml.org/lkml/2019/5/28/778
> 
> Cheers,
> Benjamin
> 
> Benjamin Tissoires (3):
>   Revert "HID: Increase maximum report size allowed by
>     hid_field_extract()"
>   Revert "HID: core: Do not call request_module() in async context"
>   Revert "HID: core: Call request_module before doing device_add"
> 
> Hans de Goede (1):
>   HID: logitech-dj: Fix 064d:c52f receiver support

For the set:

Acked-by: Jiri Kosina <jkosina@suse.cz>

Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2019-06-05 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 12:44 [PATCH 0/4] few reverts and fixes for 5.2 Benjamin Tissoires
2019-06-05 12:44 ` [PATCH 1/4] Revert "HID: Increase maximum report size allowed by hid_field_extract()" Benjamin Tissoires
2019-06-05 12:44 ` [PATCH 2/4] Revert "HID: core: Do not call request_module() in async context" Benjamin Tissoires
2019-06-05 12:44 ` [PATCH 3/4] Revert "HID: core: Call request_module before doing device_add" Benjamin Tissoires
2019-06-05 12:44 ` [PATCH 4/4] HID: logitech-dj: Fix 064d:c52f receiver support Benjamin Tissoires
2019-06-05 13:07 ` [PATCH 0/4] few reverts and fixes for 5.2 Jiri Kosina

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).