minhe7735 / GearVR-Controller-WIndows

GearVR-Controller on windows with remap capabilities.
MIT License
22 stars 5 forks source link

Restricted service #8

Closed Slion closed 2 years ago

Slion commented 2 years ago

The other day it was working just fine but today I just can't get the connection to work. I keep getting the following error: Restricted service: Status=AccessDenied Can't read characteristics. Press Control+Shift+F5 before starting program again.

No matter how many time I restart the app it's the same issue.

Slion commented 2 years ago

I tried a lot of stuff to get it working but nothing worked. No amount of pairing and reboot seems to get it to work again.

minhe7735 commented 2 years ago

https://github.com/minhe7735/GearVR-Controller-WIndows/blob/0ef05797f62f5e377362f7105a61095950e30e1c/GearVR%20Controller/MainProgram.cs#L535

try commenting this line out and see, that issue used to happen quite often when I first started working on this project. It barely happens now but still pops up once in a while.

Slion commented 2 years ago

It was happening from time to time before for me too but usually a restart would fix it.

I could connect the controller to a Samsung S7 Edge with the Oculus app, it did check for firmware update and I could go through the calibration.

Sometimes it connects briefly but then drops, it also looks like it was lagging, very slow response to mouse move. I could get the trackpad to work somehow by leaving the controller on the table and just touching the trackpad. As soon as I pick the controller the connection drops somehow.

Similar issues with: https://github.com/ilyabru/GearVrController4Windows I could connect like once and I was getting values but it lags and when I pick it up it disconnects.

PairingRequestedHandler registered
PairingRequestedHandler unregistered
Connected in 1 tries
Get_Characteristics(service);
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.dll
INFO: write to characteristic Operation aborted (0x80004004 (E_ABORT))
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.dll
'GearVR Controller.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GearVR Controller.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GearVR Controller.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GearVR Controller.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.IO.MemoryMappedFiles.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (0x80004004 (E_ABORT))
   at GearVR_Controller.MainProgram.Get_Characteristics(GattDeviceService myService) in C:\Dev\GitHub\GearVR-Controller-WIndows\GearVR Controller\MainProgram.cs:line 559Successfully registered for notifications
Slion commented 2 years ago

I'm going to leave the batteries out for the night, see if that helps but I doubt it. I wonder if there is a way to reset the controller.

Slion commented 2 years ago

Changed the batteries even though they were showing 59%. Some issues, showing 76% charge.

minhe7735 commented 2 years ago

The issue maybe due to not disconnecting properly. when I was testing out your pull request, it wouldn't auto connect when I close the app and reopen it. By telling it to disconnect on close did resolve that issue. 0ef05797f62f5e377362f7105a61095950e30e1c

Slion commented 2 years ago

This morning after rebooting the PC again I could pair again and now it works. I did switch back to master pull your changes but I have not closed the application yet so that can't be it. Though I'm sure they help and make sense. I blame Windows for being so unreliable with Bluetooth.

Which Bluetooth hardware are you using? I'm using Asus BT-400.

minhe7735 commented 2 years ago

Techkey USB Mini Bluetooth 5.0 EDR. Not sure if Bluetooth 5 with EDR makes a difference.

Slion commented 2 years ago

Not sure if Bluetooth 5 with EDR makes a difference.

Seems to be working well enough when it wants to with Bluetooth 4.0 on that Asus BT-400. Closing this issue as the fix was to try again in the morning 😁 Thanks for the hardware tip I'll be trying it.

Slion commented 2 years ago

I've switched from that Asus BT-400 to a UGREEN Bluetooth 5.0 USB Adapter and it seems that dongle performs much better with any device apparently. Device scan is pretty much instantaneous compare to the sluggish BT-400. Connection to the GearVR Controller is also much faster.