在C#.NET中使用USB PS2手动控制器

我正在尝试创建一个程序,从usb ps2手控制器获取输入,转换并将信息传递给rs232设备。 我已经拥有了rs232设备的所有function。 问题是与USB控制器连接。 似乎没有任何好的文档,除此之外,.NET3.0 / 3.5没有任何库可以帮助你。 怎么会开始?

你有没有尝试过SharpUSBLib来访问usb数据?

它可能是几年的线程… anywho ….我知道SlimDX是一个非常好的C#.Net / VB库。 并且,要使用USB控制器,它非常简单,您需要做的就是这样。 请注意,这个代码我是在飞行中制作的,我没有操纵杆来测试它,这…

static Joystick[] joystick = new Joystick[1]; const int minimum_value = -1000;//your values goes here const int maximum_value = 1000;//your values goes here public test() { DirectInput USBJoystick = new DirectInput(); IList device = null;//to get the joysticks device = USBJoystick.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly); if (device.Count == 1) joystick[0] = new Joystick(USBJoystick, device[0].InstanceGuid); foreach (DeviceObjectInstance deviceObject in joystick[0].GetObjects()) { if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0) joystick[0].GetObjectPropertiesById((int)deviceObject.ObjectType).SetRange(minimum_value, maximum_value); } }