I learned recently how PS2 game controllers send continuous updates to the PS2, with data identifying which buttons have been pressed, etc.
Having an adapter that allows my PS2 game controller to connect to a USB port, I started looking into writing a driver to allow it to control the mouse (similar to Joy2Mouse (http://atzitznet.no-ip.org/Joy2Mouse3/) ), as an exercise in understanding how it works.
I am having trouble even grasping the basics of how to access and asynchronously poll a USB device for input, and was wondering if anyone had any example code (C#) for accessing the USB device and polling its input, or could explain how it is done?
From what I can gather, I will need to use some windows drivers for accessing the USB device, but I have no experience of this, and so don't know how to do this.
Thanks for any help you can give.
Those PS2 adapters interface with the controller for you, and provide a joystick interface for you.
There are a few ways of accessing a joystick. An older method (but still works) is by using Managed DirectX. http://www.codeproject.com/KB/directx/joystick.aspx
Note that Managed DirectX is no longer released. You might try SlimDX (http://slimdx.org/features.php)