Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1239540pxu; Mon, 23 Nov 2020 15:39:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJy96A+ALwNs0emanm3ChLB5EJSkgejrLoSgI+5nR9J01Xfeu4aopuiQepV2YpXw/1KF8TZX X-Received: by 2002:a17:906:394:: with SMTP id b20mr1890764eja.143.1606174747839; Mon, 23 Nov 2020 15:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174747; cv=none; d=google.com; s=arc-20160816; b=eE8DKNgLiqsju/YnuKc9qy33/Z4YJPlclZ8Ax71JouNDZzmorH72MQcsC1eLSeen+8 3S8JpoGvAS4xQhcDF2Ay90I3SxNMD8r7i2vygyJYfHwNyADDgKvx93veAzPQE1CBmG/Z mhMALXZTT+LjOsjZ4jNKaoUL4qwUMDPPet8wRGQuvEiCW44sMFaFqX+uH7EinDV7c/Yf WsZSzcZsL52I7g2SKO7qRg0/o+7/g0PHQrHXL88TN7L/RoL3awAKh3pjswfm19QpRszA /d/mW0tIaw25j+HJ6Rczw0AIULcbYbkWIGHvrehf1VgRWs+UPXi6EL6ADf3GV1usyBi6 xFZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BH9Jv0FjyXy/JZ/vms15zUzLOkCc8pkE+lDF9OJWE4U=; b=ydgNtDyDF/b+yaGCNez50w68rlsaapajDKF7LZmpQKUckR1+igW2bTFLnhhJYM+bSY vC3EDvuBlE/8cUefjlW0yZ8zFVjLnsx1dfSVP1Jfi47iOMSQKJuIMm9cAQhuf2mz0dU7 4s1vKilBG69vHDVxbpnmZuQQ0CS1EdAAVCfOl+g3FUInLBBH8ZJNyhDX0n6bmWEc8HFd TozsBFlPnxcGdJnOc5Zsem8Gi6ib+rHsOb3dBRRPLRHqxnwmlpOb3Y3Lt4D3cTkWRpka QCIi6Pq7P2rxKPkDKf2LW/i01mzvl2Czb90H9e26hj/AX6lgFfEJ+yEFGidGrFput5Sp MtyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nsQ1Fifw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs22si1996292ejc.3.2020.11.23.15.38.45; Mon, 23 Nov 2020 15:39:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nsQ1Fifw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732238AbgKWMjW (ORCPT + 99 others); Mon, 23 Nov 2020 07:39:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:51522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732137AbgKWMiw (ORCPT ); Mon, 23 Nov 2020 07:38:52 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59CA82065E; Mon, 23 Nov 2020 12:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135131; bh=XIhCtibTz5EAmi93u71+j1Y10D/sRsNnUjTBMRyTU+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nsQ1Fifwgieqspq7HEOw2eAmLoLFRqwsQCPpWp6SMAIJA5n1IE4KU3ortlQ0ZXh2C s/VM1QiPEJSMVH4wtu5Wjky2Mq95z/W5WZiJFTBlDwujNNCIiqrIuGn92R0gzDbypO glOxO/6NfjfuSMKQ70FKE+AFnj34OWvKLdp8ZPj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.4 115/158] HID: logitech-dj: Fix Dinovo Mini when paired with a MX5x00 receiver Date: Mon, 23 Nov 2020 13:22:23 +0100 Message-Id: <20201123121825.488168996@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit b4c00e7976636f33a4f67eab436a11666c8afd60 ] Some users are pairing the Dinovo keyboards with the MX5000 or MX5500 receivers, instead of with the Dinovo receivers. The receivers are mostly the same (and the air protocol obviously is compatible) but currently the Dinovo receivers are handled by hid-lg.c while the MX5x00 receivers are handled by logitech-dj.c. When using a Dinovo keyboard, with its builtin touchpad, through logitech-dj.c then the touchpad stops working because when asking the receiver for paired devices, we get only 1 paired device with a device_type of REPORT_TYPE_KEYBOARD. And since we don't see a paired mouse, we have nowhere to send mouse-events to, so we drop them. Extend the existing fix for the Dinovo Edge for this to also cover the Dinovo Mini keyboard and also add a mapping to logitech-hidpp for the Media key on the Dinovo Mini, so that that keeps working too. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1811424 Fixes: f2113c3020ef ("HID: logitech-dj: add support for Logitech Bluetooth Mini-Receiver") Signed-off-by: Hans de Goede Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin --- drivers/hid/hid-logitech-dj.c | 1 + drivers/hid/hid-logitech-hidpp.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 32e5391d98c35..309e5df463d5c 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -875,6 +875,7 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev, */ static const u16 kbd_builtin_touchpad_ids[] = { 0xb309, /* Dinovo Edge */ + 0xb30c, /* Dinovo Mini */ }; static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev, diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index c85070d631da5..e49d36de07968 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -88,6 +88,8 @@ MODULE_PARM_DESC(disable_tap_to_click, #define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2) #define HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS BIT(3) +#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) + /* * There are two hidpp protocols in use, the first version hidpp10 is known * as register access protocol or RAP, the second version hidpp20 is known as @@ -2768,6 +2770,26 @@ static int g920_get_config(struct hidpp_device *hidpp, return g920_ff_set_autocenter(hidpp, data); } +/* -------------------------------------------------------------------------- */ +/* Logitech Dinovo Mini keyboard with builtin touchpad */ +/* -------------------------------------------------------------------------- */ +#define DINOVO_MINI_PRODUCT_ID 0xb30c + +static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi, + struct hid_field *field, struct hid_usage *usage, + unsigned long **bit, int *max) +{ + if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) + return 0; + + switch (usage->hid & HID_USAGE) { + case 0x00d: lg_map_key_clear(KEY_MEDIA); break; + default: + return 0; + } + return 1; +} + /* -------------------------------------------------------------------------- */ /* HID++1.0 devices which use HID++ reports for their wheels */ /* -------------------------------------------------------------------------- */ @@ -3003,6 +3025,9 @@ static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, field->application != HID_GD_MOUSE) return m560_input_mapping(hdev, hi, field, usage, bit, max); + if (hdev->product == DINOVO_MINI_PRODUCT_ID) + return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max); + return 0; } -- 2.27.0