Received: by 10.223.185.116 with SMTP id b49csp1308958wrg; Wed, 21 Feb 2018 16:23:01 -0800 (PST) X-Google-Smtp-Source: AH8x226KlyE7VEJmjv4/OnQO4jYLOhJTuLesiDfJhhpjyZYOYNTTzgZ1oNo0m9UenKGJAmupqZSZ X-Received: by 10.98.152.205 with SMTP id d74mr5016019pfk.115.1519258981696; Wed, 21 Feb 2018 16:23:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519258981; cv=none; d=google.com; s=arc-20160816; b=OmnSQHNkzxqwHjvmbNqFvSiXqnllBXpMlwAeM3L1lbq/pHK8FJVFvR1F8bb42WNcSf a33paTR2OMyfJHlahFf0bK6eLImZPJR8MG1pswgvkhERKhm2f896qxbLNXbwKHSZiThQ tWaK8yWin9F2jCQwkl5f6s+4UHGBG5H3RHslPyidQMH+Ea5O0lfQaLLV5Oti235/QaqJ e7ZRtEUb8jtPMsp5Wie0bugEGjg4rGkmjz6kSi3iNbKy3j/jJ/tc6ud4aT4vVPHDZUhw OXQ57KLONYnJSzqq2AHopfTCFhDzH82Gkf5gogIMAIYEtru4rZi8JohFKKCNlAnd2Ye/ ujqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Ebm7HqEv/daPOyMVSRUJnl508FQI1W456TF0E05XNhk=; b=VewIAej0qQoN/25rPYSfPxv6Ah0mEwuf3HRQFEn1DBM/33B16dWiHs613nJ6JM273J EsW6KKw1UtnuzUflUQMgURBNerAhw2LhNIMZav9Ca2dLlXQQpoaUIxCQwoSd1acl5We2 nFxSFJuA8ICWpHlkt+zU0cR4y0J9HC7H2vYQ6IrOphQV4Kxu7afu4sHHjiLM9jzL6J4s JYwzuHEDfovVfw8ltoBsnK4ecsDbUJxFfdDy9hD+J/JswGe9q9cfE8fan+XDZXPmgq7j ARkI81bwvwUACSvnZQ5peVi1NmdRF67ORl5H52pyZWP7MQjBd83Muyq5Qmg7uvJm3nnC YbIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@valvesoftware.com header.s=mc20150811 header.b=NsAkqJko; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si1982379pgn.140.2018.02.21.16.22.47; Wed, 21 Feb 2018 16:23:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@valvesoftware.com header.s=mc20150811 header.b=NsAkqJko; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbeBVAV7 (ORCPT + 99 others); Wed, 21 Feb 2018 19:21:59 -0500 Received: from us-smtp-delivery-172.mimecast.com ([216.205.24.172]:23175 "EHLO us-smtp-delivery-172.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbeBVAV5 (ORCPT ); Wed, 21 Feb 2018 19:21:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=valvesoftware.com; s=mc20150811; t=1519258917; h=from:subject:date:message-id:to:cc:mime-version:content-type:content-transfer-encoding:in-reply-to:references; bh=Ebm7HqEv/daPOyMVSRUJnl508FQI1W456TF0E05XNhk=; b=NsAkqJkoFgxhqo1q8UbhWcCepaOiDb4BO/zNInDnKrcu1p+rjrvQ7OnHO0wzdNJnBEhTh66tpDEO/UNlIw6BQ0OYH8YTIuhcZjRKrJLLv7qxyMChNwnrj64Ct4VAH4wzdFF9cTlUQPWeT3Pu5LizETNr1+Ygj5bnGU3KvLa4BJw= Received: from smtp02.valvesoftware.com (smtp02.valvesoftware.com [208.64.203.182]) (Using TLS) by us-smtp-1.mimecast.com with ESMTP id us-mta-37-y743T2ZRMea7C9dXdA7rcw-1; Wed, 21 Feb 2018 19:21:55 -0500 Received: from [172.16.1.107] (helo=antispam.valvesoftware.com) by smtp02.valvesoftware.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eoee2-0003Wf-I9; Wed, 21 Feb 2018 16:21:54 -0800 Received: from antispam.valvesoftware.com (127.0.0.1) id hho6i40171sj; Wed, 21 Feb 2018 16:21:54 -0800 (envelope-from ) Received: from exchange17.valvemail.org ([172.16.144.21]) by antispam.valvesoftware.com ([172.16.1.107]) (SonicWALL 8.3.2.6535) with ESMTP id 201802220021540050492; Wed, 21 Feb 2018 16:21:54 -0800 Received: from [172.18.9.62] (172.18.9.62) by exchange17.valvemail.org (172.16.144.21) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 21 Feb 2018 16:21:54 -0800 Subject: Re: [PATCH 1/3] HID: add driver for Valve Steam Controller To: Rodrigo Rivas Costa , Benjamin Tissoires CC: Jiri Kosina , lkml , References: <20180213120308.23879-1-rodrigorivascosta@gmail.com> <20180214232957.GB3741@casa> From: "Pierre-Loup A. Griffais" Message-ID: <38f5205a-c40a-8052-b7a8-5693032cafc8@valvesoftware.com> Date: Wed, 21 Feb 2018 16:19:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180214232957.GB3741@casa> Content-Language: en-US X-Mlf-Version: 8.3.2.6535 X-Mlf-UniqueId: o201802220021540050492 X-MC-Unique: y743T2ZRMea7C9dXdA7rcw-1 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/14/2018 03:29 PM, Rodrigo Rivas Costa wrote: > On Wed, Feb 14, 2018 at 03:45:14PM +0100, Benjamin Tissoires wrote: >> I think I had a look at this a while ago, and didn't want to interfere >> with SteamOS regarding this. I think your patch should be fine in that >> regard, but have you tried SteamOS on a kernel patched with your >> series? Does it behave properly or will it break? >=20 > Well, SteamOS is just a modified Debian with the Steam Client running in > Big Picture mode (fullscreen). I tried the Steam Client with this driver > and it works just fine: > - The first thing the Steam Client (SC) does is to disable the virtual > keyboard and mouse, so not creating those input devices make no > difference. There's a bit more to it than that; for example, on SteamOS, the virtual=20 keyboard/mouse will be re-enabled when switching to Desktop Mode. In addition, chord configurations can include a bindable action that=20 temporarily programs the controller to re-enable the virtual=20 keyboard/mouse (what we call "Lizard Mode"). People use this to navigate=20 around cases where our software input doesn't cut it, like a launcher=20 pop-up window that Steam isn't able to hook into for whatever reason. That behavior will also change over time since the client is often=20 updated with support for new controller features. Thanks, - Pierre-Loup > - Input events are sent both to the libusb (or whatever SC uses) and > this driver. > - The only source of conflict would be in sending commands to the > controller. But currently the only command sent is the get_serial, and > that seems to do no harm. >=20 >>> + >>> + hid_info(hdev, "Steam Controller connected"); >>> + >>> + input =3D input_allocate_device(); >> >> Don't you need one input node per wireless gamepad too? >> > No, the wired and wireless methods are two different USB devices. > The wireless adaptor is a small usb device that creates 4 HID interfaces > for the 4 to-be-connected controllers. When the 'connected' event > arrives on one of those interfaces we will create one input device. > Another controller connected will use a different interface so another > unrelated input device will be created. >=20 > The wired adaptor is the controller connected directly to USB: it > creates one HID inteface and one input device directly. >=20 > Anyway, one steam_device will contain 0 or 1 input_device. >=20 >>> + input->name =3D "Steam Controller"; >> >> In case of the wireless controllers, you might want to personalize this = a bit. >=20 > Do you mean e.g. "Wireless Steam Controller"? Would be wise to add the se= rial > number here (from PATCH 2/3?)? Or is the 'uniq' enough for that? >=20 >>> + input_set_abs_params(input, ABS_Z, 0, 255, 0, 0); >>> + input_set_abs_params(input, ABS_RZ, 0, 255, 0, 0); >>> + input_set_abs_params(input, ABS_X, -32767, 32767, 0, 0); >>> + input_set_abs_params(input, ABS_Y, -32767, 32767, 0, 0); >> >> You are also probably missing the resolution bits. We need to >> accurately report the physical dimensions to the user space (thanks to >> the resolution) >> >>> + input_set_abs_params(input, ABS_RX, -32767, 32767, 0, 0); >>> + input_set_abs_params(input, ABS_RY, -32767, 32767, 0, 0); >> >> What do RX/RY correspond to? >=20 > This gamepad has 1 joystick and 2 touchpads (lpad and rpad). > I'm mapping the joystick/lpad to ABS_X/ABS_Y and the rpad to > ABS_RX/ABS_RY. >=20 > About the resolution, I looked around other drivers and many have 0 as > resolution... is it necessary only in the pads or the joystick too? > And what are the units of that value? > For reference, the pads are round and exactly 40 mm in diameter. >=20 > Why the lpad and the joystick are mapped to the same axes? Well, because > the device returns them at the same offset. We could make them > apart by using bits 10.3 (lpad_touch) and 10.7 (lpad_and_joy) but I > don't think it is worth it... you use the joystick and the lpad with the > same thumb! >=20 >> Anyway. Thanks for the driver, there are a few bits to fix, nothing >> scary though. >=20 > Great, I'll correct all those issues and resubmit the patches in a few > days. It is my very first driver and I'm still a bit slow... >=20 > Thank you for your attention! > Rodrigo. > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >=20