Function libusb::request_type [] [src]

pub fn request_type(direction: Direction, request_type: RequestType, recipient: Recipient) -> u8

Builds a value for the bmRequestType field of a control transfer setup packet.

The bmRequestType field of a USB control transfer setup packet is a bit field specifying three parameters, which are given to this function by corresponding enum values.

Examples

The following example returns a bmRequestType value for a standard inbound transfer from the device, which could be used for reading a device's descriptors:

use libusb::{Direction,RequestType,Recipient};

libusb::request_type(Direction::In, RequestType::Standard, Recipient::Device);