OpenHMD / OpenHMD

Free and Open Source API and drivers for immersive technology.
Boost Software License 1.0
1.23k stars 195 forks source link

Display off on HP Reverb G2 #323

Open hi7 opened 3 years ago

hi7 commented 3 years ago

I have build from master and when I run the simple example I got: [EE] Failed to issue command 08: 17 00 01 [EE] Could not read config from the firmware resolution: 0 x 0

l33tlinuxh4x0r commented 3 years ago

I am thinking about getting this headset... Is it supported at all yet? Does it work at all with OpenHMD/Linux?

letoram commented 3 years ago

Not supported yet, the magic sequence for turning the display on has changed from the G1 to the G2.

l33tlinuxh4x0r commented 3 years ago

How difficult would it be to find the new magic sequence and add it to OpenHMD?

thaytan commented 3 years ago

https://github.com/thaytan/OpenHMD/tree/dev-reverb-g2 lights up the reverb G2 for me if anyone wants to try that. There's lots more to do besides of course - eye rotations is wrong and there's very noticeable gyro drift on mine.

I didn't find a fix for the [EE] Failed to issue command 08: 17 00 01 error. It happens reliably on the first attempt after plugging in, but it works on the 2nd attempt.

hi7 commented 3 years ago

With https://github.com/thaytan/OpenHMD/tree/dev-reverb-g2 I got rid of the error message "[EE] Failed to issue command 08: 17 00 01" at second attempt to plug in, but I still got no light. Do I miss something.

thaytan commented 3 years ago

Others on IRC have also said this doesn't work for them... but it does for me, so there's something else going on.

l33tlinuxh4x0r commented 3 years ago

I haven't tried it yet but maybe the initialization code might be generated basted on HWID or serial number in addition (essentially making every initialization code unique) so that it would work for you but not everyone else? Just a theory. I'll boot to Linux and try in a bit.

thaytan commented 3 years ago

There is nothing uniquely extracted from my headset in that sequence - I just fiddled with the timing of the G1 sequence and added some retries to the config retrieval

l33tlinuxh4x0r commented 3 years ago

OK so I tested it... My display doesn't light up also I needed to run as root to get it working. The simple test program then seemed to work. I will try running a second time to see if it wakes up. 2nd time it still doesn't light up but it is "working".

thaytan commented 3 years ago

If you need to run as root, then you are missing a udev rule. https://gitlab.freedesktop.org/monado/utilities/xr-hardware has a rule for the G2 already.

l33tlinuxh4x0r commented 3 years ago

If you need to run as root, then you are missing a udev rule. https://gitlab.freedesktop.org/monado/utilities/xr-hardware has a rule for the G2 already.

Thanks.

l33tlinuxh4x0r commented 3 years ago

I get the tracking now but no screen on.

thaytan commented 3 years ago

I guess when we understand why it's working for me it'll be obvious in hindsight.

l33tlinuxh4x0r commented 3 years ago

I guess when we understand why it's working for me it'll be obvious in hindsight.

What OS are you using?

thaytan commented 3 years ago

I'm testing on a Fedora system

l33tlinuxh4x0r commented 3 years ago

I'm testing on a Fedora system

Have you tried using a Live system or a fresh install on another disk to see if you can replicate your results?

EDIT: Not that is should matter but are you using X11 or wayland?

l33tlinuxh4x0r commented 3 years ago

OK... I got the screen to come on!!! I'm using Archlinux with X11, gnome and the latest branch from thaytan.

This time I did git clone --branch dev-reverb-g2 https://github.com/thaytan/OpenHMD.git

instead of just git clone. Also it didn't seem to work the first time. Now it is lit up... It doesn't want to turn off though.

Also not sure if it is necessary but I turned on the controllers before trying to activate the headset as well.

thaytan commented 3 years ago

Ah. If you didn't switch branches before, it would not have been running the Reverb init code, and just treating it as an unknown WMR headset.

l33tlinuxh4x0r commented 3 years ago

Ah. If you didn't switch branches before, it would not have been running the Reverb init code, and just treating it as an unknown WMR headset.

Yeah that was the issue... I'm curious if that is why other people were having issues as well.

l33tlinuxh4x0r commented 3 years ago

I am getting my headset to turn on 100% of the time. I even tried to play steamvr using SteamVR-OpenHMD however I couldn't get that to work.. It did wake up the headset but it wouldn't let me display anything... It just displays as another desktop. I can't use it for VR.

thaytan commented 3 years ago

This is just init code - the driver still needs to report the right screen resolution and viewport mappings before SteamVR will be able to find it, and distortion info if we want it to look any good

hi7 commented 3 years ago

I'm on Fedora too and sometimes the G2 got detected with some flicker on my main monitor but no light on the G2 with dev-reverb-g2 branch.

