mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
This change adds (most) of the ioctl API for the Linux HIDRAW interface. Reading and writing non-numbered HID reports is done using the read and write system calls respectively. Some of the HIDIOC* request numbers are exported directly while others are kept unexported. This is because some of the #defines require a len attribute that doesn't have a specific well defined value. Wrapper types are added for most of the request numbers as is standard. No wrapper is added for HIDIOCGRDESCSIZE as it would just be IoctlGetUint32. The HIDIOC[GS]FEATURE, HIDIOC[GS]INPUT and HIDIOC[GS]OUTPUT request numbers, which are required for numbered HID reports, are entirely ommitted as the len attribute has to be a runtime variable. These could be added later by doing something like `HIDIOCGFEATURE(0) | (len << _IOC_SIZESHIFT)`, with care taken that len doesn't overflow _IOC_XSIZEMASK. Outdated documentation for the HIDRAW interface is available at: https://www.kernel.org/doc/Documentation/hid/hidraw.txt. Change-Id: I2ae5060f0f46150f6fb52959c2e55f50927c1f69 Reviewed-on: https://go-review.googlesource.com/c/sys/+/289169 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org>