Sample Header Ad - 728x90

Hidraw doesn't find device without device-specific kernel driver being loaded

1 vote
1 answer
463 views
I'm trying to make a userspace Linux program that talks to a Bluetooth HID device, specifically the Wii remote . When the hid-wiimote kernel module is loaded, I can use the hidapi library (with the linux-static-hidraw backend) to talk to the device directly, but the kernel driver does periodic polling and changes the operation mode often. When I blacklist the module in /etc/modprobe.d, the LEDs on the controller flash forever and the library returns this error: > No HID devices with requested VID/PID found in the system. I'm pretty sure I've set up the udev permissions properly, here's my custom rule file:
KERNEL=="hidraw*", KERNELS=="0005:057E:*.*", MODE="0666"
For reference, here's my minimal Rust example:
/**
 * [dependencies]
 * hidapi = { version = "2.4.0", default-features = false, features = ["linux-static-hidraw"] }
 */

use hidapi::HidApi;

fn main() {
    let hid = HidApi::new().unwrap();
    let wiimote = hid.open(0x057e, 0x0306).unwrap(); // error if hid-wiimote isn't loaded
}
Asked by Honbra (21 rep)
Jul 21, 2023, 04:22 PM
Last activity: Sep 17, 2023, 02:28 PM