Although it does work, it's a kludgy work-around that still has the AVR starting in a bootloader "mode", but with no bootloader present, and the code counter wraps around to the start of the "non-bootloader" code. *Be aware that the Arduino "Upload via Programmer" option is a bit odd. I modified the Joystick_::setState to be eight buttons and a throttle and rudder only. Update the BOARDS.TXT file Leonardo entry to a unique VID and PID, and re-name it if you like.įor bonus points you can edit the HID.cpp file to remove the game controller features you don't want in the function: void Joystick_::setState(JoyState_t *joySt) Be sure to correctly change the number of bytes the function is expected to return ( #define joyBytes). If you do this alone, you will still be faced with an "unknown device" for the Leonardo bootloader and CDC serial port, but those can be eliminated in step 1 below:Īrduino/hardware/arduino/cores/arduino/USBDesc.h is where you remove the CDC serial define to get rid of the serial port, but be warned that that also gets rid of the ability to program over USB! (use a super-cheap USBasp to program via the Arduino IDE using the ISP header*) In the case of a generic HID device, the VID and PID are essentially just placeholders and could be just about anything, but the open-source ones are a good bet to be truly compliant. Generic HID devices do not need any external drivers, so the misapplication of the Leonardo drivers can be fixed by using a generic (open-source) USB VID and PID in the BOARDS.TXT file. To answer my own question, here's the scoop:īasically, regardless what you do with the joystick routines in the modified HID.cpp, the Leonardo will always appear as a game controller and a USB keyboard and mouse, even if the keyboard and mouse are basically not there! This is caused by the Windows "drivers" for Leonardo/Micro being explicitly told to expect a keyboard and mouse. The HID declarations are a little arcane, and a bit of direction there would also be appreciated! The example HID.cpp appears to have statements that disable the KB/mouse, but the declarations don't appear to do anything! Maybe they just make the KB/mouse "inert", but completely removing them would be much better!Īny help in removing them would be greatly appreciated!įYI, I've added a few files that work in 1.6.5 (nice work, by RamjetX!)įor bonus points, I think I can sus it out in the HID.cpp with a lot of trial & error (more errors than trial!), but what I'm really after is a 6-button, one-axis (throttle) emulation to be hacked into an ancient Thrustmaster WCS throttle. Obviously, the "traditional" method of removing them with the global CDC/HID definitions won't work since HID still needs to be present! It would be cleaner if the KB/mouse could be removed from the HID implementation. There are many examples of code that allow a Leonardo/Micro become a HID joystick device, but in all the cases I've seen, the default HID keyboard and mouse are still part of the recognized devices in the PC device manager.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |