Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-6.6/logitech' into for-linus

Various new device ID addition and a couple of HID++
fixes to tackle the last few opened bugs (Nikita Zhandarovich
and Benjamin Tissoires)

+97 -49
+1
drivers/hid/hid-ids.h
··· 867 867 #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_2 0xc534 868 868 #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1 0xc539 869 869 #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_1 0xc53f 870 + #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_2 0xc547 870 871 #define USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_POWERPLAY 0xc53a 871 872 #define USB_DEVICE_ID_SPACETRAVELLER 0xc623 872 873 #define USB_DEVICE_ID_SPACENAVIGATOR 0xc626
+12 -4
drivers/hid/hid-logitech-dj.c
··· 1285 1285 * 50 msec should gives enough time to the receiver to be ready. 1286 1286 */ 1287 1287 msleep(50); 1288 + 1289 + if (retval) 1290 + return retval; 1288 1291 } 1289 1292 1290 1293 /* ··· 1309 1306 buf[5] = 0x09; 1310 1307 buf[6] = 0x00; 1311 1308 1312 - hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf, 1309 + retval = hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf, 1313 1310 HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT, 1314 1311 HID_REQ_SET_REPORT); 1315 1312 ··· 1695 1692 } 1696 1693 /* 1697 1694 * Mouse-only receivers send unnumbered mouse data. The 27 MHz 1698 - * receiver uses 6 byte packets, the nano receiver 8 bytes. 1695 + * receiver uses 6 byte packets, the nano receiver 8 bytes, 1696 + * the lightspeed receiver (Pro X Superlight) 13 bytes. 1699 1697 */ 1700 1698 if (djrcv_dev->unnumbered_application == HID_GD_MOUSE && 1701 - size <= 8) { 1702 - u8 mouse_report[9]; 1699 + size <= 13){ 1700 + u8 mouse_report[14]; 1703 1701 1704 1702 /* Prepend report id */ 1705 1703 mouse_report[0] = REPORT_TYPE_MOUSE; ··· 1983 1979 { /* Logitech lightspeed receiver (0xc53f) */ 1984 1980 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 1985 1981 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_1), 1982 + .driver_data = recvr_type_gaming_hidpp}, 1983 + { /* Logitech lightspeed receiver (0xc547) */ 1984 + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 1985 + USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_2), 1986 1986 .driver_data = recvr_type_gaming_hidpp}, 1987 1987 1988 1988 { /* Logitech 27 MHz HID++ 1.0 receiver (0xc513) */
+84 -45
drivers/hid/hid-logitech-hidpp.c
··· 228 228 #define HIDPP20_ERROR_INVALID_ARGS 0x02 229 229 #define HIDPP20_ERROR_OUT_OF_RANGE 0x03 230 230 #define HIDPP20_ERROR_HW_ERROR 0x04 231 - #define HIDPP20_ERROR_LOGITECH_INTERNAL 0x05 231 + #define HIDPP20_ERROR_NOT_ALLOWED 0x05 232 232 #define HIDPP20_ERROR_INVALID_FEATURE_INDEX 0x06 233 233 #define HIDPP20_ERROR_INVALID_FUNCTION_ID 0x07 234 234 #define HIDPP20_ERROR_BUSY 0x08 ··· 275 275 } 276 276 277 277 /* 278 - * hidpp_send_message_sync() returns 0 in case of success, and something else 279 - * in case of a failure. 280 - * - If ' something else' is positive, that means that an error has been raised 281 - * by the protocol itself. 282 - * - If ' something else' is negative, that means that we had a classic error 283 - * (-ENOMEM, -EPIPE, etc...) 278 + * Effectively send the message to the device, waiting for its answer. 279 + * 280 + * Must be called with hidpp->send_mutex locked 281 + * 282 + * Same return protocol than hidpp_send_message_sync(): 283 + * - success on 0 284 + * - negative error means transport error 285 + * - positive value means protocol error 284 286 */ 285 - static int hidpp_send_message_sync(struct hidpp_device *hidpp, 287 + static int __do_hidpp_send_message_sync(struct hidpp_device *hidpp, 286 288 struct hidpp_report *message, 287 289 struct hidpp_report *response) 288 290 { 289 - int ret = -1; 290 - int max_retries = 3; 291 + int ret; 291 292 292 - mutex_lock(&hidpp->send_mutex); 293 + __must_hold(&hidpp->send_mutex); 293 294 294 295 hidpp->send_receive_buf = response; 295 296 hidpp->answer_available = false; ··· 301 300 */ 302 301 *response = *message; 303 302 304 - for (; max_retries != 0 && ret; max_retries--) { 305 - ret = __hidpp_send_report(hidpp->hid_dev, message); 306 - 307 - if (ret) { 308 - dbg_hid("__hidpp_send_report returned err: %d\n", ret); 309 - memset(response, 0, sizeof(struct hidpp_report)); 310 - break; 311 - } 312 - 313 - if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, 314 - 5*HZ)) { 315 - dbg_hid("%s:timeout waiting for response\n", __func__); 316 - memset(response, 0, sizeof(struct hidpp_report)); 317 - ret = -ETIMEDOUT; 318 - break; 319 - } 320 - 321 - if (response->report_id == REPORT_ID_HIDPP_SHORT && 322 - response->rap.sub_id == HIDPP_ERROR) { 323 - ret = response->rap.params[1]; 324 - dbg_hid("%s:got hidpp error %02X\n", __func__, ret); 325 - break; 326 - } 327 - 328 - if ((response->report_id == REPORT_ID_HIDPP_LONG || 329 - response->report_id == REPORT_ID_HIDPP_VERY_LONG) && 330 - response->fap.feature_index == HIDPP20_ERROR) { 331 - ret = response->fap.params[1]; 332 - if (ret != HIDPP20_ERROR_BUSY) { 333 - dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret); 334 - break; 335 - } 336 - dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret); 337 - } 303 + ret = __hidpp_send_report(hidpp->hid_dev, message); 304 + if (ret) { 305 + dbg_hid("__hidpp_send_report returned err: %d\n", ret); 306 + memset(response, 0, sizeof(struct hidpp_report)); 307 + return ret; 338 308 } 309 + 310 + if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, 311 + 5*HZ)) { 312 + dbg_hid("%s:timeout waiting for response\n", __func__); 313 + memset(response, 0, sizeof(struct hidpp_report)); 314 + return -ETIMEDOUT; 315 + } 316 + 317 + if (response->report_id == REPORT_ID_HIDPP_SHORT && 318 + response->rap.sub_id == HIDPP_ERROR) { 319 + ret = response->rap.params[1]; 320 + dbg_hid("%s:got hidpp error %02X\n", __func__, ret); 321 + return ret; 322 + } 323 + 324 + if ((response->report_id == REPORT_ID_HIDPP_LONG || 325 + response->report_id == REPORT_ID_HIDPP_VERY_LONG) && 326 + response->fap.feature_index == HIDPP20_ERROR) { 327 + ret = response->fap.params[1]; 328 + dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret); 329 + return ret; 330 + } 331 + 332 + return 0; 333 + } 334 + 335 + /* 336 + * hidpp_send_message_sync() returns 0 in case of success, and something else 337 + * in case of a failure. 338 + * 339 + * See __do_hidpp_send_message_sync() for a detailed explanation of the returned 340 + * value. 341 + */ 342 + static int hidpp_send_message_sync(struct hidpp_device *hidpp, 343 + struct hidpp_report *message, 344 + struct hidpp_report *response) 345 + { 346 + int ret; 347 + int max_retries = 3; 348 + 349 + mutex_lock(&hidpp->send_mutex); 350 + 351 + do { 352 + ret = __do_hidpp_send_message_sync(hidpp, message, response); 353 + if (ret != HIDPP20_ERROR_BUSY) 354 + break; 355 + 356 + dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret); 357 + } while (--max_retries); 339 358 340 359 mutex_unlock(&hidpp->send_mutex); 341 360 return ret; 342 361 343 362 } 344 363 364 + /* 365 + * hidpp_send_fap_command_sync() returns 0 in case of success, and something else 366 + * in case of a failure. 367 + * 368 + * See __do_hidpp_send_message_sync() for a detailed explanation of the returned 369 + * value. 370 + */ 345 371 static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp, 346 372 u8 feat_index, u8 funcindex_clientid, u8 *params, int param_count, 347 373 struct hidpp_report *response) ··· 401 373 return ret; 402 374 } 403 375 376 + /* 377 + * hidpp_send_rap_command_sync() returns 0 in case of success, and something else 378 + * in case of a failure. 379 + * 380 + * See __do_hidpp_send_message_sync() for a detailed explanation of the returned 381 + * value. 382 + */ 404 383 static int hidpp_send_rap_command_sync(struct hidpp_device *hidpp_dev, 405 384 u8 report_id, u8 sub_id, u8 reg_address, u8 *params, int param_count, 406 385 struct hidpp_report *response) ··· 4655 4620 .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS }, 4656 4621 { /* Logitech G Pro Gaming Mouse over USB */ 4657 4622 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) }, 4623 + { /* Logitech G Pro X Superlight Gaming Mouse over USB */ 4624 + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC094) }, 4658 4625 4659 4626 { /* G935 Gaming Headset */ 4660 4627 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0x0a87), ··· 4684 4647 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb02a) }, 4685 4648 { /* MX Master 3 mouse over Bluetooth */ 4686 4649 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb023) }, 4650 + { /* MX Anywhere 3 mouse over Bluetooth */ 4651 + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb025) }, 4687 4652 { /* MX Master 3S mouse over Bluetooth */ 4688 4653 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb034) }, 4689 4654 {}