Reply
Logi Nu
AnnapolisStar
Posts: 1
Registered: 07-12-2009
0

Interfacing Dual Action Controller to PC using Windows

I

I am writing a simulator for the F16 radar on a Pc using Borland Turbo C++ and am trying to use the Dual Action Controller for the throttle and side stick controller.  I enumerate the devices using  window call SetupDiGetDeviceInterfaceDetail and get the device path "\\\\?\\usb#vid_046d&pid_c216#5&2723be6e&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}" which I then use in a Createfile call to open a handle to the controller.  I get error code 31 - ERROR_GEN_FAILURE which says that a device attached to the system is not functioning.  The controller seems to be working OK when I view it on the Control Panel but it won't work from a C++ program using windows calls.  Is the device compatible with Windows Xp?

Is there a simple snippet of C++ code using Windows calls that I can use that does work with the controller?

side stick controller.  I enumerate the devices using  window call SetupDiGetDeviceInterfaceDetail and get the device path "\\\\?\\usb#vid_046d&pid_c216#5&2723be6e&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}"; which I then use in a Createfile call to open a handle to the controller.  I get error code 31 - ERROR_GEN_FAILURE which says that a device attached to the system is not functioning.  The controller seems to be working OK when I view it on the Control Panel but it won't work from a C++ program using windows calls.  Is the device compatible with Windows Xp?

Is there a simple snippet of C++ code using Windows calls that I can use that does work with the controller?

Logi Apprentice
rduke
Posts: 122
Registered: 09-03-2007
0

Re: Interfacing Dual Action Controller to PC using Windows

You could avoid all the SetupDi headache by using DirectInput (check Google for DirectInput8). It's the normal way that apps use to access game controllers and abstracts all the details away.

 

If, for whatever reason,  you want to stay with the Setup API enumeration and direct CreateFile, you should look at HID samples. Your path seems to suggest you are enumerating the USB devices; however, for your application, you should be looking at the HID devices (different Device Interface GUID). Perhaps you should give Jan's HID page a look-over, she's got tons of good stuff including sample code.