Clarification about the hidraw documentation on HIDIOCGFEATURE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux