Conversation
|
@benedekkupper Please let me know when I should test a CI build. |
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. |
5e777d3 to
e61c346
Compare
What error message are you getting? |
037c4a4 to
a074135
Compare
|
It wasn't able to find the bootloader. |
|
(I mean the Agent.) |
|
Is the USB HID index of the agent command interface still hardcoded in the agent? |
|
No iirc, but I have no hard data for it. |
|
@kareltucek I can reproduce the crash, but I'm unable to debug it, as the crash only happens when the bootloader starts the application, and not the debugger. Can you provide some further information about the crash site? Maybe a wireshark capture of the USB communication up to the point of the crash? |
|
Probably not today I am afraid. So the problem is that you don't know how to reproduce it with a debugger attached, am I correct? I used the agent flashing procedure with a local build. These commands in my case: Which translates to: I used this launch.json: I don't remember the exact procedure though. But should be straightforward. |
662caed to
9d69bfa
Compare
|
@kareltucek How is the suspend and resume supposed to be signalled to the firmware? I'm calling |
|
It is the correct way. Or the intended way anyways. I just might have disabled it due to past issues with suspend detection 🤔. Also, for uhk80, we need to be awake when any host is active, which makes that api a bit inconvenient as the information source. What is the intended transport behavior during suspends? I mean, there is that signaling of set connection state. I would expect transport to not be available during suspend, but I am not sure about the semantics. |
* 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
2dcb42e to
ec56ae9
Compare
I had to use different calls to make it work as before, something to solve at some point.
The transport isn't available for sending during suspend. Preparing to receive is still allowed, but nothing will be delivered until the bus is resumed. |
|
The crashes are fixed, please retest @kareltucek |
major refactoring of UHK60 right USB interface
This PR is work in progress, the following tasks are still ahead:
usb_report_updater@kareltucek @benedekkupper