Skip to content

Commit 5d9374c

Browse files
patrakovJiri Kosina
authored andcommitted
HID: input: ignore the battery in OKLICK Laser BTmouse
This mouse, when asked about the battery, ceases to report movements and clicks. So just don't ask. Signed-off-by: Alexander E. Patrakov <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent e470127 commit 5d9374c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/hid/hid-input.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ static enum power_supply_property hidinput_battery_props[] = {
303303

304304
#define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */
305305
#define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */
306+
#define HID_BATTERY_QUIRK_IGNORE (1 << 2) /* completely ignore the battery */
306307

307308
static const struct hid_device_id hid_battery_quirks[] = {
308309
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
@@ -320,6 +321,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
320321
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
321322
USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
322323
HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
324+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
325+
USB_DEVICE_ID_ELECOM_BM084),
326+
HID_BATTERY_QUIRK_IGNORE },
323327
{}
324328
};
325329

@@ -408,6 +412,14 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
408412
if (dev->battery != NULL)
409413
goto out; /* already initialized? */
410414

415+
quirks = find_battery_quirk(dev);
416+
417+
hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
418+
dev->bus, dev->vendor, dev->product, dev->version, quirks);
419+
420+
if (quirks & HID_BATTERY_QUIRK_IGNORE)
421+
goto out;
422+
411423
psy_desc = kzalloc(sizeof(*psy_desc), GFP_KERNEL);
412424
if (psy_desc == NULL)
413425
goto out;
@@ -424,11 +436,6 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
424436
psy_desc->use_for_apm = 0;
425437
psy_desc->get_property = hidinput_get_battery_property;
426438

427-
quirks = find_battery_quirk(dev);
428-
429-
hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
430-
dev->bus, dev->vendor, dev->product, dev->version, quirks);
431-
432439
min = field->logical_minimum;
433440
max = field->logical_maximum;
434441

0 commit comments

Comments
 (0)