Conversation
|
@benedekkupper Please let me know when I should test a CI build. |
670d8ad to
c094435
Compare
* start using Kconfig for device configuration values (see right/Kconfig.device) * use generated usb_device_config.h header * organize HID report manipulation into self-contained sources and headers * remove kusb interfacing code, except for buspal * update c2usb dependency handling * merge zephyr c2usb interface with UHK60 * use single report for system and media usages * remove unused gamepad interface
c094435 to
f2f5ac6
Compare
kareltucek
left a comment
There was a problem hiding this comment.
As for initial review: looks great. Thanks for all those refactors - they are spot on. I didn't expect you to go this deep into our side of code.
Are there any areas that should I focus on specifically with review?
I mean, are there any notable changes in logic, or potentially controversial areas? (I have tried to read through all the changes, but it is easy to miss things among minor changes, mass renames, etc....)
|
|
||
| static void addBasicScancode(uint8_t scancode, macro_usb_keyboard_reports_t* reports) | ||
| { | ||
| if (!scancode) { |
There was a problem hiding this comment.
I am wondering if it is safe to remove these...
There was a problem hiding this comment.
It is safe to remove them, because the call chain checks for zero values too. It does mean that zero values are processed longer, so if you want to speed up the error handling, I can restore these checks.
| EventVector_KeyboardLedState = 1 << 10, | ||
| EventVector_UsbMacroCommandWaitingForExecution = 1 << 11, | ||
| EventVector_ProtocolChanged = 1 << 12, | ||
| // EventVector_ProtocolChanged = 1 << 12, // unused |
There was a problem hiding this comment.
Where is the protocol change (nkro vs 6kro) now handled?
There was a problem hiding this comment.
Although, I think it is correct that the usb_report_udpater logic shouldn't be needed these days, as everything is stored in nkro format, so indeed this should be a no issue.
There was a problem hiding this comment.
Now the UHK60 handles this internally, just like the UHK80 already does.
What exactly do you have in mind? What comes to mind given this prompt:
Whether and how the reports should be queued - I assume a queue of length 1 - the switching of active and "inactive" report buffers:
Assume it takes 1ms to construct a report. (Well, I should make some statistics of this.) |
UHK60 crashes somewhere in initUsb. What is the state of testing on your end @benedekkupper . Can you efficiently test and debug with actual UHK60 hardware, or is that up to me? |
|
I have pushed a minor PID fix of west_agent.py. |
| //return; | ||
| } | ||
| std::copy(buffer.begin(), buffer.end(), in_buffer_.data() + sizeof(in_id_)); | ||
| auto result = send_report(in_buffer_); |
There was a problem hiding this comment.
Have you been dropping all errors here all along?
The key areas are the
Now it will return
This is doable, but it needs to split handling USB and BLE report sending, so I'd do it in another round.
Don't design too much around this high latency, there is a new BLE spec version already supported by nRF Connect SDK, that can drastically reduce this (LE Shorter Connection Intervals)
I have debugged the firmware a bit, but not in a production environment, I flashed the firmware without bootloader present. The keys and mouse movement is working in general, I didn't test further so far due to the limited time availability. Do you have a JTAG/SWD debugger attached, or you use some kind of log and trace functionality? Did yo flash the CI build that crashed, or your local build? Make sure you run the usual west command sequence before build: |
I tried to attach to a gdb via an swd, but failed. Can look into it deeper on monday I think. It was a local build. |
|
As for those crashes:
|
Is there any specific concern regarding this? It seems to me that the UsbReportUpdateSemaphore takes care of things quite optimally for now, and so can be checked off. I went through the usb_report_updater and hid/transport.cpp, and I don't see any obvious issues. I am running this firmware on uhk80 and it works like a charm so far. |
|
I have lost the ability to flash uhk80 via Agent with this PR. |
major refactoring of UHK60 right USB interface
This PR is work in progress, the following tasks are still ahead:
usb_report_updater@kareltucek @benedekkupper