While the other Joystick objects currently supported by the USB Host
code are driven by HID data, the Xbox does not contain HID data and
instead works at the top level.
To handle this I made the Joystick object use multiple InHeritence like:
class JoystickController : public USBDriver, public USBHIDInput
This allowed me to have the object work either way. This did add some
complexity in that some of the methods like is the object connected
(The bool operator) had to be overwritten as both of the bases classes
had it. In addition needed to update the other query functions to be
able to grab the data from mydevice or device depending on which type of
controller was connected.
Since this looked like a valid way, I then merged the Keyboard Extras
code that Keyboard and made it also do a similar multiple inheritance.
In this case however I restricted the HID top level report handle code
to only accept it if on the same object that claimed the keyboard.
The mouse test app was updated as well
Needed HID Parser to support Bidirectional Transfers
The HidParser code was setup such that the claim for a report, the caller could say I want to claim the whole thinig and allowed callback functions for processing of in buffer and out buffer.
Allow RawHID to contribute Transfer_t
Since RawHID may need more resources than most, maybe it should contribute the additional structures
The constructor for a RAWHID object allows you to specify the top usage
that it wishes to connect to. I used this for example to be able to
connect to a Teensy with the RAWHID associated with emulating the
Serial object.
If a HID Input class says that it wants to claim the whole interface, I
reuse the buffer associated with holding the HID descriptor and use it
for output buffers.
I updated the keyboard extras to detect if the report ID is 0xff00 and if so ignore it in the Mouse extras process code. This helped not handling a lot of extra messages generated by MS keyboard.
Also updated Test app to show names of some of these special keys.
This delta, adds an extra keyboard object to handle those keys that are not part of the main keyboard class. In particular there are separate HID reports for some of the keys, such as Power keys, and multimedia keys.
These reports might be on separate Interface or in cases where the mouse and keyboard are on the same device, the extra reports may be on the Mouse Interface.
So far I have not tried to combine with Keyboard object as might require multiple inheritance which I would like to avoid.
Also I extended the special key mapping table to map several other keys like F1-12, Arrow, Home/end... To special values where the 0x80 bit is set. I used the same values as used for the Arduino Keyboard library. I did not use their defines as they used defines like KEY_F1, which already exists in core, but in core it is the scan code from the keyboard and not the end user value.