Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d9374cf authored by Alexander E. Patrakov's avatar Alexander E. Patrakov Committed by Jiri Kosina
Browse files

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: default avatarAlexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e470127e
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ static enum power_supply_property hidinput_battery_props[] = {

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

static const struct hid_device_id hid_battery_quirks[] = {
	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
@@ -320,6 +321,9 @@ static const struct hid_device_id hid_battery_quirks[] = {
	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
		USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,
		USB_DEVICE_ID_ELECOM_BM084),
	  HID_BATTERY_QUIRK_IGNORE },
	{}
};

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

	quirks = find_battery_quirk(dev);

	hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
		dev->bus, dev->vendor, dev->product, dev->version, quirks);

	if (quirks & HID_BATTERY_QUIRK_IGNORE)
		goto out;

	psy_desc = kzalloc(sizeof(*psy_desc), GFP_KERNEL);
	if (psy_desc == NULL)
		goto out;
@@ -424,11 +436,6 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
	psy_desc->use_for_apm = 0;
	psy_desc->get_property = hidinput_get_battery_property;

	quirks = find_battery_quirk(dev);

	hid_dbg(dev, "device %x:%x:%x %d quirks %d\n",
		dev->bus, dev->vendor, dev->product, dev->version, quirks);

	min = field->logical_minimum;
	max = field->logical_maximum;