Skip to content

NullReferenceException in SwitchProDevice.CalibrationData() — original Switch Pro Controller (2017, PID 0x2009) fails to connect #75

Description

@Aimar-18

DS4Windows version: VIIPERRC4.3 (DS4Windows 5.0.3.0 / VIIPER 0.1.0)
OS: Windows 11 Pro
Controller: Nintendo Switch Pro Controller (original, 2017 model, HAC-013), VID 0x057E / PID 0x2009
Connection tested: Both Bluetooth and USB — same underlying failure on both

Description:
When connecting a genuine (original) Switch Pro Controller, DS4Windows detects it and starts associating it to a virtual Xbox 360 output slot, but immediately throws a NullReferenceException. Over Bluetooth the app becomes unresponsive with a full AggregateException stack trace. Over USB the connection is accepted but gets stuck at "Connecting - Waiting for stable input from the physical controller", battery shows 0%, and the same "Object reference not set to an instance of an object" error appears in the log.

Steps to reproduce:

  1. Connect a Nintendo Switch Pro Controller (VID 0x057E / PID 0x2009) via Bluetooth or USB.
  2. Start DS4Windows with Shared Mode.
  3. Controller is found and DS4Windows attempts to associate it to an Xbox 360 virtual output.
  4. Crash / hang occurs.

Log output (Bluetooth):
Using Shared Mode.
Found Controller: E8:DA:20:ED:A1:DC (BT) (Switch Pro).
VIIPER Xbox360 virtual input presentation is capped at 1000 Hz with latest-state coalescing.
Plugging in virtual Xbox 360 Controller in output slot #1
Associated input controller #1 (Switch Pro) to virtual Xbox 360 Controller in output slot #1
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
---> System.NullReferenceException: Object reference not set to an instance of an object.
at DS4Windows.InputDevices.SwitchProDevice.CalibrationData()
at DS4Windows.InputDevices.SwitchProDevice.SetOperational()
at DS4Windows.InputDevices.SwitchProDevice.StartUpdate()
at DS4Windows.ControlService.PrepareConnectedInputControllerSettingEvents(Int32 numControllers, DS4Device device, Int32 index)
at DS4Windows.ControlService.HotPlug()
at DS4WinWPF.DS4Forms.MainWindow.InnerHotplug2()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(...)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(...)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of inner exception stack trace ---

Log output (USB):

WARNING: Failed to read serial# from a gamepad (0x057E/0x2009). Generating MAC address from device path.
Found Controller: 35:C3:99:E5:00:00 (USB) (Switch Pro).
VIIPER Xbox360 virtual input presentation is capped at 1000 Hz with latest-state coalescing.
Plugging in virtual Xbox 360 Controller in output slot #1
Associated input controller #1 (Switch Pro) to virtual Xbox 360 Controller in output slot #1
Object reference not set to an instance of an object.

Expected behavior:
Controller connects and calibration data is read successfully, same as before.

Additional notes:
This looks related to a calibration-read issue previously fixed in schmaldeo/DS4Windows ("Fixed stick drift on Joycon/Switch Pro Controller caused by failure to read CalibrationData"). It's possible that fix hasn't been ported to this fork.

It's also possible this is a regression from recently added Switch 2 Pro Controller support — SwitchProDevice may now assume a calibration data format matching the newer Switch 2 Pro Controller instead of the original 2017 model (PID 0x2009). Worth checking whether CalibrationData() correctly branches between the two hardware revisions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions