Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created June 27, 2014 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/5d980a62502bb8ba910b to your computer and use it in GitHub Desktop.
Save elbruno/5d980a62502bb8ba910b to your computer and use it in GitHub Desktop.
Sample code to get the DeviceInfo for a XBoxOne Controller
using System.Linq;
using DeviceManagement;
namespace ConsoleApplication2
{
class DeviceInspection
{
public DeviceInfo GetXBoxController()
{
// you need nuget pkg https://devicemgr.codeplex.com/
// ClassName: "XB1UsbClass"
// Desc: "Microsoft Xbox One Controller"
var allClasses = DeviceInfoSet.GetAllClassesPresent();
var devices = allClasses.GetDevices();
return (from device in devices
where device.ClassName == "XB1UsbClass"
select device).FirstOrDefault();
}
}
}
@AndromedaStrain
Copy link

This might be a completely dumb question, but is DeviceManagement defined somewhere? I want to experiment with the Xbox One controller as input to some of my windows forms applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment