Received: by 10.223.185.116 with SMTP id b49csp1127056wrg; Fri, 16 Feb 2018 13:00:41 -0800 (PST) X-Google-Smtp-Source: AH8x226n92r826/FLCScdAQPseOhITWDtX3hilfqvU1OPHGc1KZp4xmd3O6m2SXnclZ1mNbVIxXB X-Received: by 2002:a17:902:523:: with SMTP id 32-v6mr6906602plf.145.1518814841885; Fri, 16 Feb 2018 13:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518814841; cv=none; d=google.com; s=arc-20160816; b=eZATDoneTs+ajxO45kYlGhcvrmToNheU8FpsDGluwhOWn4YJH2ibH/LGEtmWjHrS9s KCWquLoZZBiJZ4/9NQPmJ9e16NGusipYCgsmN/oexnkEVmA+O7BsVc6uP4jN+9+S4czv u3RQR3wyAE3aTr4zMFgeBYWxiE2jDS/TPPhdoDg2LODfMnw9uidVObZQ0zI/cZgOSARz MXW2EkdCYOTt91n7TbIKWsgF9CBjG+nwY93tDYa5xPUJoQ9GquuyHoQYl1ToMh+jEeVH H1LokAMN8b8Us7WJD10/ceZZwvNW6Hy11ZH6iA9vjETN/dKLhqIeOhAhyxgO9le8dTzy wPDw== 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=XTX8Mk+biKTBm3n7Hvvm81yeTIYeutLywtECEUExaDs=; b=RJLdchEgtSW7T0dKtJ6qjNgCxd7Ou1RKMgrO+jJbtp32gC4wKKnWo6ZbcGrigqeMP1 ue8rnM6RaXSWYwuDxoL5JCRH7j5LTNMs+jfPJgMtxXNxMF1//WkTra+wafx2UnzYJHQB fkbkYA5twiLSEvXJfdJTMH8QMFKGFNThWarZUgtyOIASaMxjQ9uRu3Rwrgb1gUzOd7Gv +VwD35D1+JBVwOBqV+0UPZ/xIbMSsFue7Iu+XEOrGqHoFn7gG1Fl8IdhwZhhvhRvXuK0 PMaRNfBnA8EmTqrSX8wpkpCSNqcBkv0kGzdhnZNHl1OjhbyG0zk059gPGQgFbLHXw6GS 5AWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SQJ5CSZj; 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 l2si6870383pgu.691.2018.02.16.13.00.26; Fri, 16 Feb 2018 13:00:41 -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=SQJ5CSZj; 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 S1750819AbeBPU7q (ORCPT + 99 others); Fri, 16 Feb 2018 15:59:46 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:51082 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbeBPU7o (ORCPT ); Fri, 16 Feb 2018 15:59:44 -0500 Received: by mail-wm0-f54.google.com with SMTP id k87so5372188wmi.0; Fri, 16 Feb 2018 12:59:43 -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=XTX8Mk+biKTBm3n7Hvvm81yeTIYeutLywtECEUExaDs=; b=SQJ5CSZj4PT5SJXnOKkdkJ+X2ynSs/vPTmJ2uDMWYVNhthX1XK2xHKC9u0/TZW1gU5 Twg8RW+nyqBevxxJgc9jyYrAfcFFz6lTQiV9KEIEOVxN7NUtBvWTvd7zRf58fpNCudAd VLvSvJOM4KwPKBFDlRGsAfmKbGgtv9RROhhPUJOD6npvEQ+HMBrtvTtrkw3AcZnXnoGq IsZe6sJMyVs+bC7SIQswLi8PrSplCVT+s10LMP1f4fCTkT4JEeK0M5pBtU9862PuGWg3 b/k+NfrwWtOMLFMUuFMMJIUbuCdKjBBr5C+54j2NDdnHpFlG5P7SklsuKEOqVAb8Ofg8 9dRA== 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=XTX8Mk+biKTBm3n7Hvvm81yeTIYeutLywtECEUExaDs=; b=hSplRIa4QQR6H3AyHT8gmRwywkG4CqTsM6/MewnKDJIlXSoKEt0o+8MOs6AnbsUz5n NZs31U3bh9e+/EFsgt3o8nZeQAU4Zwp/Bvg8fIiAp62mN/Aw3DFgbmEySUamFgmF0P3P GVh8wqG0QrqfxRBnAfjSG+LPUw2WU8xpJlIXv8kjbxaRzANmPyadK9wMTg+PgI4bMO9p wIq3i7zXyvCQcp8DwgCBRMf9kh8ib7eRMP0EM6jiXd+X0jw02c5nHkXGhAYde353TC8j R0XReduh+ov6eIXYMgroME4c1aRoOqUKobtzvHfV2vW1CLPmdrsznaaapnmkpOojSZvz jCBg== X-Gm-Message-State: APf1xPDjP01gzkVECoBj+s8c9YtY3w5mkEMZuUTwX6XoYJlSSvzy1+/i r/WfnPiZiJskPYIeKFh80KQ= X-Received: by 10.28.58.79 with SMTP id h76mr6176216wma.139.1518814782870; Fri, 16 Feb 2018 12:59:42 -0800 (PST) Received: from casa ([2a01:c50e:5126:7a00:4dc5:23c5:d72:18]) by smtp.gmail.com with ESMTPSA id o9sm5556446wrf.43.2018.02.16.12.59.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2018 12:59:41 -0800 (PST) Date: Fri, 16 Feb 2018 21:59:39 +0100 From: Rodrigo Rivas Costa To: Benjamin Tissoires Cc: Jiri Kosina , lkml , linux-input@vger.kernel.org Subject: Re: [PATCH 2/3] HID: steam: add serial number information. Message-ID: <20180216205939.GA17329@casa> References: <20180213120308.23879-1-rodrigorivascosta@gmail.com> <20180213120308.23879-2-rodrigorivascosta@gmail.com> <20180215221633.GA18755@casa> <20180216090243.GB18755@casa> <20180216095722.GC18755@casa> 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 Fri, Feb 16, 2018 at 11:38:11AM +0100, Benjamin Tissoires wrote: > On Fri, Feb 16, 2018 at 10:57 AM, Rodrigo Rivas Costa > wrote: > > On Fri, Feb 16, 2018 at 10:31:35AM +0100, Benjamin Tissoires wrote: > >> > Ok, I'll do that. The weird thing, however, is that: > >> > > >> > hid_hw_raw_request(steam->hid_dev, 0x00, > >> > buf, hid_report_len(r), /* 64 */ > >> > HID_FEATURE_REPORT, HID_REQ_GET_REPORT); > >> > > >> > fails with EOVERFLOW. I have to use: > >> > > >> > hid_hw_raw_request(steam->hid_dev, 0x00, > >> > buf, 65 > >> > HID_FEATURE_REPORT, HID_REQ_GET_REPORT); > >> > > >> > which just feels wrong to me. > >> > >> Indeed > >> > > Arf, looks like usbhid expects the buffer to start with 0x00 when the > report is not numbered, thus adding one to the report length. > > I guess that nobody tried to recently set/get reports on a device > without a report ID. And hidraw matches this behavior too, which means > it's hard to change. > > One thing I'd like to try to change is the result of hid_report_len. > If everybody expects the size to be of one more when the report is > unnumbered, maybe we could simply add this placeholder in the report > size from the beginning. I've been trying to make sense of all this numbered/buf++/count-- stuff, and I admit I don't understand half of it... But about that +7 in hid_alloc_report_buf(), isn't it to make room for the implement()/extract() functions? And IIUIC those are not used for raw_requests... they are instead passed directly to usb_control_msg() (or whatever the ll driver does). That's the point of being raw, isn't it? If I'm right with that, would it make sense to go back to kzalloc(65)? If I'm wrong, then if you agree, I'll default to: hid_hw_raw_request(steam->hid_dev, 0x00, buf, hid_report_len(r) + 1, /* count the request number */ HID_FEATURE_REPORT, HID_REQ_GET_REPORT); Then, if hid_report_len() is ever updated to return the +1, this one should be removed. And even if it is not, we still have +6 extra bytes from hid_alloc_report_buf(), so no real harm done. Regards. Rodrigo