linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Clarification about the hidraw documentation on HIDIOCGFEATURE
@ 2023-06-19  0:27 Xiaofan Chen
  2023-06-19  6:09 ` Xiaofan Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Xiaofan Chen @ 2023-06-19  0:27 UTC (permalink / raw)
  To: linux-input; +Cc: Ihor Dutchak

Current documentation
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-22  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19  0:27 Clarification about the hidraw documentation on HIDIOCGFEATURE Xiaofan Chen
2023-06-19  6:09 ` Xiaofan Chen
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

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).