ah- / anne-key

Firmware for Anne Pro Keyboard written in Rust
Apache License 2.0
567 stars 32 forks source link

[feature] Remember more than 4 hosts #37

Open hdhoang opened 6 years ago

hdhoang commented 6 years ago

Caution We don't have any way to recover BLE fw yet, this might brick it?

BleOp::ConnectHost/SaveHost/DeleteHost accepts a byte argument, but how well do values beyond 0-3 work?

martijnvandijk commented 6 years ago

Why can't we recover the BLE firmware?

hdhoang commented 6 years ago

from what I heard in #dev-chat: when @ah- tried dumping the BLE fw via serial, there was rust strings in the output, so nobody trusted that the ouput was correct.

ah- commented 6 years ago

And related: We do get info back via AckHostListQuery, which is three bytes. The last is a bool if it's legacy or ble, and I think the first byte is a set of bits if there's a host saved, and the second byte is whether it's connected to any of those hosts. Haven't looked in detail though.

Some examples:

[15 1 0] -> L0
[15 12 1] -> L1
[15, 0, 1] -> L1, not connected
[15 0 0] -> L0, not connected
after deleting all saved hosts: [8, 0, 0]
(i think the first number is 8, 9, 11, 15, depending on how many hosts are saved)
hdhoang commented 6 years ago

with https://github.com/ah-/anne-key/compare/9b1a92bda0...c44cf25b2e we can say that the protocol only supports 4 hosts.

ah- commented 6 years ago

Maybe? All that is just based on the same guessing :)

Haven't tried what happens if you add a 5th host, currently busy with other parts. Upper limit is 8, due to the bit field that comes back. It's a bit suspicious that "connected, but not to a saved host" is 12.