SteamVR

SteamVR

turiyag Sep 5, 2021 @ 2:21pm
HMD Not Detected 108, A better error message for the support desk
Hi Devs,

I am on the developer preview of Windows 11, and when it's rolled out on Oct 5th, I'm betting that tens of thousands of people like me will have this issue, I've fortunately solved the problem locally, but I have what I think is likely a 1 point dev ticket, just to improve the error message. I am going to copy-paste the final victory message that I sent to the helpdesk, since the helpdesk told me to post it here, but the support ticket # is: Ticket: HT-TK27-9JQK-5F4V

The root of the problem is that on Windows 11, if it uses the wrong default driver, then it will say "HMD Not Detected", even though the HMD is detectable in software, it's simply that access is denied. I hope that you could improve the error message, to say something more informative.

I guess I can't upload files here, so for the screenshots, you'll have to see the support ticket, but I really think that it's going to be super easy to give a better error code. The actual fix might be very difficult, but giving a more specific error message should be super easy.

------------- PASTED MESSAGE BELOW ------------------

I SOLVED IT.

======== FOR THE HELPDESK ========

The issue was actually with detected "best driver". Which Windows 11 seemed to think was "Virtual HID Minidriver Collection", but which *should be* "HID-compliant vendor-defined device". As the Help Desk, to fix this for people, you'll need to get them to wander into Device Manager, and click a lot of buttons in a super specific sequence. So first, you'll likely want to accurately detect the issue, I'll try to help in the next section for your devs, so that you get a better error message. I've attached a screenshot of two PowerShell windows, that show what happens when you run as administrator, and when you don't. Your devs have given you a command that's fairly deep within SteamVR, and not particularly well-documented, but if you run "vrcmd.exe --pollhmdpresent" it'll check if the HMD is present, or give you a failure message if it can't detect a HMD. If you tell the client you're supporting to run these two commands at the same time, without unplugging the device, and they see this output, that means they've got my issue: how_to_detect_the_issue_pt1.png

Now, to ♥♥♥♥♥♥' fix the issue, it's gonna be a lot of crossing the fingers that the end user is techno-savvy, because now we descend into the deep bowels of Device Manager. Here be dragons. First, you'll somehow need to get them to find the actual devices in Device Manager. Step 1 is to have all the devices be adjacent, so that they don't accidentally mess up the drivers for their other HID devices, and then can't use their keyboard or mouse. If you open Device Manager, then in the View menu, select "Devices by container". They should easily find "Valve VR Radio & HMD Mic", inside that container, they'll see 5 entries for "Virtual ID Minidriver Collection". This is the wrong driver, but Windows 11 doesn't know that there is a better one. You can unplug and replug, remove the devices and reinstall them, reinstall SteamVR, none of it will let Windows 11 realize that the devices are using the wrong driver. However, you can manually switch it to the correct one (or break it again, to simulate my issues for development).

To change over one of the devices, you can right-click it, then "Update Driver" -> "Browse my computer for drivers" -> "Let me pick from a list of available drivers on my computer", and then select "HID-compliant vendor-defined device" to fix it. Then hit Next, and finally Close. Then do that 4 more times for all the other devices using the bad "Virtual ID Minidriver Collection" driver. Then, reboot your PC.

Finally, SteamVR will work, as Admin, and as the normal user, and in Phasmophobia, you'll be able to use Voice Recognition to control the Spirit Box.

Best of luck to your support center, I assume the upcoming Windows 11 update is going to absolutely be horrendous, but hopefully, the next section, which you very very much should give to the devs, since I'mma spend like an hour writing it, will help them get you a better error message, or maybe fix it entirely before the Windows 11 release on Oct 5. Please give the devs this section as well, so that they have as much context as possible.

<3

============== FOR THE DEVS =================

Hi, I'm **SEE TICKET FOR MY NAME**, you can email me at **SEE TICKET** call me at **SEE TICKET**, or message me on Steam probably somehow, my Steam Friend Code is **SEE TICKET**. You don't need to, but I'm happy to help, and I've spent a bunch of time figuring this out, so feel free to contact me if you feel like it. I also love the Valve Index, so if you're hiring, that'd be cool too! ;)

For the dev manager, find someone who understands the hid_enumerate function in driver_lighthouse.dll, they'll be the best for this ticket.

Ok, so, if you've read the Helpdesk section above, you'll know that there's an issue in Windows 11, I didn't really get into it in the last section, but, Windows 11 has additional security on HID devices, and won't let normal programs open certain HID devices, but programs running as Administrator can open them. I presume this is something to do with like keyboards typing passwords and maybe like preventing keyloggers or something, I'm not sure, but to give the poor helpdesk a better error message than "HMD Not Detected", go to the hid_enumerate function in driver_lighthouse.dll, I'm working from Ghidra decompiled code here so you might need to do some hunting, but there's some lines that'll look something like this, except with proper variable names and probably a lot more named constants:

SetupDiGetDeviceInterfaceDetailA (DeviceInfoSet,(PSP_DEVICE_INTERFACE_DATA)&local_4a8, (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)0x0,0,local_res18,DeviceInfoData); DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)malloc((ulonglong)local_res18[0]); DeviceInterfaceDetailData->cbSize = 8; BVar3 = SetupDiGetDeviceInterfaceDetailA (DeviceInfoSet,(PSP_DEVICE_INTERFACE_DATA)&local_4a8, DeviceInterfaceDetailData,local_res18[0],(PDWORD)DeviceInfoData, DeviceInfoData); if (BVar3 != 0) { DeviceInfoData = (PSP_DEVINFO_DATA)DeviceInterfaceDetailData->DevicePath; hObject = CreateFileA((LPCSTR)DeviceInfoData,0xc0000000,3,(LPSECURITY_ATTRIBUTES)0x0,3, 0x40000000,(HANDLE)0x0); if (hObject == (HANDLE)0xffffffffffffffff) { LAB_1800cb87c: DeviceInfoData = (PSP_DEVINFO_DATA)0x0; }

Ok, so the line that's like a third from the end there, is an error detection case. On your side it may look like:

if (write_handle == INVALID_HANDLE_VALUE) {

Basically, that's telling hid_enumerate, "the device is plugged in, but Windows 11 doesn't let me talk to it". If your code reaches that line, while the vendor_id is a Valve device vendor ID, this means that the device is plugged in, and it's a Windows 11 security feature that's preventing you from accessing the device. So I would highly recommend that you put in a little check in that thing, if the write_handle is INVALID_HANDLE_VALUE, make a call to GetLastError, check to see if it's 0x05 (ACCESS_DENIED), and if it is, then instead of reporting "HMD Not Found", maybe report like, "Bad HMD Driver" or "HMD Access Denied" or something.

As for a permanent fix, rather than just a better error message, I have no suggestions. I'm betting that it's a 1 point story to make the error message, and I have no idea how you could automate the stuff I told helpdesk to do in the section above, but if you can figure that out, you deserve a raise. In the meantime, your helpdesk probably really really would like that error message to be more specific, before Windows 11 is released to the general public on Oct 5th.

Good luck, and don't hesitate to contact me if you have any questions or job openings. :P
Last edited by turiyag; Sep 8, 2021 @ 11:58am
Date Posted: Sep 5, 2021 @ 2:21pm
Posts: 0