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

[BUG] BetterJoy stuck after automatic disconnect #24

Closed
PizzaPino opened this issue Jul 15, 2024 · 12 comments
Closed

[BUG] BetterJoy stuck after automatic disconnect #24

PizzaPino opened this issue Jul 15, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@PizzaPino
Copy link

PizzaPino commented Jul 15, 2024

Describe the bug
Sometimes when my controller is automatically disconnected, the change isn't displayed in Betterjoy. Betterjoy still shows the controller as connected and ready even though it is off. Further I can't connect the controller anymore. Also pressing X leaves me forever at "Closing...". Only ending Betterjoy through the task manager fully disconnects the controller and lets me connect to it again.

Controller (please complete the following information):

  • Type: Pro Controller
  • Connection: BT

Logs

2024-07-15 11:58:23 [DEBUG]   BetterJoy v8.4.6
2024-07-15 11:58:23 [DEBUG]   OS version: Microsoft Windows NT 10.0.22631.0 x64
2024-07-15 11:58:24 [INFO]    HIDHide is enabled.
2024-07-15 11:58:24 [DEBUG]   Task UDP receive started.
2024-07-15 11:58:24 [INFO]    Motion server started on 127.0.0.1:26760.
2024-07-15 11:58:24 [INFO]    All systems go.
2024-07-15 11:58:25 [DEBUG]   Task devices notification started.
2024-07-15 12:07:47 [INFO]    [P1] Pro controller connected.
2024-07-15 12:07:47 [INFO]    [P1] Using Bluetooth.
2024-07-15 12:07:47 [INFO]    [P1] Using controller sticks calibration.
2024-07-15 12:07:47 [INFO]    [P1] Using controller sensors calibration.
2024-07-15 12:07:47 [DEBUG]   [P1] Thread send commands started.
2024-07-15 12:07:47 [DEBUG]   [P1] Thread receive reports started.
2024-07-15 12:07:47 [INFO]    [P1] Ready.
2024-07-15 13:20:59 [DEBUG]   [P1] Thread receive reports finished.
2024-07-15 13:20:59 [DEBUG]   [P1] Thread send commands finished.
2024-07-15 14:57:02 [INFO]    Closing...
@PizzaPino PizzaPino added the bug Something isn't working label Jul 15, 2024
@d3xMachina
Copy link
Owner

Maybe this will fix it :
BetterJoy.zip

If it still happens, set "DebugType" to "all" and upload the logs after it happens.
image

@PizzaPino
Copy link
Author

it didn't fix it

here's the log:
https://pastebin.com/KE1skKME

@d3xMachina
Copy link
Owner

For some reason you don't have the disconnected notification from hidapi after the power off...

Is the light on the home button off on your controller after the automatic disconnect ? Does the controller still appear as connected in the bluetooth panel of Windows ?

It's hard to fix without using a debugger. Do you have steps to reproduce the issue consistently since I haven't been able to reproduce it even once ? (I tried with a pro controller in bluetooth and autopower off enabled)

@PizzaPino
Copy link
Author

Now I just noticed that sometimes I can't even connect before the first time (at least since the version you gave me). The light is always off after the automatic disconnect and it still appears as connected in the bluetooth panel. I don't really have steps to reproduce it, it seems random to me.

Here I tried to connect the controller at 16:32.

