Skip to content
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

Agent deleting left-right bond when unbonding a dongle #2434

Open
kareltucek opened this issue Nov 13, 2024 · 3 comments
Open

Agent deleting left-right bond when unbonding a dongle #2434

kareltucek opened this issue Nov 13, 2024 · 3 comments

Comments

@kareltucek
Copy link
Contributor

@ert78gb it seems like Agent is deleting all bonds on right half in some situations when deleting a dongle host connection. Do you know what these are?

Agent should (almost?) never delete all bonds on right half. There may be situations where it is justified, but from top of my head I can't think of any.

@kareltucek
Copy link
Contributor Author

Although, after unpairing, right half goes crazy (reporting nonsense versions, etc). Let me know if you think this may be entirelly fimware fault - in that case, I will invesigate deeper.

@ert78gb
Copy link
Member

ert78gb commented Nov 14, 2024

it seems like Agent is deleting all bonds on right half in some situations when deleting a dongle host connection. Do you know what these are?

I found the bug. But I am a little bit confused about the fix.

Earlier I opened the UltimateHackingKeyboard/agent80#135 PR to allow the host connection deletion even the dongle is not connected to the computer.

Now, I added https://github.com/UltimateHackingKeyboard/agent80/pull/135/files#diff-5eccb08619f473487e320189d1770b447b3ac2258c239a2cb14e84cffe272bb5R674 condition. It prevent to treat right half as dongle, but it is an interesting situation because 250ms ago the dongle was connected to the computer. I know uncountable things happen in 250ms

Although, after unpairing, right half goes crazy (reporting nonsense versions, etc). Let me know if you think this may be entirelly fimware fault - in that case, I will invesigate deeper.

We have a story about in the uhk60 firmware repo UltimateHackingKeyboard/firmware#813

If I don't use wrong unpairing USB commands then it is a firmware bug.
When unpairing the Dongle (delete host connection)

  • if dongle connected and 250ms ago a connected dongle BLE address matched with the host connection ble address then delete all bond os the dongle. 0x1a USB command with 0 0 0 0 0 0 ble address argument
  • delete specified bond of the right half. 0x1a USB command with ble address of the host connection
  • reenumerate dongle and wait 1 sec
  • reenumerate right half and wait 1 sec
  • read device state from the right half 0x09 USB Command
  • read device protocol version information 0x00 USB command with 1 argument <== Here Agent reads protocol versions from the right half.

Maybe the 0x09 USB Command also returns invalid values but I have not investigated.

I checked the code and almost after all "write" USB command Agent waits until the eeprom is not busy.
Maybe Agent should wait after the pairing/unpairing USB Commands too? I just implemented your sh file and it does not contain wait.

When recommended wait for the eeprom?

@kareltucek
Copy link
Contributor Author

I checked the code and almost after all "write" USB command Agent waits until the eeprom is not busy.
Maybe Agent should wait after the pairing/unpairing USB Commands too? I just implemented your sh file and it does not contain wait.

Shouldn't be needed.

When recommended wait for the eeprom?

Only when you write flash directly - afaik user config and hardware config.

@mondalaci mondalaci transferred this issue from UltimateHackingKeyboard/agent80 Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants