From patchwork Tue Sep 13 14:08:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 9329205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9020607FD for ; Tue, 13 Sep 2016 14:09:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB9CF294EA for ; Tue, 13 Sep 2016 14:09:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D03E3294F3; Tue, 13 Sep 2016 14:09:16 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 3A050294F2 for ; Tue, 13 Sep 2016 14:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755296AbcIMOJP (ORCPT ); Tue, 13 Sep 2016 10:09:15 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35582 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756644AbcIMOJO (ORCPT ); Tue, 13 Sep 2016 10:09:14 -0400 Received: by mail-wm0-f66.google.com with SMTP id c131so3169284wmh.2 for ; Tue, 13 Sep 2016 07:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fVTAfLaKM7HMfCYgND6C53kDdkhpr8g5B6NWvKhJZLE=; b=Q3pnvlsZe76rAGNQ3WhphfiQa72yv5diJcUiFQtdqQDxtWTFg//3b9upO1bRO0SDya XnCgxJWTTRBJCeKRYc9qzqvUeuXusfK73eCp/xYKM93ilCa44Vz7ibF6W/DVsaFObtXs ZXWL/MUQII7eNqJRJIX/H+FhIAc4H4AUhUUmpor9jrIhw3IhWk1PupXojoSPzlX8Gjod lFN9MKe9F/tfNH3EDW/Sk/vCNmMAdOiuig66Uh9OUHAJXXfU6bY6ouQxwxeHSFMV0f8m H+tnuDSkv3VQuCIG0FEO3wsAIbAk+pNzY02vjJQeAh8lKhqaYZLth4dcWgkWi4i+OsSa JYtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fVTAfLaKM7HMfCYgND6C53kDdkhpr8g5B6NWvKhJZLE=; b=k2Y3mL35TIGM6TJAl9cMBQRjqPd/LWDXBCUt6npcv7yetHSCQ+iFmzKHBvQo9n7Jdd nj/bLVNYHeayIC75rf1D8dmKZZyzg1jQr+bhbws5WXcZOtqIaaQPhcmRqMlDaNKwhcnd qrXW22jATQCeOHfFcP2U0BXs1lsTMxNj0NWTUfIpobm+KxHUAcvnlA27U1zUvpltKcb0 sXKWc5Xt4NZEXAi2HyDhpay61Qd+UvSRILjVM9tdWorAUPsYSITep6fEseZdJ5Y48VEp /xSJOF52uajRZiU3PAQHrMyjCkO1mG97aSnkfpFgq+XgXJ5Roi+Lfc3U3C2G449ixvmt mOAQ== X-Gm-Message-State: AE9vXwNYWCkQYpiNFpQBh2TbTIMYRUYHCJuPvO1vGZN7ZoJhM3Q0bFdk2liJl3uJb3wYHg== X-Received: by 10.28.10.136 with SMTP id 130mr891523wmk.115.1473775753406; Tue, 13 Sep 2016 07:09:13 -0700 (PDT) Received: from gimli.redhat.com (a91-152-106-187.elisa-laajakaista.fi. [91.152.106.187]) by smtp.googlemail.com with ESMTPSA id j1sm23193149wju.9.2016.09.13.07.09.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 07:09:12 -0700 (PDT) From: Nikolai Kondrashov To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH 8/9] HID: uclogic: Override constant descriptors Date: Tue, 13 Sep 2016 17:08:42 +0300 Message-Id: <20160913140843.25567-9-spbnick@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160913140843.25567-1-spbnick@gmail.com> References: <20160913140843.25567-1-spbnick@gmail.com> 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 Make uclogic_report_fixup override constant descriptors with generated descriptors, so models reusing product ID, but working with generated descriptor get correct one. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-uclogic.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c index 72778b3..64abd8d 100644 --- a/drivers/hid/hid-uclogic.c +++ b/drivers/hid/hid-uclogic.c @@ -632,6 +632,12 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); + if (drvdata->rdesc != NULL) { + rdesc = drvdata->rdesc; + *rsize = drvdata->rsize; + return rdesc; + } + switch (hdev->product) { case USB_DEVICE_ID_UCLOGIC_TABLET_PF1209: if (*rsize == PF1209_RDESC_ORIG_SIZE) { @@ -701,11 +707,6 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, break; } break; - default: - if (drvdata->rdesc != NULL) { - rdesc = drvdata->rdesc; - *rsize = drvdata->rsize; - } } return rdesc;