Protocol quick explanation?
nullstalgia opened this issue · 12 comments
Heyo, love the project! I want to possibly port a version of it to the ESP32 so I can turn the Base Stations on and off without a PC, but I've been having issues finding reasonable documentation on the protocol. Since you and @tsjost also just got the V1 protocol down (the main one I'm interested in), I'd love to get that in too.
Thanks in advance, and sorry if this is a stupid request.
(The readme is saying that you must keep sending pings to keep the lighthouse turned on, but that's incorrect as the 0x1200 command will keep it on indefinitely)
If you didn't see it already, I did a quick overview here: #1 (comment)
Do let me know if you have any specific questions!
I mostly used https://github.com/nouser2013/lighthouse-v2-manager/blob/master/lighthouse-v2-manager.py, the second section, and fumbled my way around rust until I got it to work, I looked at other languages but rust was the only one with a multiplatform bluetooth lib
Let me know how that goes or if you need any help, I'm going to be buying an esp32 to make a macro board soon and that would be a great macro to have
The ESP has Wifi and Bluetooth, you can emulate a PS/2, Bluetooth HID, or communicate over wifi to an api running on a computer that's able to do things.
Awesome, I got a proof of concept working with NRF Connect on my Android phone. Thanks much many for the explanation on # 1, the "little endian" comment makes much more sense now.
https://github.com/nullstalgia/LighthouseESP
Can you guys see if it looks alright? Works for me on my V1 Lighthouses, but I don't have any V2s to test.
Looks great, i'll test v2 when I get my esp32
Version 2 Basestations (Valve) are very simple
You write one of the values to a bluetooth device
Hex | Action |
---|---|
0x00 | OFF |
0x01 | ON |
0x02 | STANDBY |
This has the disadvantage of having no security, anyone in bluetooth range can control your basestations
Someone could even maliciously brick flash or power cycle them.
Version 1 Basestations (HTC) are seemingly more secure
(Steam doesn't require the BSID, so this may just be a lack of knowledge of how to obtain this over bluetooth)
They require an 8-bit BSID printed on the device
The commands are seemingly arbitrary, though likely have a reason, can be found here
https://github.com/ShayBox/Lighthouse/blob/a830f5955a87fc739f4e7ce3babcea4268311e25/src/main.rs
EDIT: I forgot @tsjost had written up a nice comment on this
#1 (comment)
Steam doesn't require the BSID [for V1]
It gets the BSID from the headset's/controller's tracking dots when reading the data encoded by the laser spinning inside of the lighthouse.
I was able to get the V1 functionality working with my sketch but I didn't own V2 lighthouses until more recently (about a year ago), and when I tested it, my sketch didn't function as expected. Project fell off the backburner, but maybe now is a good chance to try to get it working.