hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

Error sending data: hidapi error: IOHIDDeviceSetReport failed: (0xE0005000) unknown error code

Open aliduchuy-dev97 opened this issue 6 months ago • 3 comments

Hi, guys! I have a problem when sending data to HID devices; it always returns an error: "Error sending data: hidapi error: IOHIDDeviceSetReport failed: (0xE0005000) unknown error code." This error only appears on macOS, while Windows is good.

This is my code: **use hidapi::HidApi;

fn main() -> Result<(), Box<dyn std::error::Error>> { let api = HidApi::new()?;

let device = api.open(0x0909, 0x0053);

println!("Opening device...");

match device {
    Ok(dev) => {
        println!("Device opened successfully");

        let mut report: Vec<u8>= vec![0x00,0x40, 0x01, 0x01];
        report.resize(64, 0);

        println!("Report buffer: {:?}", report);

        println!("Sending report...");

        let result = dev.send_feature_report(&report);

        match result {
            Ok(_) => println!("Data sent successfully"),
            Err(e) => eprintln!("Error sending data: {}", e),
        }

        let mut buf = [0u8; 64];
        let bytes_read = dev.read_timeout(&mut buf, 500); // timeout 5 giây

        match bytes_read {
            Ok(bytes) => println!("Read {} bytes", bytes),
            Err(e) => eprintln!("Error reading data: {}", e),
        }

        
        println!("Device closed successfully");

    }
    Err(e) => {
        eprintln!("Failed to open device: {}", e);
        return Err(Box::new(e));
    }
}


Ok(())

}**

Please help me! Thanks, all.

aliduchuy-dev97 avatar Jun 02 '25 10:06 aliduchuy-dev97

You may want to provide more details about the device, macOS version and hidapi version.

It seems that you are not using hidapi directly but rather a language binding. You will need to mention that as well next time. Usually we will not be able to support the language binding and you need to post your application in C.

mcuee avatar Jun 02 '25 11:06 mcuee