thaytan commented 3 years ago

I'm on Fedora too and sometimes the G2 got detected with some flicker on my main monitor but no light on the G2 with dev-reverb-g2 branch.

Are you able to test on Windows on the same hardware / ports?

hi7 commented 3 years ago

SteamVR/WMR works with the G2 on Win10, if you mean that.

thaytan commented 3 years ago

Thanks yes - there's enough people have trouble with G2 even under Windows that I want to make sure it's expected to work when testing here :)

l33tlinuxh4x0r commented 3 years ago

This is just init code - the driver still needs to report the right screen resolution and viewport mappings before SteamVR will be able to find it, and distortion info if we want it to look any good

Is anyone working on this? If not could you please point me in the right direction so I can try to tinker with it.

thaytan commented 3 years ago

I probably won't be pushing it further in the next few weeks. https://github.com/thaytan/OpenHMD/blob/670a2e666d217a4f218239c3e96f8f3e709ab868/src/drv_wmr/wmr.c#L533 is the right area if you want to play. I think it should be getting the right resolution details from the config blob already actually - so I'm not sure why Steam didn't find it.

l33tlinuxh4x0r commented 3 years ago

Just rebuilt everything as root and installed the latest OpenHMD thaytan version and it is working in steamVR! only problem is that the video is rotated 90 degreees to the right. So I need to flip the image 90 degrees left to be able to test more. P.S. I had to enable direct display mode otherwise it just overlays stuff on my desktop. With direct display mode it appears to be working!

EDIT: Looks like it is a sensor that is spinning it to the right 90 degrees. As for a split second on boot if I have the headset up to my face while launching it is correct, then it quickly rotates to the right and stops.

l33tlinuxh4x0r commented 3 years ago

Looks like the controllers aren't working either and no VR programs will run but the headset is active and at the "mountain" screen 90 degrees flipped.

Looks like if the headset if off and SteamVR is run then it works correctly... Like from a fresh plugin... If the headset is already on then SteamVR doesn't work. Is there a way to manually reset/power cycle/turn off the device without unplugging it?

I forgot that I had unregistered the driver, had to reregister it and now steam appears to be working again.

EDIT: Looks like SteamVR home is working now too.

l33tlinuxh4x0r commented 3 years ago

I got no man's sky to run, no controllers and everything is 90 degrees rotated... hope that this helps. Also not as clear as in windows so maybe the lens distortion is wrong. Screenshot from 2021-03-28 13-51-51

l33tlinuxh4x0r commented 3 years ago

For anyone that wants to test/help, I'm posting how I got OpenHMD and Steam working.

mkdir VRStuff
cd VRStuff
git clone --recursive https://github.com/ChristophHaag/SteamVR-OpenHMD.git
cd SteamVR-OpenHMD/subprojects
rm openhmd -R
git clone --branch dev-reverb-g2 https://github.com/thaytan/OpenHMD.git openhmd
cd ..
mkdir build
cd build
cmake ..
make
cd ../..
git clone --branch dev-reverb-g2 https://github.com/thaytan/OpenHMD.git
cd OpenHMD
mkdir build
cd build
cmake ..
make
sudo make install
cd ../..
cd SteamVR-OpenHMD
./register.sh

That should get you up and running... Don't forget to enable direct display mode once you get SteamVR working so that it displays on your headset.

ghost commented 3 years ago

You can install OpenHMD globally, but AFAIK you don't have to. SteamVR uses the copy in the SteamVR-OpenHMD folder. Correct me if I'm wrong.

l33tlinuxh4x0r commented 3 years ago

You can install OpenHMD globally, but AFAIK you don't have to. SteamVR uses the copy in the SteamVR-OpenHMD folder. Correct me if I'm wrong.

I will test this... It didn't seem to work before but I will test again and report back.

l33tlinuxh4x0r commented 3 years ago

You can install OpenHMD globally, but AFAIK you don't have to. SteamVR uses the copy in the SteamVR-OpenHMD folder. Correct me if I'm wrong.

You are correct... No need for a global install. Will do a reboot to be 100% sure in a bit. EDIT: I just tested and you are correct. It works without a global install. However I did have to run SteamVR twice to get it to work, the first time it threw an error, the second time it came up with the usual problems.

Updated instructions:

mkdir VRStuff
cd VRStuff
git clone --recursive https://github.com/ChristophHaag/SteamVR-OpenHMD.git
cd SteamVR-OpenHMD/subprojects
rm openhmd -R
git clone --branch dev-reverb-g2 https://github.com/thaytan/OpenHMD.git openhmd
cd ..
mkdir build
cd build
cmake ..
make
cd ..
./register.sh
l33tlinuxh4x0r commented 3 years ago

