From patchwork Thu Apr 11 17:50:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Auerochs X-Patchwork-Id: 10896537 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 B6FD81515 for ; Thu, 11 Apr 2019 17:50:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B45928D62 for ; Thu, 11 Apr 2019 17:50:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89DF428D65; Thu, 11 Apr 2019 17:50:33 +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 CE01928D62 for ; Thu, 11 Apr 2019 17:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726629AbfDKRuc (ORCPT ); Thu, 11 Apr 2019 13:50:32 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43872 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726615AbfDKRuc (ORCPT ); Thu, 11 Apr 2019 13:50:32 -0400 Received: by mail-wr1-f65.google.com with SMTP id k17so3826679wrx.10 for ; Thu, 11 Apr 2019 10:50:30 -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=EFtYq92AerTyiCPc4VtCSo4PidgKFL7UAO/5EEY6Owo=; b=VQtXil0f2XAcmpVC4sEBjHeDDqR9lbku5zTiu1PQW2KyfJRgKgmgHO9gbes9mx11uK +NCoHNi1lOiInoa6yBiPJ8V8s3K53rMz4CPyVaypLyAThIlG+gPVmq9jQy43+mkcjNGn Qq5Bar0Z2R10MFUl8isinKaCDC/y9aFHr1gNRMjbuW15Dt2QbbvyQBT6a5OG9o/qCqmR LmkU+2fV6SfYue//GYyP5+hQ65fXw0fqGqTnpCE+Yr9IGUJAwZWwUwByu4SuynIhzWvJ amGGHN0QAw5iz3KI9AIw5nTIjPws4quUqyWKYXijv4cDem8kXVi6fToNKA4F4orKMEjV 3riA== 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=EFtYq92AerTyiCPc4VtCSo4PidgKFL7UAO/5EEY6Owo=; b=tN7XjgHVz9zC5GcAKmWiXL9pfDMEZ2jrdP/Y6R2XvY0PL0uvCq8odTFknGizH9qJss mZmGDUXYTOb7zej64jk4fpcoy2HHlRnpi58RKFJ21alQx4+yejGu63wcUN80HcfZdERg YgTrFwlAuhAq2jgy5TEUKMy7hvOYUSkNsx6WCGJTUw/FgMLki64DC23t58KNE9Hvzr44 RixO0vPqC+fHY7ZLnPJ3MKPVfKtCSGMURnPWD9iDiePoywR+IkL0jChsj0814yudgkf7 OVNhyqzBio10VpW6ECT+bB0BO8DcmmOyXM+7U1ggPAvmc+4yhBxAJ5h1KTRs0KAaB1ws k89g== X-Gm-Message-State: APjAAAUZA1vvNdlTm/UBECJSbFuFiAfqhIcprH8bpVK/mcqgPhC7HpJF t/90Z0eirspq9cXCiD9NgguQlO68KYs= X-Google-Smtp-Source: APXvYqxA6UDwKR+MIOt2qmXxgOFGqSkXZNkBEjdwUXt1h0bhD9K0SJZoQd9t4tGgXrUww6SynPaNzA== X-Received: by 2002:adf:9dcf:: with SMTP id q15mr12415271wre.205.1555005029370; Thu, 11 Apr 2019 10:50:29 -0700 (PDT) Received: from tobias-tablet.localnet (p200300CE97442F006B02FC91DECEE683.dip0.t-ipconnect.de. [2003:ce:9744:2f00:6b02:fc91:dece:e683]) by smtp.gmail.com with ESMTPSA id f1sm35500240wrt.87.2019.04.11.10.50.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Apr 2019 10:50:28 -0700 (PDT) From: Tobias Auerochs To: linux-input@vger.kernel.org Cc: jikos@kernel.org, benjamin.tissoires@redhat.com Subject: [RFC] HID: Use SET_REPORT request on control endpoint in hid-rmi for Acer Switch 3 and 5 cover keyboards Date: Thu, 11 Apr 2019 19:50:27 +0200 Message-ID: <2531689.iL9EhC4qnn@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. The supplied patch 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. Any feedback on how to integrate such a fix into the kernel in a more preferred way would be much appreciated. (Hence this is sent as an RFC) There are still further issues with the touchpad, such as occasional poor responsiveness and the physical buttons being stuck once pressed, however those issues do not seem related directly to this particular issue. The problem has been reported previously in a variety of places: https://www.spinics.net/lists/linux-input/msg58433.html https://bugzilla.kernel.org/show_bug.cgi?id=95851 https://ubuntuforums.org/showthread.php?t=2403167 https://community.acer.com/en/discussion/542762/acer-switch-5-linux-mint-touchpad-not-working 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-quirks.c b/drivers/hid/hid-quirks.c index 953908f2267c..67b75665db37 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -158,6 +158,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5), HID_QUIRK_RMI_OUTPUT_SET_REPORT }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD }, { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 9e33165250a3..50d7955e91b1 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c @@ -169,7 +169,18 @@ static int rmi_write_report(struct hid_device *hdev, u8 *report, int len) { int ret; - ret = hid_hw_output_report(hdev, (void *)report, len); + if (hdev->quirks & HID_QUIRK_RMI_OUTPUT_SET_REPORT) { + /* + * Talk to device by using SET_REPORT requests instead. + * The report id is already in report[0], + * so pass that to make usbhid not mess with it. + */ + 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; diff --git a/include/linux/hid.h b/include/linux/hid.h index f9707d1dcb58..b39a32c874f1 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -359,6 +359,7 @@ struct hid_item { #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) #define HID_QUIRK_HAVE_SPECIAL_DRIVER BIT(19) #define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE BIT(20) +#define HID_QUIRK_RMI_OUTPUT_SET_REPORT BIT(21) #define HID_QUIRK_FULLSPEED_INTERVAL BIT(28) #define HID_QUIRK_NO_INIT_REPORTS BIT(29) #define HID_QUIRK_NO_IGNORE BIT(30)