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
}