cybereality / godot-space-mouse

Enables 6 degrees of freedom control for the viewport camera in the Godot editor.
MIT License
38 stars 10 forks source link

Input ignored on Windows, Godot 3.4.4 #3

Closed goudcode closed 2 years ago

goudcode commented 2 years ago

When I tried to use this addon on Godot 3.4.4, Windows 10 x64 and using a SpaceMouse Wireless, nothing will happen when I move the mouse.

How can I troubleshoot this and possibly help with a solution?

Steps taken:

afbeelding afbeelding

cybereality commented 2 years ago

It's possible your specific model has a code I did not account for. I only have two of the devices physically, but I added code for some other popular models (but was not able to test them to verify). I would suggest downloading this command-line app called hidapitester, which is based on the library I used.

https://github.com/todbot/hidapitester/releases/tag/0.2

You can extract that somewhere, and then inside that folder, run this on the command line terminal:

hidapitester.exe --list

You should see a long list of every USB device on your system. There will be entries for 3Dconnexion, they should all be the same, so just copy the whole line and post it here. That will let me know if you have a newer model number I was not able to add or whether the issue is some other bug. Thanks for reporting this.

goudcode commented 2 years ago

This is the 3DConnexion entry in that list:

If I look in the libspacemouse.c I can see an entry for this device.

cybereality commented 2 years ago

Right. So that is the same model I have, and I did test on Windows 11 and it was working. Let me double check and see if there is anything off on my computer. I mainly develop on Ubuntu, I only use Windows for testing.

cybereality commented 2 years ago

Strange. I just tested it and Windows is no longer working, even with the first version of the code. I'll need some time to investigate this. It doesn't make any sense to me, because I opened the same project that I'm sure I tested, and I have not touched that code. However, I did do a Windows Update recently, so it perhaps broke something (maybe a security update), I'm not sure.

goudcode commented 2 years ago

Let me know If I can test something or help out.

cybereality commented 2 years ago

I got it to work with the older wired version of the Space Navigator. So I can confirm the libraries I am using still work, and there is nothing wrong with my code. It also seems to work with or without the 3Dconnexion drivers, so I don't think there is any incompatibility there. My best guess is that Microsoft changed something about how the wireless drivers work (most likely Bluetooth related). The reason I think this is because the last Windows Update update I did (after I had tested the Space Mouse plug-in, before I released it) fixed a Bluetooth issue I have had for months where my speakers would not work. So my guess at this time is that it is something driver related on Windows or with the Bluetooth stack. But this may be complicated to fix, so please give me a few days to investigate. As a work around, for the time being, you can connect the device directly to the computer via a Micro-USB cable and that does still work. Thanks.

cybereality commented 2 years ago

Hey @goudcode I did some more research, but I was not able to get it working on wireless yet. Wired seems to work 100%. So if it's not a huge problem, try plugging in the charging cable to the PC, at least so you can see what the plug-in does or if you want to use it.

In terms of fixing it, it seems to be related to the way Windows allocates HID devices. It was not related to the Windows Update, I guess that was a red herring. Basically, it seems like Windows caches or store some data about which USB port the wireless adapter is connected to. This doesn't make sense to me, but I found some other threads (of another plug-in for the Space Mouse) with similar issues. Some users were able to switch the USB port, it seems ports directly on the motherboard work better than hubs. But this did not work for me.

I'm sure it did work before I released the plug-in, so my guess is that the first time I plugged in the USB receiver, it worked fine. But after unplugging it from that system, now it will no longer work. It may be fixable, but this seems like a more fundamental issue with Windows, and not anything with my code or the library I am using. And I'm pretty busy now, so I can't guarantee how long it will take to fix (if it is fixable). So, for now, I would recommend using the device wired. Thanks.

cybereality commented 2 years ago

@goudcode I have found the issue. It has to do with some bug in Windows where extra HID interfaces are created that are not the real one, and thus my library code cannot access the device (it is being blocked by these bogus devices). I have updated the README on the repository with the new instructions for how to fix this. It's basically a matter of disabling the bogus HID devices so my plug-in can gain control of the real one. I have tested this on Windows 11 and the Wireless Universal Receiver on the latest model and it works. Please confirm this fixes it for you and I will close this issue. Thanks.

goudcode commented 2 years ago

I've checked your solution and it works, disabling the bogus HID's resolved my issue.

Although it works, it seems like a unnecessary workaround. When I have some spare time I would like to find a better solution.

cybereality commented 2 years ago

Okay cool. I'm going to close for now because it looks like the issue is in Windows and not something I can fix with my code. But please feel free to comment if you find more information. Thanks.