Skip to content

Commit

Permalink
Handle windows missing function for nusb
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Oct 26, 2024
1 parent 5c00f96 commit d03e34d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,18 @@ impl UsbDeviceHandler for NusbUsbHostDeviceHandler {
index: setup.index,
};
// control
if setup.request_type & 0x80 == 0 {
// control out
handle.control_out_blocking(control, req, timeout).ok();
} else {
// control in
if let Ok(len) = handle.control_in_blocking(control, &mut buffer, timeout) {
return Ok(Vec::from(&buffer[..len]));
if cfg!(not(target_os = "windows")) {
if setup.request_type & 0x80 == 0 {
// control out
handle.control_out_blocking(control, req, timeout).ok();
} else {
// control in
if let Ok(len) = handle.control_in_blocking(control, &mut buffer, timeout) {
return Ok(Vec::from(&buffer[..len]));
}
}
} else {
warn!("Not supported in windows")
}
Ok(vec![])
}
Expand Down

0 comments on commit d03e34d

Please sign in to comment.