unixpickle / cbyge

Reverse engineering Cync (formerly "C by GE") WiFi devices
BSD 2-Clause "Simplified" License
128 stars 18 forks source link

Possibly platform specific code? #10

Closed granolaonicecream closed 2 years ago

granolaonicecream commented 2 years ago

I tried using this repo on my Raspberry Pi running Raspbian. server/main.go runs but doesn't return devices despite the HTTP API returning some. After some debugging, I found some usage of int() in packet_conn.go:44. At that point I realized default Raspbian runs a 32 bit OS (lmao) and any logic using platform-dependent types might fail.

I didn't actually verify if this is what was wrong, but the code did work as expected on both a 64 bit windows machine and the same Raspberry Pi running 64 bit Ubuntu. If you see anything that obviously wouldn't work natively on a 32 bit system, I'd suggest just throwing a comment about it in the README.

unixpickle commented 2 years ago

This seems quite possible. I'll try making a branch this weekend that you can test with more fields explicitly int64

unixpickle commented 2 years ago

I was able to reproduce the issue by running the server with the environment variable GOARCH=386. I pushed a fix to the main branch, let me know if you still experience the issue.

granolaonicecream commented 2 years ago

That fixed it! Thanks for the patch and all your work on this project.