Sunday, February 22, 2009

libusb FTW!

After dealing with this library back and forth, having issues making it work properly, I managed to solve it at last. Thanks goes to a French guy named Clement, who helped me!

The HID driver Windows thinks is the best driver to use, is now disabled, and I use LibUSB-Win32 instead!

Now, the main issue about games receiving mouse events from the mouse used with the treadmill is solved. HID driver is disabled, and I speak with the mouse through libusb - which is the only application that will receive the events!

Typically, I will get some raw data like this:

8: 00 00 28 00 00 00 d8 ff
8: 00 00 1e 00 00 00 e2 ff
8: 00 00 2a 00 00 00 d6 ff
8: 00 00 1f 00 00 00 e1 ff
8: 00 00 2a 00 00 00 d6 ff
8: 00 00 22 00 00 00 de ff
8: 00 00 2b 00 00 00 d5 ff
8: 00 00 20 00 00 00 e0 ff
8: 00 00 28 00 00 00 d8 ff
8: 00 00 20 00 00 00 e0 ff
8: 00 ff 29 00 ff ff d7 ff
8: 00 00 24 00 00 00 dc ff
8: 00 00 28 00 00 00 d8 ff
8: 00 00 22 00 00 00 de ff
8: 00 00 27 00 00 00 d9 ff
8: 00 00 21 00 00 00 df ff
8: 00 00 27 00 00 00 d9 ff
8: 00 00 1d 00 00 00 e3 ff


And, if it goes slowly this is what I get:

8: 00 00 04 00 00 00 fc ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 04 00 00 00 fc ff
8: 00 00 03 00 00 00 fd ff
8: 00 00 02 00 00 00 fe ff
8: 00 00 04 00 00 00 fc ff
8: 00 00 02 00 00 00 fe ff
8: 00 00 03 00 00 00 fd ff

I basically have two options from here:
  1. Try to send mouse events to GlovePIE (only), and use that normally.
  2. Send keystrokes from my application. This is the last resort, if I can't make above work. For basic simple keystrokes this is manageable from my application, but if I want to go crazy, it would be best to use GlovePIE, so that is why I will try to solve sending mouse events from my application to GlovePIE first.

No comments:

Post a Comment