2024-07-19 12:25:50 [DEBUG]   BetterJoy v8.4.6
2024-07-19 12:25:50 [DEBUG]   OS version: Microsoft Windows NT 10.0.22631.0 x64
2024-07-19 12:25:52 [INFO]    HIDHide is enabled.
2024-07-19 12:25:52 [DEBUG]   Task UDP receive started.
2024-07-19 12:25:52 [INFO]    Motion server started on 127.0.0.1:26760.
2024-07-19 12:25:52 [INFO]    All systems go.
2024-07-19 12:25:52 [DEBUG]   Task devices notification started.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:25:52 [DEBUG]   Notification Connected received.
2024-07-19 12:25:52 [DEBUG]   Notification Connected handled.
2024-07-19 12:27:06 [DEBUG]   Notification Connected received.
2024-07-19 12:27:06 [DEBUG]   Notification Connected handled.
2024-07-19 12:27:09 [DEBUG]   Notification Disconnected received.
2024-07-19 12:27:09 [DEBUG]   Notification Disconnected handled.
2024-07-19 12:27:09 [DEBUG]   Notification Connected received.
2024-07-19 12:27:09 [DEBUG]   Notification Connected handled.
2024-07-19 14:21:10 [DEBUG]   Notification Disconnected received.
2024-07-19 14:21:10 [DEBUG]   Notification Disconnected handled.
2024-07-19 14:25:17 [DEBUG]   Notification Connected received.
2024-07-19 14:25:17 [DEBUG]   Notification Connected handled.
2024-07-19 14:25:19 [DEBUG]   Notification Disconnected received.
2024-07-19 14:25:19 [DEBUG]   Notification Disconnected handled.
2024-07-19 14:25:19 [DEBUG]   Notification Connected received.
2024-07-19 14:25:19 [DEBUG]   Notification Connected handled.
2024-07-19 14:52:22 [DEBUG]   Notification Disconnected received.
2024-07-19 14:52:22 [DEBUG]   Notification Disconnected handled.
2024-07-19 15:02:27 [DEBUG]   Notification Connected received.
2024-07-19 15:02:27 [DEBUG]   Notification Connected handled.
2024-07-19 15:02:30 [DEBUG]   Notification Disconnected received.
2024-07-19 15:02:30 [DEBUG]   Notification Disconnected handled.
2024-07-19 15:02:30 [DEBUG]   Notification Connected received.
2024-07-19 15:02:30 [DEBUG]   Notification Connected handled.
2024-07-19 15:13:01 [DEBUG]   Notification Disconnected received.
2024-07-19 15:13:01 [DEBUG]   Notification Disconnected handled.
2024-07-19 15:15:23 [DEBUG]   Notification Connected received.
2024-07-19 15:15:23 [DEBUG]   Notification Connected handled.
2024-07-19 15:15:24 [DEBUG]   Notification Disconnected received.
2024-07-19 15:15:24 [DEBUG]   Notification Disconnected handled.
2024-07-19 15:15:24 [DEBUG]   Notification Connected received.
2024-07-19 15:15:24 [DEBUG]   Notification Connected handled.
2024-07-19 15:30:56 [DEBUG]   Notification Disconnected received.
2024-07-19 15:30:56 [DEBUG]   Notification Disconnected handled.
2024-07-19 16:32:48 [INFO]    Closing...

@jesuscc1993
Copy link

jesuscc1993 commented Aug 18, 2024

I believe I'm having the same issue; I'll describe my experience:
When the inactivity timeout triggers, the controller is powered off (leds included) but it does not disconnect from Windows.
This happens every single time for me.
When I turn it on, it reconnects to the PC but it is unable to communicate with it.
I have then to turn the controller off manually, which Windows recognizes unlike the automatic power off, and then turn it on again for the PC <> controller communication to resume.

These are my logs:

Automatic disconnect
2024-08-19 00:36:56 [DEBUG]   BetterJoy v8.4.7
2024-08-19 00:36:56 [DEBUG]   OS version: Microsoft Windows NT 10.0.19045.0 x64
2024-08-19 00:36:57 [INFO]    HIDHide is enabled.
2024-08-19 00:36:57 [DEBUG]   Task UDP receive started.
2024-08-19 00:36:57 [INFO]    Motion server started on 127.0.0.1:26760.
2024-08-19 00:36:57 [INFO]    All systems go.
2024-08-19 00:36:57 [DEBUG]   Task devices notification started.
2024-08-19 00:37:02 [INFO]    [P1] Pro controller connected.
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 98 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [INFO]    [P1] Using Bluetooth.
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Retrieve user left stick calibration data.
2024-08-19 00:37:02 [DEBUG]   [P1] left stick 1 calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Retrieve user right stick calibration data.
2024-08-19 00:37:02 [DEBUG]   [P1] right stick calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Retrieve user sensors calibration data.
2024-08-19 00:37:02 [DEBUG]   [P1] [IMU] Gyro neutral position: 0 0 0 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 18 01 10 FF FF 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: A2 80 00 80 00 00 08 80 00 08 80 0C 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 30 sent. Data: 01 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: A4 80 00 80 00 00 08 80 00 08 80 0C 80 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 40 sent. Data: 01 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: A4 80 00 80 00 00 08 80 00 08 80 0C 80 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 48 sent. Data: 01 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: A6 80 00 80 00 00 08 80 00 08 80 0C 80 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 30 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: A8 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Done with init.
2024-08-19 00:37:02 [INFO]    [P1] Using user sticks calibration.
2024-08-19 00:37:02 [INFO]    [P1] Using user sensors calibration.
2024-08-19 00:37:02 [DEBUG]   [P1] [COMMS] Connect virtual xbox controller.
2024-08-19 00:37:02 [DEBUG]   [P1] Thread send commands started.
2024-08-19 00:37:02 [DEBUG]   [P1] Thread receive reports started.
2024-08-19 00:37:02 [INFO]    [P1] Ready.
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0B 00 01 40 40 00 01 40 40 
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:02 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0C 00 01 40 40 00 01 40 40 
2024-08-19 00:37:04 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:04 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0D 00 01 40 40 00 01 40 40 
2024-08-19 00:37:04 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:37:04 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0E 00 01 40 40 00 01 40 40 
2024-08-19 00:38:02 [INFO]    [P1] Powering off.
2024-08-19 00:38:02 [DEBUG]   [P1] [COMMS] Subcommand 06 sent. Data: 00 
2024-08-19 00:38:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 78 60 00 80 00 00 08 80 00 08 80 0C 80 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:38:02 [DEBUG]   [P1] Thread receive reports finished.
2024-08-19 00:38:02 [DEBUG]   [P1] Thread send commands finished.
Manual disconnect
2024-08-19 00:39:29 [DEBUG]   BetterJoy v8.4.7
2024-08-19 00:39:29 [DEBUG]   OS version: Microsoft Windows NT 10.0.19045.0 x64
2024-08-19 00:39:29 [INFO]    HIDHide is enabled.
2024-08-19 00:39:29 [DEBUG]   Task UDP receive started.
2024-08-19 00:39:29 [INFO]    Motion server started on 127.0.0.1:26760.
2024-08-19 00:39:29 [INFO]    All systems go.
2024-08-19 00:39:30 [DEBUG]   Task devices notification started.
2024-08-19 00:39:37 [INFO]    [P1] Pro controller connected.
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: D6 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [INFO]    [P1] Using Bluetooth.
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Retrieve user left stick calibration data.
2024-08-19 00:39:37 [DEBUG]   [P1] left stick 1 calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Retrieve user right stick calibration data.
2024-08-19 00:39:37 [DEBUG]   [P1] right stick calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Retrieve user sensors calibration data.
2024-08-19 00:39:37 [DEBUG]   [P1] [IMU] Gyro neutral position: 0 0 0 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 18 01 10 FF FF 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: E0 80 00 80 00 00 08 80 00 08 80 0C 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 30 sent. Data: 01 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: E2 80 00 80 00 00 08 80 00 08 80 0C 80 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 40 sent. Data: 01 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: E4 80 00 80 00 00 08 80 00 08 80 0C 80 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 48 sent. Data: 01 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: E4 80 00 80 00 00 08 80 00 08 80 0C 80 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 30 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Response ID 21. Data: E6 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Done with init.
2024-08-19 00:39:37 [INFO]    [P1] Using user sticks calibration.
2024-08-19 00:39:37 [INFO]    [P1] Using user sensors calibration.
2024-08-19 00:39:37 [DEBUG]   [P1] [COMMS] Connect virtual xbox controller.
2024-08-19 00:39:37 [DEBUG]   [P1] Thread send commands started.
2024-08-19 00:39:37 [DEBUG]   [P1] Thread receive reports started.
2024-08-19 00:39:37 [INFO]    [P1] Ready.
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0B 00 01 40 40 00 01 40 40 
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:37 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0C 00 01 40 40 00 01 40 40 
2024-08-19 00:39:38 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:38 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0D 00 01 40 40 00 01 40 40 
2024-08-19 00:39:38 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:38 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0E 00 01 40 40 00 01 40 40 
2024-08-19 00:39:40 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 00:39:40 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0F 00 01 40 40 00 01 40 40 
2024-08-19 00:39:40 [DEBUG]   [P1] Thread send commands canceled.
2024-08-19 00:39:40 [DEBUG]   [P1] Thread receive reports canceled.
2024-08-19 00:39:40 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 00:39:40 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 00:39:40 [DEBUG]   [P1] [COMMS] Subcommand 30 sent. Data: 00 
2024-08-19 00:39:40 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 00:39:40 [INFO]    [P1] Pro controller disconnected.
2024-08-19 00:39:44 [INFO]    Closing...
2024-08-19 00:39:44 [DEBUG]   Task devices notification canceled.
2024-08-19 00:39:44 [INFO]    HIDHide is disabled.
2024-08-19 00:39:44 [DEBUG]   Task UDP receive finished.
2024-08-19 00:39:44 [INFO]    Motion server stopped.
2024-08-19 00:39:44 [DEBUG]   Closed.

@d3xMachina
Copy link
Owner

I found a bug in hidapi which could cause this (I still can't reproduce on my end).
Try this build @PizzaPino @jesuscc1993 and make sure to replace the x64 and x86 folders which contain hidapi.dll :
BetterJoy.zip

@jesuscc1993
Copy link

jesuscc1993 commented Aug 19, 2024

I stopped the app, replaced all files and tried again. It didn't work the first time, so I tried a second one and the result is the same. There is no visible difference in behavior and the issue remains.

@PizzaPino
Copy link
Author

PizzaPino commented Aug 19, 2024

This new build didn't fix it for me either.

Also I think the stuck at closing is a separate issue because I just got it without evening connecting a controller.

@d3xMachina
Copy link
Owner

I've made many changes to power off/disconnect and some fixes, hope it helps :
BetterJoy.zip

@jesuscc1993 If you still have issues, make a separate one as it's probably not related. The above changes could help both cases thought.

@jesuscc1993
Copy link

jesuscc1993 commented Aug 19, 2024

The new build fixes half of the issue.
It does properly disconnect on timeout, every time.
However, the next time I power off the controller it connects but it doesn't show on Betterjoy nor Windows.
If I turn it off and on again, then both pick it up again.
I'll attach logs in a sec.

Edit: here are the logs:

LogDebug.txt
2024-08-19 16:24:59 [DEBUG]   BetterJoy v8.4.7
2024-08-19 16:24:59 [DEBUG]   OS version: Microsoft Windows NT 10.0.19045.0 x64
2024-08-19 16:25:00 [INFO]    HIDHide is enabled.
2024-08-19 16:25:00 [DEBUG]   Task UDP receive started.
2024-08-19 16:25:00 [INFO]    Motion server started on 127.0.0.1:26760.
2024-08-19 16:25:00 [INFO]    All systems go.
2024-08-19 16:25:00 [DEBUG]   Task devices notification started.
2024-08-19 16:25:00 [INFO]    [P1] Pro controller connected.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: hid_write/GetOverlappedResult: (0x000003E3) The I/O operation has been aborted because of either a thread exit or an application request.
2024-08-19 16:25:00 [INFO]    [P1] Using Bluetooth.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [ERROR]   [P1] ReadSPI error.
2024-08-19 16:25:00 [DEBUG]   [P1] left stick 1 calibration data: 0 0 0 0 0 0 
2024-08-19 16:25:00 [DEBUG]   [P1] right stick calibration data: 0 0 0 0 0 0 
2024-08-19 16:25:00 [DEBUG]   [P1] [IMU] Gyro neutral position: 0 0 0 
2024-08-19 16:25:00 [ERROR]   [P1] Error while reading calibration datas.
2024-08-19 16:25:00 [INFO]    [P1] Resetting connection.
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand 06 sent. Data: 01 
2024-08-19 16:25:00 [DEBUG]   [P1] [COMMS] Subcommand write error: WriteFile: (0x0000048F) The device is not connected.
2024-08-19 16:25:00 [ERROR]   [P1] Could not connect. (reset calibration)
   at BetterJoy.Joycon.Attach()
   at BetterJoy.JoyconManager.OnDeviceConnected(String path, String serial, ControllerType type, Boolean isUSB, Boolean isThirdparty, Boolean reconnect)
2024-08-19 16:25:00 [INFO]    [P1] Pro controller disconnected.
2024-08-19 16:25:02 [INFO]    [P1] Pro controller connected.
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 8E 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [INFO]    [P1] Using Bluetooth.
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Retrieve user left stick calibration data.
2024-08-19 16:25:02 [DEBUG]   [P1] left stick 1 calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Retrieve user right stick calibration data.
2024-08-19 16:25:02 [DEBUG]   [P1] right stick calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Retrieve user sensors calibration data.
2024-08-19 16:25:02 [DEBUG]   [P1] [IMU] Gyro neutral position: 0 0 0 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 18 01 10 FF FF 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 98 80 00 80 00 00 08 80 00 08 80 0C 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 30 sent. Data: 01 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 9A 80 00 80 00 00 08 80 00 08 80 0C 80 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 40 sent. Data: 01 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 9A 80 00 80 00 00 08 80 00 08 80 0C 80 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 48 sent. Data: 01 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 9C 80 00 80 00 00 08 80 00 08 80 0C 80 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 30 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 9E 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Done with init.
2024-08-19 16:25:02 [INFO]    [P1] Using user sticks calibration.
2024-08-19 16:25:02 [INFO]    [P1] Using user sensors calibration.
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Connect virtual xbox controller.
2024-08-19 16:25:02 [DEBUG]   [P1] Thread send commands started.
2024-08-19 16:25:02 [DEBUG]   [P1] Thread receive reports started.
2024-08-19 16:25:02 [INFO]    [P1] Ready.
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:02 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0C 00 01 40 40 00 01 40 40 
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:02 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0D 00 01 40 40 00 01 40 40 
2024-08-19 16:25:03 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:03 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:03 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0F 00 01 40 40 00 01 40 40 
2024-08-19 16:25:04 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:25:04 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 00 00 01 40 40 00 01 40 40 
2024-08-19 16:25:04 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:05 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:07 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:08 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:09 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:10 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:12 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:13 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:14 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:15 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:17 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:18 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:19 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:21 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:22 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:23 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:24 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:26 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:27 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:28 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:29 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:31 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:32 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:33 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:34 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:36 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:37 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:38 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:39 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:41 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:42 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:43 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:44 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:46 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:47 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:48 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:50 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:51 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:52 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:53 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:55 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:56 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:57 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:25:58 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:00 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:01 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:02 [INFO]    [P1] Powering off.
2024-08-19 16:26:02 [DEBUG]   [P1] [COMMS] Subcommand 06 sent. Data: 00 
2024-08-19 16:26:02 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 70 40 00 80 00 00 08 80 00 08 80 0C 80 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:02 [DEBUG]   [P1] [COMMS] Request PowerOff: ok=True
2024-08-19 16:26:02 [DEBUG]   [P1] Thread receive reports finished.
2024-08-19 16:26:02 [DEBUG]   [P1] Thread send commands finished.
2024-08-19 16:26:02 [INFO]    [P1] Pro controller disconnected.

There are no new logs when I turn the controller on again for the first time.
When I turn it off and on again, this logs:

LogDebug.txt
2024-08-19 16:26:39 [INFO]    [P1] Pro controller connected.
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 3F 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 7C 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [INFO]    [P1] Using Bluetooth.
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Retrieve user left stick calibration data.
2024-08-19 16:26:39 [DEBUG]   [P1] left stick 1 calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Retrieve user right stick calibration data.
2024-08-19 16:26:39 [DEBUG]   [P1] right stick calibration data: 2047 2047 2048 2048 2048 2048 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Retrieve user sensors calibration data.
2024-08-19 16:26:39 [DEBUG]   [P1] [IMU] Gyro neutral position: 0 0 0 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 18 01 10 FF FF 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 8A 80 00 80 00 00 08 80 00 08 80 0C 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 30 sent. Data: 01 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 8C 80 00 80 00 00 08 80 00 08 80 0C 80 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 40 sent. Data: 01 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 8E 80 00 80 00 00 08 80 00 08 80 0C 80 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 48 sent. Data: 01 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 90 80 00 80 00 00 08 80 00 08 80 0C 80 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 03 sent. Data: 30 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Response ID 21. Data: 92 80 00 80 00 00 08 80 00 08 80 0C 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Done with init.
2024-08-19 16:26:39 [INFO]    [P1] Using user sticks calibration.
2024-08-19 16:26:39 [INFO]    [P1] Using user sensors calibration.
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Connect virtual xbox controller.
2024-08-19 16:26:39 [DEBUG]   [P1] Thread send commands started.
2024-08-19 16:26:39 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:39 [DEBUG]   [P1] Thread receive reports started.
2024-08-19 16:26:39 [INFO]    [P1] Ready.
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0C 00 01 40 40 00 01 40 40 
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:39 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0D 00 01 40 40 00 01 40 40 
2024-08-19 16:26:40 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:40 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:40 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 0F 00 01 40 40 00 01 40 40 
2024-08-19 16:26:40 [DEBUG]   [P1] [RUMBLE] Rumble data Received: XInput
2024-08-19 16:26:40 [DEBUG]   [P1] [RUMBLE] Rumble data sent: 10 00 00 01 40 40 00 01 40 40 
2024-08-19 16:26:41 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:43 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:44 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 
2024-08-19 16:26:45 [DEBUG]   [P1] [COMMS] Subcommand 38 sent. Data: 0F 1F 10 11 FF 

@d3xMachina
Copy link
Owner

d3xMachina commented Aug 19, 2024

Please make a separate issue as it's not related. Also it looks like the issue #18

Edit : Nvm it's a different issue the #18

@PizzaPino
Copy link
Author

Well for me it seems to have fixed the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants