@@ -16,9 +16,9 @@ use std::{
1616use log:: { debug, error, warn} ;
1717use windows_sys:: Win32 :: {
1818 Devices :: Usb :: {
19- WinUsb_ControlTransfer , WinUsb_Free , WinUsb_GetAssociatedInterface , WinUsb_Initialize ,
20- WinUsb_ReadPipe , WinUsb_ResetPipe , WinUsb_SetCurrentAlternateSetting , WinUsb_WritePipe ,
21- WINUSB_INTERFACE_HANDLE , WINUSB_SETUP_PACKET ,
19+ self , WinUsb_ControlTransfer , WinUsb_Free , WinUsb_GetAssociatedInterface ,
20+ WinUsb_Initialize , WinUsb_ReadPipe , WinUsb_ResetPipe , WinUsb_SetCurrentAlternateSetting ,
21+ WinUsb_SetPipePolicy , WinUsb_WritePipe , WINUSB_INTERFACE_HANDLE , WINUSB_SETUP_PACKET ,
2222 } ,
2323 Foundation :: { GetLastError , ERROR_IO_PENDING , ERROR_NOT_FOUND , FALSE , HANDLE , TRUE } ,
2424 System :: IO :: { CancelIoEx , OVERLAPPED } ,
@@ -498,6 +498,23 @@ impl WindowsInterface {
498498 }
499499 state. endpoints . set ( address) ;
500500
501+ if Direction :: from_address ( address) == Direction :: In {
502+ unsafe {
503+ let enable: u8 = 1 ;
504+ let r = WinUsb_SetPipePolicy (
505+ self . winusb_handle ,
506+ address,
507+ Usb :: RAW_IO ,
508+ size_of_val ( & enable) as u32 ,
509+ & enable as * const _ as * const c_void ,
510+ ) ;
511+ if r != TRUE {
512+ let err = GetLastError ( ) ;
513+ warn ! ( "Failed to enable RAW_IO on endpoint {address:02X}: error {err:x}" , ) ;
514+ }
515+ }
516+ }
517+
501518 Ok ( WindowsEndpoint {
502519 inner : Arc :: new ( EndpointInner {
503520 address,
0 commit comments