Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1726851pxj; Wed, 19 May 2021 12:26:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6Sow80smw96PbaJjAGpNf71bysP/ARObdykJKC8yyGSZMeVrlTEaNln2vuXmsOi7UR4i0 X-Received: by 2002:a17:907:9612:: with SMTP id gb18mr751460ejc.408.1621452373687; Wed, 19 May 2021 12:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452373; cv=none; d=google.com; s=arc-20160816; b=mrBj4RTZqBzUqWFZXjTO98bwvTc+VXvx6PU6wf03Qk3Vyayl74+DgFsRdZJcnVPj8a gD/ouBaOe/VCngwd6WhDRYZ5+bGY8KtL6F0y/8EkVZUpCjnJWFUQPg1dIFPD6VOhNP2q u8vVI7yPikWRMPcsjzIRfU4q7AJB6+HTZTnMI7M4KMEUT0HxNSPwtT0OXaSYoiA1qyA3 c8fvazwdEa50FEJLUiIgIS6PxyLd8VW7rDmWSWV4GVCwOZhGN0MGeqDHmn8CQH/W9Q9c kz1PbzeZEOkHFCAENcN8kbyO61S9cH7Pq36sWjHLafgAXgAkeAPC/zWbAHgO+7N8KiOv 2buw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=59q3dOLXWBi+puG5aixukfUbUA+DtIX38uyaPYtK4/4=; b=KssG/2yVgVHIC+OdvfQ6vWJ22Vmd/nEGi3fHr2FB2hLCVhNAp8x3JVTWYmjZ2jSga7 bjVAnemLOEsIgOtRyouQ2cuANI6vcXf+2iTyUWv6L6lKDYL+GE0OUM68FsKOhHCoPz1I k9ypyitef2hWkXF7GiiJ5yXAIIVy8j2yxr4P1jcu1ysckALkA5f+btYdvIU0RlnpGMhe YvymR/QFq7yC0XUGvKqL+lFglPofCBWQFvHdFJ6rVJLjuI3ty4Jxg8mbm9gJGebhMY2g fsgiy+qOo90yP8MQV3nPr1Prqs4t19DDFCCXNw0RCQJJvuKGUD/mpz+rEB+a7ZFyvN9g UgcQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si107006edy.494.2021.05.19.12.25.48; Wed, 19 May 2021 12:26:13 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344144AbhESJBC (ORCPT + 99 others); Wed, 19 May 2021 05:01:02 -0400 Received: from 82-65-109-163.subs.proxad.net ([82.65.109.163]:41090 "EHLO luna.linkmauve.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241640AbhESJBB (ORCPT ); Wed, 19 May 2021 05:01:01 -0400 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 3F92FF40644; Wed, 19 May 2021 10:59:36 +0200 (CEST) From: Emmanuel Gil Peyrot To: linux-input@vger.kernel.org Cc: Emmanuel Gil Peyrot , Ash Logan , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= , Jiri Kosina , Benjamin Tissoires , linux-kernel@vger.kernel.org Subject: [PATCH v3 0/4] HID: wiiu-drc: Add a driver for the Wii U gamepad Date: Wed, 19 May 2021 10:59:20 +0200 Message-Id: <20210519085924.1636-1-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.31.1 In-Reply-To: 20210511201604.23204-1-linkmauve@linkmauve.fr References: <20210502232836.26134-1-linkmauve@linkmauve.fr> 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 This driver is for the DRC (wireless gamepad) when plugged to the DRH of the Wii U, a chip exposing it as a USB device. I tried to use this driver on master over usbip on my laptop, but usbip disconnects the device right after the driver created the /dev/input/event* files, so instead I have only tested this driver on the 4.19 branch of the linux-wiiu[1] downstream. Other than that, pretty much all of the HID parts of the gamepad work, it’s only missing microphone, camera and NFC input now but those are mostly standard (read require quirks) and pertain to other subsystems, so I felt like this can be upstreamed already. [1] https://gitlab.com/linux-wiiu/linux-wiiu Changes since v1: - Rename interfaces to be less redundant. - Add comments for potentially unclear things. - Reword some commits to include more needed information. - Include all needed includes. - Use helpful helper functions instead of (badly) reimplementing them myself. - Always return the correct type for each function, to avoid some bool/int confusion, or returning 0 to mean error. - Use myself as the module author, even though Ash did most of the initial work, I’m the one who will be maintaining this module from now on. - Use input_set_capability() instead of set_bit(…, keybit) to also set BIT(EV_KEY) on evbit[0]. - Call hid_hw_start() before input_register_device() but after the setup functions, so that hid_hw_open() is never called before it. - Add missing spin_lock_init() for the battery lock. - Use a static atomic for the drc_num, and remove the comment about using the interface number. - Interpret battery report as the voltage coming from an ADC, instead of the completely wrong ENERGY_NOW it was before. So basically addressing Jonathan’s and Barnabás’ comments. :) Changes since v2: - Guard against the possibility of CONFIG_HID_BATTERY_STRENGTH not having been selected. - Include forgotten linux/fixp-arith.h header. - Fix a warning in clamp() due to comparing a s16 with a #define. Ash Logan (1): HID: wiiu-drc: Add a driver for this gamepad Emmanuel Gil Peyrot (3): HID: wiiu-drc: Implement touch reports HID: wiiu-drc: Add accelerometer, gyroscope and magnetometer readings HID: wiiu-drc: Add battery reporting drivers/hid/Kconfig | 7 + drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 3 + drivers/hid/hid-wiiu-drc.c | 564 +++++++++++++++++++++++++++++++++++++ 5 files changed, 576 insertions(+) create mode 100644 drivers/hid/hid-wiiu-drc.c -- 2.31.1