HID: logitech-dj: Fix Dinovo Mini when paired with a MX5x00 receiver

Some users are pairing the Dinovo keyboards with the MX5000 or MX5500
receivers, instead of with the Dinovo receivers. The receivers are
mostly the same (and the air protocol obviously is compatible) but
currently the Dinovo receivers are handled by hid-lg.c while the
MX5x00 receivers are handled by logitech-dj.c.

When using a Dinovo keyboard, with its builtin touchpad, through
logitech-dj.c then the touchpad stops working because when asking the
receiver for paired devices, we get only 1 paired device with
a device_type of REPORT_TYPE_KEYBOARD. And since we don't see a paired
mouse, we have nowhere to send mouse-events to, so we drop them.

Extend the existing fix for the Dinovo Edge for this to also cover the
Dinovo Mini keyboard and also add a mapping to logitech-hidpp for the
Media key on the Dinovo Mini, so that that keeps working too.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1811424
Fixes: f2113c3020ef ("HID: logitech-dj: add support for Logitech Bluetooth Mini-Receiver")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

authored by Hans de Goede and committed by Benjamin Tissoires b4c00e79 eec231e0

Changed files
+26
drivers
+1
drivers/hid/hid-logitech-dj.c
··· 875 875 */ 876 876 static const u16 kbd_builtin_touchpad_ids[] = { 877 877 0xb309, /* Dinovo Edge */ 878 + 0xb30c, /* Dinovo Mini */ 878 879 }; 879 880 880 881 static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev,
+25
drivers/hid/hid-logitech-hidpp.c
··· 93 93 #define HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS BIT(3) 94 94 #define HIDPP_CAPABILITY_BATTERY_VOLTAGE BIT(4) 95 95 96 + #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) 97 + 96 98 /* 97 99 * There are two hidpp protocols in use, the first version hidpp10 is known 98 100 * as register access protocol or RAP, the second version hidpp20 is known as ··· 2953 2951 } 2954 2952 2955 2953 /* -------------------------------------------------------------------------- */ 2954 + /* Logitech Dinovo Mini keyboard with builtin touchpad */ 2955 + /* -------------------------------------------------------------------------- */ 2956 + #define DINOVO_MINI_PRODUCT_ID 0xb30c 2957 + 2958 + static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi, 2959 + struct hid_field *field, struct hid_usage *usage, 2960 + unsigned long **bit, int *max) 2961 + { 2962 + if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) 2963 + return 0; 2964 + 2965 + switch (usage->hid & HID_USAGE) { 2966 + case 0x00d: lg_map_key_clear(KEY_MEDIA); break; 2967 + default: 2968 + return 0; 2969 + } 2970 + return 1; 2971 + } 2972 + 2973 + /* -------------------------------------------------------------------------- */ 2956 2974 /* HID++1.0 devices which use HID++ reports for their wheels */ 2957 2975 /* -------------------------------------------------------------------------- */ 2958 2976 static int hidpp10_wheel_connect(struct hidpp_device *hidpp) ··· 3206 3184 else if (hidpp->quirks & HIDPP_QUIRK_CLASS_M560 && 3207 3185 field->application != HID_GD_MOUSE) 3208 3186 return m560_input_mapping(hdev, hi, field, usage, bit, max); 3187 + 3188 + if (hdev->product == DINOVO_MINI_PRODUCT_ID) 3189 + return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max); 3209 3190 3210 3191 return 0; 3211 3192 }