hid-cougar.c (03ab8e6297acd1bc0eedaa050e2a1635c576fd11) | hid-cougar.c (a6e9c391d45b5865b61e569146304cff72821a5d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * HID driver for Cougar 500k Gaming Keyboard 4 * 5 * Copyright (c) 2018 Daniel M. Lambea <dmlambea@gmail.com> 6 */ 7 8#include <linux/hid.h> --- 92 unchanged lines hidden (view full) --- 101} 102 103/* 104 * Constant-friendly rdesc fixup for mouse interface 105 */ 106static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, 107 unsigned int *rsize) 108{ | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * HID driver for Cougar 500k Gaming Keyboard 4 * 5 * Copyright (c) 2018 Daniel M. Lambea <dmlambea@gmail.com> 6 */ 7 8#include <linux/hid.h> --- 92 unchanged lines hidden (view full) --- 101} 102 103/* 104 * Constant-friendly rdesc fixup for mouse interface 105 */ 106static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, 107 unsigned int *rsize) 108{ |
109 if (rdesc[2] == 0x09 && rdesc[3] == 0x02 && | 109 if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 && |
110 (rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) { 111 hid_info(hdev, 112 "usage count exceeds max: fixing up report descriptor\n"); 113 rdesc[115] = ((HID_MAX_USAGES-1) & 0xff); 114 rdesc[116] = ((HID_MAX_USAGES-1) >> 8); 115 } 116 return rdesc; 117} --- 224 unchanged lines hidden --- | 110 (rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) { 111 hid_info(hdev, 112 "usage count exceeds max: fixing up report descriptor\n"); 113 rdesc[115] = ((HID_MAX_USAGES-1) & 0xff); 114 rdesc[116] = ((HID_MAX_USAGES-1) >> 8); 115 } 116 return rdesc; 117} --- 224 unchanged lines hidden --- |