Skip to contentSkip to conversation

HID: logitech-dj: allow mice to use all types of reports

PATCH Superseded Yaraslau Furman 3 participants 11 messages Jan 28, 2024 – Apr 3, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: logitech-dj: allow mice to use all types of reports

You can bind whatever action you want to the mouse's reprogrammable buttons using Windows application. Allow Linux to receive those keycodes.

---
 drivers/hid/hid-logitech-dj.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/hid/hid-logitech-dj.c +4 -6
index e6a8b6d8eab7..5730be1aa41c 100644
@@ -948,11 +948,12 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 				HIDPP_DEVICE_TYPE_MASK;
 	workitem->quad_id_msb = hidpp_report->params[HIDPP_PARAM_EQUAD_MSB];
 	workitem->quad_id_lsb = hidpp_report->params[HIDPP_PARAM_EQUAD_LSB];
+	workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA |
+				POWER_KEYS | MEDIA_CENTER |
+				HIDPP;
+
 	switch (workitem->device_type) {
 	case REPORT_TYPE_KEYBOARD:
-		workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA |
-					       POWER_KEYS | MEDIA_CENTER |
-					       HIDPP;
 		id = (workitem->quad_id_msb << 8) | workitem->quad_id_lsb;
 		for (i = 0; i < ARRAY_SIZE(kbd_builtin_touchpad_ids); i++) {
 			if (id == kbd_builtin_touchpad_ids[i]) {
@@ -965,9 +966,6 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/1 HID: logitech-dj: allow mice to report multimedia keycodes

Multimedia buttons can be bound to the mouse's extra keys in Windows application. Let Linux receive those keycodes.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 1/1 HID: logitech-dj: allow mice to report multimedia keycodes

Multimedia buttons can be bound to the mouse's extra keys in Windows application. Let Linux receive those keycodes.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.43.0
maintainer
#3 lore raw

Re: [PATCH v2] HID: logitech-dj: allow mice to report multimedia keycodes

Quoted 13 lines · Yaraslau Furman

Multimedia buttons can be bound to the mouse's extra keys in Windows application. Let Linux receive those keycodes.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +0 -0
index e6a8b6d8eab7..3c3c497b6b91 100644

drivers/hid/hid-logitech-dj.c static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev, · line 969

Quoted 8 lines
drivers/hid/hid-logitech-dj.c +1 -3
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;

CCing Hans who introduced this explicit check back in 3ed224e273ac ("HID: logitech-dj: Fix 064d:c52f receiver support"). Should it be made device-specific?

Signature · 2 lines
Jiri Kosina
SUSE Labs
Reviewed-by
#4 lore raw

Re: [PATCH v2] HID: logitech-dj: allow mice to report multimedia keycodes

Hi All,

Quoted 19 lines · Jiri Kosina
Quoted 17 lines · Yaraslau Furman

Multimedia buttons can be bound to the mouse's extra keys in Windows application. Let Linux receive those keycodes.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +0 -1
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
Quoted 8 lines

drivers/hid/hid-logitech-dj.c static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev, · line 969

Quoted 4 lines
drivers/hid/hid-logitech-dj.c +1 -2
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;

CCing Hans who introduced this explicit check back in 3ed224e273ac ("HID: logitech-dj: Fix 064d:c52f receiver support"). Should it be made device-specific?

Jiri, thank you for bringing this to my attention. If mice attached to other receivers can send multi-media key presses too, then I believe that dropping the if (djrcv_dev->type == recvr_type_mouse_only) check is fine.

IOW, the patch looks good to me:

Regards,

Hans

#5 lore raw

PATCH v2 1/1 HID: logitech-dj: allow mice to report multimedia keycodes

From: Yaraslau Furman <[email protected]>

So, I think this should work fine for now, but IMO we should see if it's possible to allow the driver to receive all events that a keyboard can send, since Windows application can assign pretty much any keycode to any mouse button (perhaps not the main ones though), and then we might see the same situation again.

I tried doing that on my system but the driver stopped working completely.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.44.0
#6 lore raw

PATCH v2 1/1 HID: logitech-dj: allow mice to report multimedia keycodes

In reply to Hans de Goede

From: Yaraslau Furman <[email protected]>

So, I think this should work fine for now, but IMO we should see if it's possible to allow the driver to receive all events that a keyboard can send, since Windows application can assign pretty much any keycode to any mouse button (perhaps not the main ones though), and then we might see the same situation again.

I tried doing that on my system but the driver stopped working completely.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.44.0
#7 lore raw

Re: [PATCH v2] HID: logitech-dj: allow mice to report multimedia keycodes

Hi Yaroslav,

Quoted 8 lines · Yaroslav Furman

From: Yaraslau Furman <[email protected]>

So, I think this should work fine for now, but IMO we should see if it's possible to allow the driver to receive all events that a keyboard can send, since Windows application can assign pretty much any keycode to any mouse button (perhaps not the main ones though), and then we might see the same situation again.

I tried doing that on my system but the driver stopped working completely.

The actual code change itself looks fine, but the above should have gone into a cover-letter or something like that.

This is not a proper commit message and this is also lacking your Signed-off-by (which you did correctly include in your original version:

https://lore.kernel.org/linux-input/[email protected]/

Please send a v3 with a proper commit-msg + Signed-off-by.

Regards,

Hans

Quoted 19 lines
---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
#8 lore raw

PATCH v3 1/1 HID: logitech-dj: allow mice to use all types of reports

From: Yaraslau Furman <[email protected]>

You can bind whatever action you want to the mouse's reprogrammable buttons using Windows application. Allow Linux to receive multimedia keycodes.

---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
Signature · 1 line
2.44.0
Reviewed-by on v3 1/1
#9 lore raw

Hi,

Quoted 6 lines · Yaroslav Furman

From: Yaraslau Furman <[email protected]>

You can bind whatever action you want to the mouse's reprogrammable buttons using Windows application. Allow Linux to receive multimedia keycodes.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 19 lines
---
 drivers/hid/hid-logitech-dj.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hid/hid-logitech-dj.c +1 -3
index e6a8b6d8eab7..3c3c497b6b91 100644
@@ -965,9 +965,7 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
 		}
 		break;
 	case REPORT_TYPE_MOUSE:
-		workitem->reports_supported |= STD_MOUSE | HIDPP;
-		if (djrcv_dev->type == recvr_type_mouse_only)
-			workitem->reports_supported |= MULTIMEDIA;
+		workitem->reports_supported |= STD_MOUSE | HIDPP | MULTIMEDIA;
 		break;
 	}
 }
maintainer
#10 lore raw
Quoted 10 lines · Hans de Goede
Quoted 6 lines

From: Yaraslau Furman <[email protected]>

You can bind whatever action you want to the mouse's reprogrammable buttons using Windows application. Allow Linux to receive multimedia keycodes.

Thanks, patch looks good to me:

Thanks to both of you. I've added

	Fixes: 3ed224e273ac ("HID: logitech-dj: Fix 064d:c52f receiver support")

and applied.

Signature · 2 lines
Jiri Kosina
SUSE Labs