Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp276884ybp; Thu, 10 Oct 2019 18:01:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuCohRAwZlDBxQDeb06b5wcJfN6PjxidMtdcJA1fCttxn+IF6B5F+SpvtGgeYt5GQ+2VZw X-Received: by 2002:a17:906:684:: with SMTP id u4mr10725935ejb.155.1570755710243; Thu, 10 Oct 2019 18:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570755710; cv=none; d=google.com; s=arc-20160816; b=dH8M5L9o+SG4HvV0r+QJ6Ndu+C1CQ+xVnSGXsPtQj1Jw9YM9WqR1x8ETSv0ol7LJYJ o6Z3t5RD+QPpKbUpENYBT8wm/U/dvKGsQmYqL9PTeTEn1HAskDO8D68464OZaWcoGiv5 yetSqppAwvXBJCzpT2o6PJ/YoK2sVmHBg1LbngcblqqObQkkhhQsKr2SUbjGiaEUFa59 8fhf9Sb66/Giq3bDSX+ApxkmrjxOoSOQkqVvespdxPnSn3CfdO365IOJsAW3PU0y86az IIgWr4QEp/iWbwPlIJbljH7nGAm15L0OMUAbcnWWtGrUpcfLChOH8p5yzWBWQbeScz+A HQ7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:to:dkim-signature :date; bh=40ozhm8SAMu/Ca+SqfeDN4mOkL6t9KC8t8EHDPyCn0c=; b=pnIKDJ3oscN6G9VIKhf1J8lVhEK6SP5C0yfQV6jiGff6UsNDKZtwjn4wpECpV8ITbS uuB7TRBLM0q2LytnldF7Ye/3R/iJewictWgYC08m6OqTeMVLdiSECfw7tOPnMKzyn79E G+1RKC1h8JXLiZoupmP8LirDQip01OkUOK9Up5ySm/+3p3o47Zhk4zBWmm8zjLSPo4B6 9cjidnXOecKd2FeY14VgqHzLYybgPMDF8JwIhWbzK8DjGXazv2f0wo40DLO1dHu70OWL gkVIMykvPcb1RBN+0ER4UOYSk5+YppSOCWK1Tl9g9Z2PzAGJwnf7JB9LKLuVuivQjmkX L0ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=default header.b=xhN0fejB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si4804721edb.57.2019.10.10.18.01.26; Thu, 10 Oct 2019 18:01:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=default header.b=xhN0fejB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbfJKA6D (ORCPT + 99 others); Thu, 10 Oct 2019 20:58:03 -0400 Received: from mail-40130.protonmail.ch ([185.70.40.130]:62324 "EHLO mail-40130.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727584AbfJKA6D (ORCPT ); Thu, 10 Oct 2019 20:58:03 -0400 Date: Fri, 11 Oct 2019 00:57:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1570755479; bh=40ozhm8SAMu/Ca+SqfeDN4mOkL6t9KC8t8EHDPyCn0c=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=xhN0fejB9ReFC1TO16gDyD8ibJaaqJkpZL7gqIM7KlNtHThyiEZm/2iDmzfhbgCwE ahnmLjTCIyc+y/Z552MqBIcL4B0FoaBWaUPQJyIGWA9ZBPAq8v3Xm1EclfMiky1sBg uTX1sbQlY2whmccpqSsNBDgSKPMdTgRYYvKSEPnA= To: "linux-input@vger.kernel.org" From: Mazin Rezk Cc: "benjamin.tissoires@redhat.com" , "jikos@kernel.org" , "linux-kernel@vger.kernel.org" , =?UTF-8?Q?Filipe_La=C3=ADns?= , "mnrzk@protonmail.com" Reply-To: Mazin Rezk Subject: [PATCH v4 4/4] HID: logitech: Support WirelessDeviceStatus connect events Message-ID: Feedback-ID: 18B_FC5q-t32TXzMsVp9BgkgrdNH3iwklfW8WOrHrcxZA0WRj7JodCh5VXKxs6A3OaiHK0QNd8wi3SImKex8yQ==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_REPLYTO autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday, October 5, 2019 9:05 PM, Mazin Rezk wro= te: > This patch makes WirelessDeviceStatus (0x1d4b) events get detected as > connection events on devices with HIDPP_QUIRK_WIRELESS_DEVICE_STATUS. > > This quirk is currently an alias for HIDPP_QUIRK_CLASS_BLUETOOTH since > the added Bluetooth devices do not support regular connect events. No changes have been made to this patch in v4. Signed-off-by: Mazin Rezk --- drivers/hid/hid-logitech-hidpp.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hi= dpp.c index 2062be922c08..b2b5fe2c74db 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -84,6 +84,7 @@ MODULE_PARM_DESC(disable_tap_to_click, /* Just an alias for now, may possibly be a catch-all in the future */ #define HIDPP_QUIRK_MISSING_SHORT_REPORTS=09HIDPP_QUIRK_CLASS_BLUETOOTH +#define HIDPP_QUIRK_WIRELESS_DEVICE_STATUS=09HIDPP_QUIRK_CLASS_BLUETOOTH #define HIDPP_QUIRK_DELAYED_INIT=09=09HIDPP_QUIRK_NO_HIDINPUT @@ -406,9 +407,22 @@ static inline bool hidpp_match_error(struct hidpp_repo= rt *question, =09 (answer->fap.params[0] =3D=3D question->fap.funcindex_clientid); } -static inline bool hidpp_report_is_connect_event(struct hidpp_report *repo= rt) +#define HIDPP_PAGE_WIRELESS_DEVICE_STATUS=09=090x1d4b + +static inline bool hidpp_report_is_connect_event(struct hidpp_device *hidp= p, +=09=09=09=09=09=09 struct hidpp_report *report) { -=09return (report->report_id =3D=3D REPORT_ID_HIDPP_SHORT) && +=09if (hidpp->quirks & HIDPP_QUIRK_WIRELESS_DEVICE_STATUS) { +=09=09/* If feature is invalid, skip array check */ +=09=09if (report->fap.feature_index > hidpp->feature_count) +=09=09=09return false; + +=09=09return (hidpp->features[report->fap.feature_index] =3D=3D +=09=09=09 HIDPP_PAGE_WIRELESS_DEVICE_STATUS); +=09} + +=09return ((report->report_id =3D=3D REPORT_ID_HIDPP_SHORT) || +=09=09(hidpp->quirks & HIDPP_QUIRK_MISSING_SHORT_REPORTS)) && =09=09(report->rap.sub_id =3D=3D 0x41); } @@ -3157,7 +3171,7 @@ static int hidpp_raw_hidpp_event(struct hidpp_device = *hidpp, u8 *data, =09=09} =09} -=09if (unlikely(hidpp_report_is_connect_event(report))) { +=09if (unlikely(hidpp_report_is_connect_event(hidpp, report))) { =09=09atomic_set(&hidpp->connected, =09=09=09=09!(report->rap.params[0] & (1 << 6))); =09=09if (schedule_work(&hidpp->work) =3D=3D 0) -- 2.23.0