Closed eqikkwkp25-cyber closed 7 months ago
I checked if ChessDojo App and LukasChess would work with the GKS but without success, links can be found here
Regarding code a dart implementation could be found here
Maybe it contains the missing piece?!
Some basic information with regards to the protocol are here
I was not able to run his javascript implementations within a browser
Battling Tech and Terrible Service: Saving the Future of Chess!
I dont know if i am willing to try out something like that, no ideas if it would give me any insights :-)
Reading human moves for player vs AI chess is probably the main missing key feature right now. I got a bit distracted with the speech recognition stuff (which works but is a bit gimmicky). If you (and it looks like other people) are interested in getting this working then I'm certainly willing to put in more work for this project.
For investigating the protocol, the approach that worked best for me was to use a little adafruit board to sniff the Bluetooth comms between the app and the board. I've got some scripts for this, can upload them here if that's helpful. The nRF Connect app is also helpful for this kind of investigation - you can directly send commands from a phone to the board.
Regarding the protocols, here's roughly how things work:
x..z
, e.g. xe2e4z
.I looked briefly at the human-inputted moves and I can't remember exactly how it worked, but the board would send the candidate move in a message which the app then accepts/rejects. Not sure how promotion works with that.
I am interested :-) And willing to put some time for learning BLE communication into it too.
Instead of using the adafruit board i can use nrf52840-dongle right? Not that cheap but probably worth to try out (not just for the GKS but in general).
That's great to hear :)
That dongle should support sniffing I believe - there's a bunch of tutorials online for using it together with Wireshark. The adafruit board supports programming so you can do more complex stuff (I set mine up to forward bluetooth packets through my PC for man-in-the-middle listening). Different methods but both should work, depends on if you want to write code and how much your budget is :)
I ordered the nRF52840 USB Dongle, might take some time for delivery ...
Received the dongle but struggled more or less a complete weekend to get it running properly, i.e. i was not able to get it running with $USER only with root (checked rights, groups, udev, Python setups etc. already).
Nevertheless,with root I used Nordics profile and filtered for "Square Off ..." and can see some packets initially but advertising stops once i start a game from my smartphone and the app. Game over?! :-) Need to read some documentation next.
It's good that you're able to see the advertising packets at least - proves your setup works. Getting all the groups and udev set up correctly can certainly be a pain, and I admit I've ended up resorting to running Wireshark as root before just to get stuff to work :)
The advertising packets are easiest to spot but they'll stop once the board connects to something as the protocol only supports a single connection at once. You should be able to use the device id as a filter in Wireshark to find the rest of the conversation. The main documentation is here (if you haven't already found it)
Unfortunately i cant see any packets once the GKS and the smartphone are connected. I filtered for btle.advertising_address == MAC before and assume that you mean the MAC of the GKS when you speak of device id?! Tried to look for unique not advertised data patterns and filtered for those but no luck yet.
I hope the device is capable of what i am trying to do.
In parallel i am looking into the original Android app structure on the device via adb shell and root and to the Python berserk module for the Lichess API. Should not be that hard to stream games using your existing code.
I'm not sure why the sniffing doesn't work out. Given that the sniffer itself works, perhaps it's some sort of Bluetooth version difference? Maybe the board is talking on some frequency/power level the device can't hear? I don't personally know enough about bluetooth to know if that's the case, sorry.
If you're on android, there's the option (I think in dev mode) to export bluetooth logs as well. I gave that a go a while back and the output was kind of a mess and hard to decipher - but it is something else you can try if you want.
Something that might be more productive, though, might be to just directly try talking to the board and see what happens and what responses you get. You can use something like nRF Connect (desktop/mobile). Or, you can run the communicator.py
script directly from this repo - when run directly it should work as a text console where you can type commands in.
I'm going to take a bit more of a look at this too, see if I can figure out recording moves. Looking at https://github.com/mrquincle/squareoff it shouldn't be too difficult to implement, at least in theory
I've been taking a look at this over the holidays. I've got something code that seems to work for this, have pushed what I have to the main branch so you're welcome to give it a try. There's still some more work to do (e.g. I've just assumed promotion to queens is fine) and probably bugs to fix.
Many thanks for the Python implementation of https://github.com/mrquincle/squareoff . Except for the message "Illegal move 12-OK*" it works great.
Hello,
i will write down my attempts to understand how the GKS registers a human move and (hopefully) writes it to some temporary bluetooth register. If i am not wrong that is currently a missing key feature.