Skip to content

Commit

Permalink
fixed error when trying to open generic gamepads
Browse files Browse the repository at this point in the history
  • Loading branch information
Retsur committed Jun 26, 2016
1 parent a5fab17 commit be0f841
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ScpControl/Usb/Gamepads/UsbGenericGamepad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,19 @@ public static UsbDevice DeviceFactory(string devicePath)

public override bool Open(string devicePath)
{
short vid, pid;

GetHardwareId(devicePath, out vid, out pid);

var loader = new HidDeviceLoader();

// search for HID
_currentHidDevice = loader.GetDevices(VendorId, ProductId).FirstOrDefault();
_currentHidDevice = loader.GetDevices(vid, pid).FirstOrDefault();

if (_currentHidDevice == null)
{
Log.ErrorFormat("Couldn't find device with VID: {0}, PID: {1}",
VendorId, ProductId);
vid, pid);
return false;
}

Expand Down

0 comments on commit be0f841

Please sign in to comment.