Received: by 10.223.185.116 with SMTP id b49csp1329846wrg; Wed, 14 Feb 2018 15:31:08 -0800 (PST) X-Google-Smtp-Source: AH8x224YF3a9FXc+lVY+uS424bvfQmbZVAYcjtIrY2WvaIQucyFrQxb9e++zUP0hZVzySyaH0NA3 X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr635826plg.280.1518651068066; Wed, 14 Feb 2018 15:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518651068; cv=none; d=google.com; s=arc-20160816; b=EI61rt7x0iKLO2m530ROBVjVmSwAayRjZj+h2JP9FXt5F48HDUrXFpcDb/G/I38Dcw zpMA/MTbWbJ7KxkoxrZUNbM+icaxX/5/b8czOsBrfFSk6cSe8xhxOfNmHPhw8w1/ZcKo MGYcNG0QGhOer84wadStzd8UzbdXfM99NACDYpMtJ0a4tf6B4p2zx0tL9WiLQU9sQatU vhC4Agsie6sg+i1ONiY4BL1S8jan61J/wRaLKhGJEf9m/hew4e377OWhaBTH64EUOR9L MltRIBtIJ5VJUIgsuGJPLiwCOqHTLhEoMqTXjwa8I3oVXnymT8IeqN4RTt4ZZO11lytP DCqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=9wAnQLvJiDUETHQ7G09tGHzWgd27igZepKGf4I9yihA=; b=JI6Us/We6qvm3YUjOXXT6usICFjEifas46Xxgd0jvAQGc5wm45JEHCr08tIMIpiOMO B58a9Dn2xX8k/oXFajqFTDXCIGoXe7I9qBgWvQe0rbdDWLpSca6pcccvtmh/EPyKHKQs zetpeDGOBSm6RFZA+BCS13EU7FdCeJ9ECCVU1m+8llYkOsmsH7RSVnJpG8IRDN8T1sUv xQhjTQ6ImkdPTcdM7gwE/b0uK8S1U26MFDZidP8OONmHJcmR6HEMXJQnnwfiGeJUgPt9 79RzmvGP4nr4nQTG4kyMu7ff9bfdclf4JOpZjXP9YEUxoysyZgozigBbbgbTinI4Vx9B QxSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ina9vxz8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si451204pgp.262.2018.02.14.15.30.53; Wed, 14 Feb 2018 15:31:08 -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=@gmail.com header.s=20161025 header.b=ina9vxz8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032165AbeBNXaH (ORCPT + 99 others); Wed, 14 Feb 2018 18:30:07 -0500 Received: from mail-wr0-f175.google.com ([209.85.128.175]:45072 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032135AbeBNXaC (ORCPT ); Wed, 14 Feb 2018 18:30:02 -0500 Received: by mail-wr0-f175.google.com with SMTP id h9so1584300wre.12; Wed, 14 Feb 2018 15:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9wAnQLvJiDUETHQ7G09tGHzWgd27igZepKGf4I9yihA=; b=ina9vxz8W6X5M9OP5nrhel8aw0Mwq3/nvatNM0+0EHv/8za7QawkuT9dw4VGg8rc+F SNE/6E04C4UaQkfTHrwcI9oI6fh+bmL48fOsyyhhAapzlx8T1PqFML3cgNQw6bC5g3cO uJxGNVjKxr3OSNZMFFY6BFUj61PU5D7tdZWpGjz5+Y60NVeDW4F6mE+jjPLCZ/znMWT0 FU7zg9SBGAJSW9workiCWeY9LWWE2LxAphRuDcS3D5UtHIYGXiraJLYbS7bgMVut5w3K /6jz6CD/LGjtmOWPJLA/w3OG+jJAzla7nR/C5A7A5h9ulLjoNydMaPGeGNz4Mxx2foaX axGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9wAnQLvJiDUETHQ7G09tGHzWgd27igZepKGf4I9yihA=; b=X+6yzdNytiEOhxu8Y3PtpRIVsQ9+IlvHplSJ3wHU1/gjQPPKa9TT/ZvVfe8daMUavV 6ow3ZdaabM4SW1NTeTSgOCKwvlu9g4gi3Ux9SxsfKoYy/g9DS03MiIdE75b5CO9bcVt9 CKNZrNm/csFeQRrQBT+h+KxbM2Tk1qhBXYpwAHxAqQxsA542/gDqvJIl/GiVk7ROLU8n O6S1IXFtC7UqhW1HaaMMXhydxAfriyeRElzdTzwmWbM0hjJRmRY3lyyv3OT7RjTtUhXr rMxWAbzO/7f1jpul3vNEjWeKPXhnlcT+YGBiaY59zo1Ij3ATIIp52WpOw/eTSG4GDfVY FWEA== X-Gm-Message-State: APf1xPBo88JO8oQnFk3Co/i7LU2hQBVsNyWQIx5z0mfVFq+cLkPH3QeM 0L7PTUy3x/LOJh7V2xcGPwo= X-Received: by 10.223.160.157 with SMTP id m29mr681392wrm.119.1518651000840; Wed, 14 Feb 2018 15:30:00 -0800 (PST) Received: from casa ([2a01:c50e:5126:7a00:7c2c:d026:beea:5688]) by smtp.gmail.com with ESMTPSA id z20sm15597154wrz.20.2018.02.14.15.29.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2018 15:29:59 -0800 (PST) Date: Thu, 15 Feb 2018 00:29:57 +0100 From: Rodrigo Rivas Costa To: Benjamin Tissoires Cc: Jiri Kosina , lkml , linux-input@vger.kernel.org Subject: Re: [PATCH 1/3] HID: add driver for Valve Steam Controller Message-ID: <20180214232957.GB3741@casa> References: <20180213120308.23879-1-rodrigorivascosta@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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. - 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. > > + > > + hid_info(hdev, "Steam Controller connected"); > > + > > + input = 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. The wired adaptor is the controller connected directly to USB: it creates one HID inteface and one input device directly. Anyway, one steam_device will contain 0 or 1 input_device. > > + input->name = "Steam Controller"; > > In case of the wireless controllers, you might want to personalize this a bit. Do you mean e.g. "Wireless Steam Controller"? Would be wise to add the serial number here (from PATCH 2/3?)? Or is the 'uniq' enough for that? > > + 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? 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. 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. 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! > Anyway. Thanks for the driver, there are a few bits to fix, nothing > scary though. 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... Thank you for your attention! Rodrigo.