dcuddeback / libusb-rs

A safe Rust wrapper for libusb.
MIT License
199 stars 64 forks source link

fix(device_handle): Allow SET_IDLE requests with direction out #8

Closed oberien closed 8 years ago

oberien commented 8 years ago

The SET_IDLE request (bRequest 0x0a) have a bmRequestType of 0x21. Using this request_type in libusb-rs DeviceHandle::read_control gets rejected with an InvalidParam, because it's direction is not Direction::In, but rather Direction::Out (when parsed as direction).

This Pull Request adds another condition to the request_type Mask-Check, allowing SET_IDLE requests of request == 0x0a to pass through the check with Direction::Out set.

kevinmehall commented 8 years ago

Why not use write_control?

oberien commented 8 years ago

basically because all the times i looked through the rust und c sources and the rust and c documentations, i never realized this function existed :D Thank you and don't mind me :)