I ran steam from terminal and got a bunch of [EE] unknown message type: errors. The number changed every time I either moved the HMD error 23 iirc and a bunch of different error numbers when I moved the controllers.

ghost commented 3 years ago

The [EE] errors are printed by OpenHMD AFAIK. I have not done this myself, but if things are generally working then I would blame it on deficiencies in OpenHMD's driver for your device.

l33tlinuxh4x0r commented 3 years ago

I have made some changes to thaytan's code... First Headsets should always work now even on cold boot! No more having to run OpenHMD 2 or 3 times to get your headset to work. I also separated reverb and reverb g2 info and error messages to be more clear. The above problems are still a thing though... 90 degree rotation, controllers don't work etc.

I have updated instructions for anyone that wants to test. Also I put it in master not dev branch so it is easier to checkout.

mkdir VRStuff
cd VRStuff
git clone --recursive https://github.com/ChristophHaag/SteamVR-OpenHMD.git
cd SteamVR-OpenHMD/subprojects
rm openhmd -R
git clone --branch dev-reverb-g2 https://github.com/l33tlinuxh4x0r/OpenHMD.git openhmd
cd ..
mkdir build
cd build
cmake ..
make
cd ..
./register.sh

Here is my repo for review https://github.com/l33tlinuxh4x0r/OpenHMD.git

thaytan commented 3 years ago

That's a bit ugly. By rebasing on my repo's git master instead of upstream you've pulled in extra commits that can never go upstream (me updating the README to provide Rift status updates for example), and by squashing all the existing G2 commits into one you've thrown away attribution and made it hard to see what you've changed.

Finally, a potentially infinite loop reading the config isn't upstreamable. It has to give up at some point.

l33tlinuxh4x0r commented 3 years ago

That's a bit ugly. By rebasing on my repo's git master instead of upstream you've pulled in extra commits that can never got upstream (me updating the README to provide Rift status updates for example), and by squashing all the existing G2 commits into one you've thrown away attribution and made it hard to see what you've changed.

Finally, a potentially infinite loop reading the config isn't upstreamable. It has to give up at some point.

Thanks for the heads up... I will try to fix the git repos... I'm not very good at git unfortunately.

I figured that the infinite loop was a bad thing. Maybe I could make it loop like 10 times or something?

EDIT: I reworked the Repo... I deleted my messed up stuff, forked your work (again) and pushed to the correct branch. This should be much easier to compare now.

l33tlinuxh4x0r commented 3 years ago

I also made a hard limit of 10 tries for getting the config from the headset. That should be enough. My headset seems to need 3 checks, not sure about others. I might play around with it more to see if there is a more elegant way of getting the config. Maybe just pinging the headset a couple of times before trying? Not sure how to code that though.

thaytan commented 3 years ago

I'd like to restructure all that code to:

Also, your idea to keep things on master in your repo isn't bad. Jump back on IRC if you need git help.

thaytan commented 3 years ago

If we could it would be better to figure out what the [EE] Failed to issue command 08: 17 00 01 return code actually means while reading firmware and handle it - that would avoid needing to retry at all.

thaytan commented 3 years ago

I've merged https://github.com/thaytan/OpenHMD/pull/35 from @ph5 into my dev-reverb-g2 branch, which fixes config reads properly here.

l33tlinuxh4x0r commented 3 years ago

I've merged thaytan#35 from @pH5 into my dev-reverb-g2 branch, which fixes config reads properly here.

I can confirm that this works.

l33tlinuxh4x0r commented 3 years ago

@thaytan In my experience with the new error 23 fix the following lines of code aren't needed anymore. For me it gets the config on the first try every time now.

    // Try twice to read the config. It fails the first time on HP G2
    // after a fresh plug-in
    if (config == NULL)
        config = read_config(priv);
l33tlinuxh4x0r commented 3 years ago

Should we mark this bug as fixed since the device turns on now and open another bug for the rotation/sensors/controllers not working?

TheOnlyJoey commented 3 years ago

Should we mark this bug as fixed since the device turns on now and open another bug for the rotation/sensors/controllers not working?

Once a PR has been merged we can close this topic, which is not the case at this moment.

l33tlinuxh4x0r commented 3 years ago

Is anyone doing a pull request? What is holding this up, just lack of time?

EDIT: I just saw the reverb pull request but not the g2 one. Is there a schedule of when pull requests are approved?

TheOnlyJoey commented 3 years ago

Is anyone doing a pull request? What is holding this up, just lack of time?

Please don't spam the issue, things happen when they happen.

LoganDark commented 3 years ago

l'm interested in using OpenHMD as a replacement for WMR on machines without appx support (so can't run the Windows Mixed Reality Portal app). l own a HP Reverb G2 as well. ls there anything l can do to help the process of adding support for this headset?