From patchwork Mon Dec 14 12:42:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Patrakov X-Patchwork-Id: 7844121 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D18019F3CD for ; Mon, 14 Dec 2015 12:42:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0218B203C3 for ; Mon, 14 Dec 2015 12:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17B8D20304 for ; Mon, 14 Dec 2015 12:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbbLNMmy (ORCPT ); Mon, 14 Dec 2015 07:42:54 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:33747 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbbLNMmw (ORCPT ); Mon, 14 Dec 2015 07:42:52 -0500 Received: by mail-wm0-f51.google.com with SMTP id n186so43810666wmn.0 for ; Mon, 14 Dec 2015 04:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=PNshrs0Yxh4PzsZEMqsZ6FzaqLvo6h+IBudGWB85xoQ=; b=LWZTXnlr+RSkjT3wwTSF13pN+ZTGqxg6qK4bsD/qatvXIw6K3xSrJjD8j9fpP3iM+V aNZW/xnyKaG+oVKWrxYRcgtmHgpvx8rferHdzRQr1KLTfLbYtuHwKIwjS10/pMHK7MFK 2q73KTvzL2W777MWB1jRrQBxeNB9QwO5cST9/40IH/N+48YfP8S6CD02SBSMLB/GVGmD uNY1h6AUp/qLotzyC6CaIIHRrqdB686vij7plLUfRHkt7pCFvEY5jj0E4lXwOeKMc12V 4UFV4eJ4JOYQ7bmAhGd5xYdQoO8q7x72e9D43M3tnM52W174ZmBO8dflo+/H7T15M9fQ UNaA== X-Received: by 10.194.88.10 with SMTP id bc10mr2675890wjb.49.1450096971675; Mon, 14 Dec 2015 04:42:51 -0800 (PST) Received: from localhost.localdomain ([2001:470:28:8b0:96de:80ff:fe6f:9ad4]) by smtp.gmail.com with ESMTPSA id h5sm29598582wjz.21.2015.12.14.04.42.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Dec 2015 04:42:50 -0800 (PST) From: "Alexander E. Patrakov" To: Jiri Kosina Cc: linux-input@vger.kernel.org, "Alexander E. Patrakov" Subject: [PATCH] hid-input: ignore the battery in OKLICK Laser BTmouse Date: Mon, 14 Dec 2015 17:42:26 +0500 Message-Id: <1450096946-1376-1-git-send-email-patrakov@gmail.com> X-Mailer: git-send-email 2.6.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This mouse, when asked about the battery, ceases to report movements and clicks. So just don't ask. Signed-off-by: Alexander E. Patrakov --- drivers/hid/hid-input.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 2ba6bf6..0869fae 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -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;