Lighthouse icon indicating copy to clipboard operation
Lighthouse copied to clipboard

Protocol quick explanation?

Open nullstalgia opened this issue 4 years ago • 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.

nullstalgia avatar Mar 25 '21 11:03 nullstalgia

I mostly referenced https://github.com/risa2000/lhctrl/blob/master/README.md and https://github.com/risa2000/lhctrl/blob/master/PROTOCOL.md

tsjost avatar Mar 25 '21 11:03 tsjost

(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: https://github.com/ShayBox/Lighthouse/issues/1#issuecomment-802967098 Do let me know if you have any specific questions!

tsjost avatar Mar 25 '21 11:03 tsjost

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

ShayBox avatar Mar 25 '21 15:03 ShayBox

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

ShayBox avatar Mar 25 '21 15:03 ShayBox

What kind of Macro Board? The ESP doesn't have USB (except the newer Silicon which is still being worked on Arduino-wise)

And I only have V1 light houses, so I'll let you know once I'm ready to have V2 tested

And oof, how did I miss protocol.md

nullstalgia avatar Mar 25 '21 20:03 nullstalgia

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.

ShayBox avatar Mar 25 '21 20:03 ShayBox

Ah, I wasn't sure if you meant a wireless or wired one. Gotcha.

nullstalgia avatar Mar 25 '21 20:03 nullstalgia

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.

nullstalgia avatar Mar 26 '21 00:03 nullstalgia

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.

nullstalgia avatar Mar 26 '21 09:03 nullstalgia

Looks great, i'll test v2 when I get my esp32

ShayBox avatar Mar 26 '21 16:03 ShayBox

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
https://github.com/ShayBox/Lighthouse/issues/1#issuecomment-802967098

ShayBox avatar Nov 28 '22 05:11 ShayBox

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.

nullstalgia avatar Dec 02 '22 04:12 nullstalgia