Struct hidapi::HidDevice [] [src]

pub struct HidDevice<'a> { /* fields omitted */ }

Object for accessing HID device

Methods

impl<'a> HidDevice<'a>
[src]

Get a string describing the last error which occurred.

The first byte of data must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to write() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to write(), the Report ID (or 0x0, for devices with a single report), followed by the report data (16 bytes). In this example, the length passed in would be 17. write() will send the data on the first OUT endpoint, if one exists. If it does not, it will send the data through the Control Endpoint (Endpoint 0).

Input reports are returned to the host through the 'INTERRUPT IN' endpoint. The first byte will contain the Report number if the device uses numbered reports.

Input reports are returned to the host through the 'INTERRUPT IN' endpoint. The first byte will contain the Report number if the device uses numbered reports. Timeout measured in milliseconds, set -1 for blocking wait.

Send a Feature report to the device. Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of data must contain the 'Report ID'. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the 'Report ID' is mandatory, calls to send_feature_report() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to send_feature_report(): 'the Report ID' (or 0x0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.

Set the first byte of data to the 'Report ID' of the report to be read. Upon return, the first byte will still contain the Report ID, and the report data will start in data[1].

Set the device handle to be in blocking or in non-blocking mode. In non-blocking mode calls to read() will return immediately with an empty slice if there is no data to be read. In blocking mode, read() will wait (block) until there is data to read before returning. Modes can be changed at any time.

Get The Manufacturer String from a HID device.

Get The Manufacturer String from a HID device.

Get The Serial Number String from a HID device.

Get a string from a HID device, based on its string index.

Trait Implementations

impl<'a> Drop for HidDevice<'a>
[src]

A method called when the value goes out of scope. Read more