few reverts and fixes for 5.2
Subsystems (3)
cover few reverts and fixes for 5.2
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(-)
Signature · 1 line
2.19.2
PATCH 1/4 Revert "HID: Increase maximum report size allowed by hid_field_extract()"
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.
--- drivers/hid/hid-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-core.c +3 -3
@@ -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);
Signature · 1 line
2.19.2
PATCH 2/4 Revert "HID: core: Do not call request_module() in async context"
In reply to Benjamin TissoiresThis 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.
--- drivers/hid/hid-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hid/hid-core.c +2 -4
@@ -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);
Signature · 1 line
2.19.2
PATCH 3/4 Revert "HID: core: Call request_module before doing device_add"
In reply to Benjamin TissoiresThis 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.
--- drivers/hid/hid-core.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/hid/hid-core.c +0 -8
@@ -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)
Signature · 1 line
2.19.2
PATCH 4/4 HID: logitech-dj: Fix 064d:c52f receiver support
In reply to Benjamin TissoiresFrom: Hans de Goede <[email protected]>
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)
--- drivers/hid/hid-logitech-dj.c | 42 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-)
drivers/hid/hid-logitech-dj.c +27 -15
@@ -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),
Signature · 1 line
2.19.2
Quoted 18 lines · 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/#22651385patch 2&3:
related thread:
https://lkml.org/lkml/2019/5/28/778patch 4:
bug link: https://bugzilla.kernel.org/show_bug.cgi?id=203619
and related thread: https://lkml.org/lkml/2019/5/28/778Cheers,
Benjamin
Quoted 8 lines
Benjamin Tissoires (3):
Revert "HID: Increase maximum report size allowed by
hid_field_extract()"
Revert "HID: core: Do not callrequest_module()in async context" Revert "HID: core: Callrequest_modulebefore doingdevice_add"Hans de Goede (1):
HID: logitech-dj: Fix 064d:c52f receiver support
For the set:
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs