BetterJoy icon indicating copy to clipboard operation
BetterJoy copied to clipboard

[BUG] Device undetected when reconnected after timeout

Open jesuscc1993 opened this issue 1 year ago • 0 comments

Describe the bug Turning off the device and back on prperly re-connects it. However, when the inactivity timeout kicks in the device is disconnected and on re-connection it connects but BetterJoy does not display the device. Every time inactivity kicks in I have to run back on, back off and back on again for it to finally be detected. The next reconnection after timeout always fails.

Initially described on a similar bug report; opening as its own thing since I was requested to: https://github.com/d3xMachina/BetterJoy/issues/24#issuecomment-2296735017

Expected behavior Device should display after turning on the first time after timeout.

Controller (please complete the following information):

  • Type: Pro
  • Connection: BT
  • Thirdparty : ECHTPower

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 

jesuscc1993 avatar Dec 18 '24 00:12 jesuscc1993