Error -2000000006 With Joystick in LabVIEW

Updated Aug 30, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I'm controlling a joystick in LabVIEW using the Input Device Control VIs but I keep receiving error -2000000006. Why is this happening?
  • I'm seeing error -2000000006 in LabVIEW. After disconnecting and reconnecting my controller, the error persists. How can I get rid of it?
  • I keep receiving the error below when establishing a connection to my joystick. How can I fix this?
Error -2000000006
LabVIEW: (Hex 0x88CA6BFA) The operation cannot be performed unless the device is acquired.

Solution

This error occurs when the controller or joystick has been physically disconnected, either because it has been unplugged from the PC or because the connection is loose.
The error will persist even if the controller is manually reconnected because the device reference is not released by the operating system until the calling program closes. 

To workaround this error, encase the Input Device Controls VIs in a sub-VI. Use a top-level VI to dynamically open, run and close this VI when the error occurs.
The image below demonstrates how the sub-VI should appear.

subVI.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

This VI can be dynamically called by a top-level VI using Invoke Nodes, as shown below.

top level VI.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.