USB Zapper Mouse

Status
Not open for further replies.

Pinaz993

New member
I'm currently building a mouse for a wedding present for my cousin. The mouse consists of the case and microswitch from one NES-compatible zapper, a Teensy LC, and an accelerometer/gyrometer/thermometer breakout board. I have them soldered together in such a way that the data is flowing from the sensor to the Teensy, and I have the Teensy in Keyboard/Mouse/Joystick mode. I set up some code, and now, when I plug the whole assembly into my PC, it acts as an HID mouse, which you use by waving the gun around. So far so good. To be clear, my code works on a PC running Windows 10.

However, this mouse is not for a PC. It is for a RetroPie. And after I get RetroArch to recognize the zapper as a second controller (an adventure unto itself), there is a problem. The cursor on the screen (added by the FCEUmm emulator for NES) is barely moving when I wave the gun. Not only that, but it always moves at the same slow speed, not accelerating with the gun. I believe the X and Y info from the zapper are being incorrectly applied. I tested this with an off-the-shelf HID mouse, and it works as I expect, meaning that the cursor moves with speed directly proportional to the speed of the mouse itself.

I think the problem lies in the way the Teensy reports itself. (Perhaps FCEUmm or RetroArch is being confused by the Joystick Controls.) So, to test this hypothesis, I want to change the report so that it says it's only a mouse, not a mouse, keyboard, and joystick. This is where I'm stuck. I can understand HID reporting to an extent, but I don't know enough about the binary communication going on to confidently modify usb_desc.h and usb_desc.c to make this happen.

If you have any other thoughts about this problem, please let me know. Otherwise, please tell me how to either write my own code that will establish the HID relationship independant of all library files, or change the library to accomplish my goal. HID_RAW solutions would be acceptable as well, as long as I'd be able to set the name of the device at some juncture.

Thanks for your consideration, and have a nice day.

Patrick
 
Status
Not open for further replies.
Back
Top