From: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
linux-input@vger.kernel.org
Subject: Re: [PATCH 2/3] HID: steam: add serial number information.
Date: Thu, 15 Feb 2018 23:16:33 +0100 [thread overview]
Message-ID: <20180215221633.GA18755@casa> (raw)
In-Reply-To: <CAO-hwJK5sos9=RDajS_cXBzfePqf6TJs3Z-jk568sumR-zjqdw@mail.gmail.com>
On Wed, Feb 14, 2018 at 03:51:31PM +0100, Benjamin Tissoires wrote:
> On Tue, Feb 13, 2018 at 1:03 PM, Rodrigo Rivas Costa
> > +#define STEAM_FEATURE_REPORT_SIZE 65
> > +
> > +static int steam_send_report(struct steam_device *steam,
> > + u8 *cmd, int size)
> > +{
> > + int retry;
> > + int ret;
> > + u8 *buf = kzalloc(STEAM_FEATURE_REPORT_SIZE, GFP_KERNEL);
>
> Please use hid_alloc_report_buf() as sometimes we need to allocate a
> slightly bigger report.
I have an issue with this one. The problem is that using
hid_report_len() on the feature report returns 64. But I must call
hid_hw_raw_request() with 65 or it will fail with EOVERFLOW.
Currently I'm allocating a buffer of 65 bytes and all is well.
If I change to hid_alloc_report_buf(), the current implementation
allocates (64+7), so I'm still safe. But I'm worried that the extra
bytes are not guaranteed and a future implementation could return
exactly 64 bytes, leaving me 1 byte short.
About why an array of 65 is required for a report of size 64, I think it
is related to hid_report->id == 0 (so hid_report_enum->numbered == 0).
So what would be the proper solution?
Thanks.
Rodrigo.
next prev parent reply other threads:[~2018-02-15 22:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 12:03 [PATCH 1/3] HID: add driver for Valve Steam Controller Rodrigo Rivas Costa
2018-02-13 12:03 ` [PATCH 2/3] HID: steam: add serial number information Rodrigo Rivas Costa
2018-02-14 14:51 ` Benjamin Tissoires
2018-02-15 22:16 ` Rodrigo Rivas Costa [this message]
2018-02-16 8:44 ` Benjamin Tissoires
2018-02-16 9:02 ` Rodrigo Rivas Costa
2018-02-16 9:31 ` Benjamin Tissoires
2018-02-16 9:57 ` Rodrigo Rivas Costa
2018-02-16 10:38 ` Benjamin Tissoires
2018-02-16 20:59 ` Rodrigo Rivas Costa
2018-02-13 12:03 ` [PATCH 3/3] HID: steam: add battery device Rodrigo Rivas Costa
2018-02-14 14:54 ` Benjamin Tissoires
2018-02-14 14:45 ` [PATCH 1/3] HID: add driver for Valve Steam Controller Benjamin Tissoires
2018-02-14 21:28 ` Philippe Ombredanne
2018-02-14 23:29 ` Rodrigo Rivas Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180215221633.GA18755@casa \
--to=rodrigorivascosta@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).