From patchwork Sat Apr 20 19:19:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Auerochs X-Patchwork-Id: 10910401 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E60431515 for ; Sat, 20 Apr 2019 19:19:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCE6328113 for ; Sat, 20 Apr 2019 19:19:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6F5228474; Sat, 20 Apr 2019 19:19:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D35428113 for ; Sat, 20 Apr 2019 19:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbfDTTT4 (ORCPT ); Sat, 20 Apr 2019 15:19:56 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43382 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfDTTT4 (ORCPT ); Sat, 20 Apr 2019 15:19:56 -0400 Received: by mail-wr1-f68.google.com with SMTP id k17so10850005wrx.10 for ; Sat, 20 Apr 2019 12:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lwkiUFT5ehvwrFu294rJXu3E7QdIH0PRdzsSqkaO1C4=; b=FCmfWhjcjfLWOShDFJAPUyjAnPG7eA57c0dc4fSelxLWxUu1xkabSKcj47yf7ritar UY9q9srWAybz4BXq3Mm/ybJ02LUhetIrU8xBiSPzd3UU0DctzhrfQ3YQIoF5wZVHQEIQ AoOMcUt6nksc1oH8opKVdEI1WGD/wCH/56g0J0g4YRyUC7GPReSXpuR3WDVAZBR/e24K qXMV5DNUZe0rDEMRGPIS3ls6CA7CJRWrAjiPt0LQjmFf2RLHjG7YJZHglz4MElbi6RxD y942+nB/tOywS647I/xlEU1BFowD8n6JP0P8c30z3ZargC5X+cG8sA03LOl/KpjoEfhp aJsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lwkiUFT5ehvwrFu294rJXu3E7QdIH0PRdzsSqkaO1C4=; b=bbckku5fkDVPCWIH2PD+HtJydi1iT14/eAra7i/zwb6yArdcYa9v2/AggMMYXqTI9a Ygr2leUIPQeySDgp2Vo0WLVmxt6oIrMfA+Qp+9YfHDK6wWUPalGZbmRE0Sc4Iyp5PWGv tvu/JVfifDK3zf0/A2hgbWF9RwRoQyofOFNU5AyM+BzX4D9GqnOmNbZN8vzbQqacUY/g me3gyBCU+MqqwJSzr/RpEzLsms7sgfp8g8vGozddDA00iZ+bVb8UF/Xzp3pXeZ7kJtYp wxJEhu9PDvXwXRTfooZSzxYPfgczsstOaWiVSHp/NhFt9HnMoiJYV5HANmI26oJgkolw /SsQ== X-Gm-Message-State: APjAAAV6RqAukTzcqR5VqqOVbGHzBsQg8+1QDeyl/OchNu1a/4mgCu6O q7N3DBPwak+r8RRSHFejt9llkASB X-Google-Smtp-Source: APXvYqz18mAbxuxuP2waAkXdi5mq8CpnzsgTbSF/IRtZ7kEQba6U0jT4ssbsec3s9mEa0u9E2DutCw== X-Received: by 2002:a5d:6b04:: with SMTP id v4mr6115133wrw.69.1555787994133; Sat, 20 Apr 2019 12:19:54 -0700 (PDT) Received: from tobias-tablet.localnet (p200300CE97442F0008C7D8392649F16C.dip0.t-ipconnect.de. [2003:ce:9744:2f00:8c7:d839:2649:f16c]) by smtp.gmail.com with ESMTPSA id h9sm6194833wmb.5.2019.04.20.12.19.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 20 Apr 2019 12:19:53 -0700 (PDT) From: Tobias Auerochs To: linux-input@vger.kernel.org Cc: jikos@kernel.org, benjamin.tissoires@redhat.com Subject: [PATCH] HID: Use SET_REPORT request on control endpoint in hid-rmi for Acer Switch 3 and 5 cover keyboards Date: Sat, 20 Apr 2019 21:19:51 +0200 Message-ID: <2931730.Pa2PyE0Qbt@tobias-tablet> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The touchpad on the cover keyboard for the Acer Switch 3 and 5 does not work as-is under Linux. Both devices have the same usb id for the cover keyboard. The kernel correctly assigns the hid-rmi driver to the device using usbhid for transport. Any attempts of hid-rmi to talk to the device using hid_hw_output_report fail however as usbhid does not have a working urbout due to the lack of any out endpoints. Looking through Wireshark usbmon recordings from the Windows Synaptics driver for this computer running inside of QEMU shows that it should be using SET_REPORT requests instead. This replaces the hid_hw_output_report in hid-rmi with a hid_hw_raw_request for this device, which is at least enough to enable the kernel to get working multi-touch input. Signed-off-by: Tobias Auerochs diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b6d93f4ad037..3fc369477d52 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1083,6 +1083,7 @@ #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 +#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7 #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047 #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855 diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 9e33165250a3..34465a7c3713 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -39,6 +39,7 @@ /* device flags */ #define RMI_DEVICE BIT(0) #define RMI_DEVICE_HAS_PHYS_BUTTONS BIT(1) +#define RMI_DEVICE_OUTPUT_SET_REPORT BIT(2) /* * retrieve the ctrl registers @@ -167,9 +168,19 @@ static int rmi_set_mode(struct hid_device *hdev, u8 mode) static int rmi_write_report(struct hid_device *hdev, u8 *report, int len) { + struct rmi_data *data = hid_get_drvdata(hdev); int ret; - ret = hid_hw_output_report(hdev, (void *)report, len); + if (data->device_flags & RMI_DEVICE_OUTPUT_SET_REPORT) { + /* + * Talk to device by using SET_REPORT requests instead. + */ + ret = hid_hw_raw_request(hdev, report[0], report, + len, HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); + } else { + ret = hid_hw_output_report(hdev, (void *)report, len); + } + if (ret < 0) { dev_err(&hdev->dev, "failed to write hid report (%d)\n", ret); return ret; @@ -751,6 +762,8 @@ static const struct hid_device_id rmi_id[] = { .driver_data = RMI_DEVICE_HAS_PHYS_BUTTONS }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_REZEL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5), + .driver_data = RMI_DEVICE_OUTPUT_SET_REPORT }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_RMI, HID_ANY_ID, HID_ANY_ID) }, { } };