-
Notifications
You must be signed in to change notification settings - Fork 68
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
Implement connection manager. #1031
Conversation
b348832
to
70b31b1
Compare
@kareltucek I delay reviewing this until Benedek's PR is merged unless you say otherwise. |
Yes, this will need reworking. |
6b17356
to
3343c07
Compare
When renaming the current connection and saving the configuration, the new name doesn't get reflected on the OLED display. When connecting my production dongle to USB, the OLED display switches to disconnected, HID events don't have any effect, and the following is shown in the Zephyr log upon every HID event:
Simultaneously, Agent displays the following, which shouldn't be displayed: |
What do you mean by "production dongle"? You mean that you haven't updated it to the corresponding branch firmware? If so, which commit are they running? |
Also, have you tried to delete the connection and pair it again? |
I'm on the tip of the Experience various issues regarding connection switching. I haven't used the mentioned macro commands yet. Please try to connect/disconnect your UHK 80 / dongle via USB, which should trigger the following when pressing keys:
or
When seeing the above errors, my UHK usually doesn't send events to the host, and sometimes the mouse interface froze. Can you reproduce these issues? |
No. Please try to give more detailed reproduction steps. And maybe more log context. |
…keup Fix touchpad presses.
Fade uhk80 leds gradually.
When the user configuration is empty, the UHK 80 is disconnected, even after reboot or after reconnecting USB. No wireless devices have ever been paired until this point.
|
Upon trying to pair my dongle, Agent errors out with "Cannot write to hid device". Agent log:
Right half log:
Dongle log:
|
3343c07
to
808a90c
Compare
(For the moment, it is only rebased. No point testing now.) |
FYI: The UltimateHackingKeyboard/agent#2450 PR works well for me with this PR |
c81a036
to
cfb40f9
Compare
(No changes to code, just rebased onto master to resolve conflicts.) |
For some reason, Agent now succeeded pairing both dongles. My connections: My macros on the Fn2 layer which contain the macro actions of the same content as the macro names: With When switching to "Production Dongle", is it expected that I get the following?
When trying to switch to "My PC", I can't, and I get:
In the meantime, even though "Dev Dongle" shouldn't be involved at this point, outputs:
I can't switch to "Dev Dongle", either. Right half log:
"Dev Dongle" log:
|
No. Only those whose connections are active - i.e., dongles that are blue, and maybe usb or ble hid. As for usb vs ble hid, they are mutually exclusive for the moment, and they act quirky anyways. I am waiting for @benedekkupper's response about that at #1021 Whenever posting dongle-related issues please include following when possible:
(This is for next time, don't waste time by re-testing the above ;-).) |
However you should be able to reach any dongle when asking for it specifically by name. Will investigate. |
@benedekkupper I have restructured current bt connection initiation sequence - the old one suffered by a number of problems, often stemming from the ble hid central changing its address after pairing or during authentication... ...and this change broke c2usb's switching between usb and ble. Can you please respond to #1021 ? In case I am doing something idiotic (which is by no means unlikely), then telling me that (you suspect that) I am being idiotic and pointing me in the right direction would be very appreciated. (Which source file should I read? Which c2usb documentation have I missed?) |
7d95701
to
925fea3
Compare
925fea3
to
8a13f98
Compare
When renaming the current connection and saving the configuration, the new name isn't reflected on the OLED display. |
Many customers purchased multiple dongles, which is currently not handled by Agent and must be: When I connect a dongle via USB, it gets paired. If I connect another dongle via USB, Agent doesn't offer to pair it, only if I disconnect the old dongle and reconnect the new dongle. Is this purely an Agent limitation? |
I believe so. |
When trying to switch to a specific host connection that is unavailable, it'd be nice to display it on the OLED display for a second, such as |
It'd be nice to make |
I can't switch back to my phone now, even though it worked a couple minutes earlier. To be precise, the host connection changes, but no reports seem to be sent.
May this be a c2usb issue? On a related note, mousing on Android still doesn't work. |
|
This contains a refactor of connection handling - both host connections and other connections (like bridge) are now managed by one central module.
Changes:
switchHost { next | previous | last }
macro can be used to iterate over connected hosts (blue dongles)switchHost "name"
can be used to select a specific host connection (i.e., blue and violet dongles) to connect to even when the host is not connected (e.g., because there are more active dongles than the available peripheral connection slots) . In such case, the least recently used host is disconnected, and advertisement is started with a whitelist for the one selected host.Please note the
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT
prj.conf value and experiment with it. Reasonable values are 1, 2, and 3. In practice, it means the number of dongles that can be in blue and green modes at the same time.With 1 the switchover takes around 1 second and switching over is done by disconnecting current dongle, applying an allow list filter, and starting advertising with that list, which however doesn't work very well in practice, as the dongles try to connect anyways. (The upside is that keeping a list of active dongles wouldn't be hard.)
With 2 or more, the user experience is a bit better, but I fear decreased responsivity. In this case, either all dongles can be connected in standby (blue) (if their number is smaller than the connection count), or some blue, some violet, and the whitelist approach is in practice used on one free slot obtained by disconnecting one of the blue dongles.
Known issues / missing features:
switchHost next
. Violet dongles can still be reached by (e.g.)switchHost "MyDevDongle"
.Closes #1021
Closes #980