-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Joystick HID detection, add ADC Joystick mode, fix build on MacOS #408
base: master
Are you sure you want to change the base?
Conversation
Test firmware: openi6x-1.11.1-joystick.bin.gz -- confirmed to work on MacOS, Debian 10 and Windows 7. SHA1 (openi6x-1.11.1-joystick.bin) = b43928371f537b7026863470da6ee12885806aa2 |
In order to build natively on Mac, you'll need
instead of
as it is missing includes. |
successfully built the firmware on a mac with sonoma 14.5 and flashed i6x and tested as a joystick successfully using https://hardwaretester.com/gamepad |
Closes #275 |
Raw ADC test firmware: Reduces number of axels to 6 (4 axes + 2 potentiometers) and buttons number to 8 (the upper half wasn't used anyway):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
This issue gave me a lot of headaches.
|
||
// test to see if TX buffer is free | ||
#if defined(STM32F0) | ||
if (USBD_HID_SendReport(&USB_Device_dev, 0, 0) == USBD_OK) { | ||
#else | ||
if (USBD_HID_SendReport(&USB_OTG_dev, 0, 0) == USBD_OK) { | ||
#endif | ||
//buttons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here - please keep it as in EdgeTX/OpenTX, it keeps this project as close to EdgeTX as possible to backport features and track issues, see:
https://github.com/EdgeTX/edgetx/blob/main/radio/src/targets/common/arm/stm32/usb_driver.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would argue, that upstream implementation is plain broken and not worth to keep. Even with detection fix it does not work as generally expected. For example it depends on currently chosen model. You get different results with different models.
I would say, that it is would be more expected for it to "just work" as game controller independent from transmitter settings.
However I'm willing to keep old broken implementation in-place and make it configurable instead.
However keep in mind, that buttons are not working at all with old definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buttons are not working, or are not set up in model inputs?
@@ -110,7 +110,7 @@ static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length); | |||
__ALIGN_BEGIN static const uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END = | |||
{ | |||
0x05, 0x01, // USAGE_PAGE (Generic Desktop) | |||
0x09, 0x05, // USAGE (Game Pad) | |||
0x09, 0x04, // USAGE (Joystick) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is 0x05 in EdgeTX, I'm not against the change but is there a specific reason to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value from original firmware, IMHO more suitable for the use. Doesn't do much however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is port of OpenTX/EdgeTX and there is no specific reason to change that, it should stay as it was.
I finally have tested it on Linux: Crrcsim, jstest-gtk, . Some other thoughts:
I have cherry picked your original change with your name as the author. I hope you don't mind. |
Fix detection of Joystick HID on MacOS.
Cleanup mis-configured HID descriptor.
Fix native build on MacOS.
Closes #129
Relates to #152, #348, #401
The magic part was:
Tested with https://www.geo-fs.com/, AbsoluteRC, Heli-X10 and crrcsim.