Enet4 / vcs-classic-hid

Library for interacting and manipulating the Atari VCS classic joystick
Apache License 2.0
4 stars 1 forks source link

OpenHidDeviceError when trying to run locally #2

Open tylerchilds opened 2 years ago

tylerchilds commented 2 years ago

Hey there! Super cool project :) I'm trying to get it to run locally-- i've tried wired and bluetooth on debian-based and arch-based distros, but when I try and run one of the examples, I get Error: OpenHidDeviceError and I'm not sure how to trouble shoot further.

tychi@pop-os:~/SourceCode/vcs-classic-hid$ cargo run --release --bin vcs-classic-hid-simon
    Finished release [optimized] target(s) in 0.02s
     Running `target/release/vcs-classic-hid-simon`
Error: OpenHidDeviceError

As an aside, I'm not super familiar with rust, but I'm hoping after getting it running locally to be able to port it to run in a web browser through WebHID similar to this example of a PlayStation Dual Shock 4 Controller.

Enet4 commented 2 years ago

Thank you for reporting. That error appears to be coming from hidapi not finding the classic controller. We might be able to diagnose this by setting up your controller and running the example program here.

use hidapi::HidApi;

fn main() {
    println!("Printing all available hid devices:");

    match HidApi::new() {
        Ok(api) => {
            for device in api.device_list() {
                println!("{:04x}:{:04x}", device.vendor_id(), device.product_id());
            }
        },
        Err(e) => {
            eprintln!("Error: {}", e);
        },
    }
}

Try running this program with either feature linux-static-libusb or linux-static-hidraw. Whichever works should also be reflected in the application using vcs-classic-hid (although the feature names and defaults are different). If the VCS classic controller can't be found in either case, there may be something missing in the operating system for an automatic detection.

tylerchilds commented 2 years ago

I was able to run the example program with the linux-static-hidraw backend. Connecting the controller over bluetooth or usb and I was able to get the output 3250:1001, which looks like it matches what vcs-classic-hid is looking for.

I just pushed up the sample repository I created to be able to run that test.