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

For XReal Air 1/Air 2 Pro on Windows, its IMU HID Device aways timeout on the first command to turn off IMU stream #13

Open
tribbloid opened this issue Apr 24, 2024 · 11 comments

Comments

@tribbloid
Copy link

Just started testing it on Windows (x86 processor, running read_sensors example), both the glasses HID & IMU HID devices can be found. But on initialisation, read_timeout will return 0 bit of data (debugging screenshot attached)

image

this will lead to the following error:

thread 'main' panicked at examples\read_sensors.rs:8:37:
called `Result::unwrap()` on an `Err` value: NotFound
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:647
   1: core::panicking::panic_fmt
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\panicking.rs:72
   2: core::result::unwrap_failed
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\result.rs:1649
   3: enum2$<core::result::Result<alloc::boxed::Box<dyn$<ar_drivers::ARGlasses>,alloc::alloc::Global>,enum2$<ar_drivers::Error> > >::unwrap
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\result.rs:1073
   4: read_sensors::main
             at .\examples\read_sensors.rs:8
   5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\ops\function.rs:250
   6: core::hint::black_box
             at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\hint.rs:334
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I wonder if you have seen similar things on Windows? Is there a configuration I have to set before using it?

@SimDoes
Copy link

SimDoes commented Apr 24, 2024

I also have the same issue using the XReal Air 2 Pro. The same code works on Mac OS but not Windows.

@badicsalex
Copy link
Owner

badicsalex commented Apr 24, 2024

I have to admit, I never tried the code on windows.

This seems like an issue with the hidapi crate, and should probably be debugged there. It might be worthwhile to try the new-ish windows-native feature flag on it: https://www.reddit.com/r/rust/comments/192aa3h/comment/kh6h8lu/

@SimDoes
Copy link

SimDoes commented Apr 24, 2024

Tried with hidapi 2.6.1 (where the reddit comment issue was already fixed) with windows-native feature enabled but still get the same error.

@tribbloid tribbloid changed the title For XReal Air 1 on Windows, the IMU HID Device aways timeout on the first command to turn off IMU stream For XReal Air 1/Air 2 Pro on Windows, its IMU HID Device aways timeout on the first command to turn off IMU stream Apr 24, 2024
@tribbloid
Copy link
Author

@SimDoes thanks, just changed the title.

hidapi-rs only has 1 unit test, which runs successfully but doesn't show much. That's my only attempt to fix it so far :-< Will try to compile & test the C library later

@tribbloid
Copy link
Author

there are 2 rust runtime in Windows: one built on MSVC (which I used for test) and the other on GCC

@SimDoes are you also using the MSVC one?

@SimDoes
Copy link

SimDoes commented May 7, 2024

there are 2 rust runtime in Windows: one built on MSVC (which I used for test) and the other on GCC

@SimDoes are you also using the MSVC one?

To be honest I have no clue, all I know is that I tried with windows-native feature flag enabled/not for hidapi-rs. Source code here might help.

@kkota1
Copy link

kkota1 commented Jun 6, 2024

This fixed Rokid Max on windows for me. Can someone confirm Xreal:

3rl-io/headset-utils@1afb879

@badicsalex
Copy link
Owner

@kkota1
It's really weird that "not detaching" the kernel driver helps. I don't really know what that even means on windows, because I never dove that deep into libusb.

Which driver are you using?

@kkota1
Copy link

kkota1 commented Jun 7, 2024

@badicsalex the error message was something like “that method does not exist” so libusb for windows doesn’t have it . I forked peng’s fusion code and made some changes in the repo linked above

@tribbloid
Copy link
Author

I'll test XReal Air 1 on Windows in the weekend, thanks a lot @kkota1 !

@tribbloid
Copy link
Author

nope, got the same error:

can't find RokidAir: Glasses not found
can't find NrealAir: Packet timeout
can't find NrealLight: Hidapi error
can't find GrawoowG530: Glasses not found
can't find MadGazeGlow: Glasses not found
Glasses not found

The problem is always IMU, not the glasses itself.

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