Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm getting NotFound error when trying to open a HID device. #6

Open
Boscop opened this issue Nov 15, 2017 · 6 comments
Open

I'm getting NotFound error when trying to open a HID device. #6

Boscop opened this issue Nov 15, 2017 · 6 comments

Comments

@Boscop
Copy link

Boscop commented Nov 15, 2017

I'm trying to open my keyboard device (to get keypress events for the additional keys that it has), but I always get Err(NotFound) when trying to open() it, why?

let (vid, pid) = (0x1B1C, 0x1B11);
for device in devices.filter(|d| d.vendor_id() == vid && d.product_id() == pid) {
	let path = device.path().to_string_lossy().to_string();
	if path.contains("col03") {
		println!("{} ", path);
		match device.open() {
			Ok(handle) => {
				// ...
			}
			Err(e) => println!("{:?}", e)
		}
	}
}

According to this reponse, it should work. How can the device be "NotFound" when it clearly exists?

I have to get this working, I'd really appreciate any help on this :)

@meh
Copy link
Owner

meh commented Nov 15, 2017

What's the operating system?

@Boscop
Copy link
Author

Boscop commented Nov 16, 2017

Win 8.1

@phrohdoh
Copy link

I am hitting the same error on GNU/Linux Ubuntu 17.04 with a DS4 connected via USB.

VID and PID:

idVendor           0x054c Sony Corp.
idProduct          0x05c4 DualShock 4

As you can see here I can read data from the device via /dev/hidraw2:

thill@txps:~/src/drivers/ds4-rs$ sudo hexdump -v -e '64/1 "%02x" "\n"' /dev/hidraw2 -n64
017f807a7a08000c0000ab15090000fffffeff5d024320cd0000000000001b000001078538c33280000000008000000080000000008000000080000000008000
extern crate hid;

fn main() {
    let mgr = hid::init().unwrap();

    let vid = 0x054c;
    let pid = 0x05c4;

    for ds4 in mgr.find(Some(vid), Some(pid)) {
        let mut ds4 = match ds4.open() {
            Ok(v) => v,
            Err(e) => {
                eprintln!("ERROR: {}", e); // always prints: ERROR: Device not found.
                return;
            }
        };
    }
}

@phrohdoh
Copy link

phrohdoh commented Jan 1, 2018

I obviously cannot speak for @Boscop but my issue was the lack of proper udev rules for the DS4.

@crides
Copy link

crides commented May 23, 2020

@phrohdoh Can you explain what changes you've made to your udev rules?

@phrohdoh
Copy link

Sorry, I don't even have that machine anymore so I do not recall at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants