From: Xiaofan Chen <xiaofanc@gmail.com>
To: linux-input@vger.kernel.org
Cc: Ihor Dutchak <ihor.youw@gmail.com>
Subject: Clarification about the hidraw documentation on HIDIOCGFEATURE
Date: Mon, 19 Jun 2023 14:09:16 +0800 [thread overview]
Message-ID: <CAGjSPUAosFY7svBoqAU3xsDD-ij2Qa3nZ2nf+jF4i2yC7sWpWw@mail.gmail.com> (raw)
In-Reply-To: <CAGjSPUA1A0RVrf1OmgUKL3prOBuNFvhPJXJ4n7YbKrPLZb5h9A@mail.gmail.com>
I know that thurrent documentation has been there since it was created by
Alan Ott many years ago. And he started the HIDAPI project around that
time as well. However, I am starting to doubt whether it is correct or not
based on the testing using HIDAPI.
Please help to clarify. Thanks.
https://docs.kernel.org/hid/hidraw.html
+++++++++++++++++++++++++++++++++++++++++++++++++++++
HIDIOCGFEATURE(len):
Get a Feature Report
This ioctl will request a feature report from the device using the
control endpoint. The first byte of the supplied buffer should be
set to the report number of the requested report. For devices
which do not use numbered reports, set the first byte to 0. The
returned report buffer will contain the report number in the first
byte, followed by the report data read from the device. For devices
which do not use numbered reports, the report data will begin at the
first byte of the returned buffer.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have doubts about the last sentence. It seems to me that for
devices which do not use numbered reports, the first byte will
be 0 and the report data begins in the second byte.
This is based on testing results using hidapi and hidapitester, which
use the ioctl.
int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned
char *data, size_t length)
{
int res;
register_device_error(dev, NULL);
res = ioctl(dev->device_handle, HIDIOCGFEATURE(length), data);
if (res < 0)
register_device_error_format(dev, "ioctl (GFEATURE): %s",
strerror(errno));
return res;
}
Reference discussion:
https://github.com/libusb/hidapi/issues/589
Test device is Jan Axelson's generic HID example which I have tested using
libusb and hidapi across platforms as well as using Windows HID API.
So I believe the FW is good.
http://janaxelson.com/hidpage.htm#MyExampleCode (USB PIC MCU)
--
Xiaofan
next prev parent reply other threads:[~2023-06-19 6:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 0:27 Clarification about the hidraw documentation on HIDIOCGFEATURE Xiaofan Chen
2023-06-19 6:09 ` Xiaofan Chen [this message]
2023-06-19 15:14 ` Xiaofan Chen
2023-06-19 23:28 ` Xiaofan Chen
2023-06-21 11:26 ` Xiaofan Chen
2023-06-21 15:05 ` Benjamin Tissoires
2023-06-22 9:08 ` Xiaofan Chen
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=CAGjSPUAosFY7svBoqAU3xsDD-ij2Qa3nZ2nf+jF4i2yC7sWpWw@mail.gmail.com \
--to=xiaofanc@gmail.com \
--cc=ihor.youw@gmail.com \
--cc=linux-input@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).