Dafang-Hacks / Main

138 stars 63 forks source link

Writing software for your OS. Advice #34

Closed kenthinson closed 4 years ago

kenthinson commented 4 years ago

Hello. I am working on using: https://github.com/brutella/hc To write a Homekit program for Dafang-Hacks.

His HomeKit Library is written in go. I have successfully compiled his library (mipsle) and gotten a basic Homekit program running on the camera and talking to my iPhone. However the process is very slow as whenever I make a change I have to remove the SD card and plug it into my computer. Do you have any advice for getting my binary to the camera? It seems to be a real lean system. no scp or rsync. I found ftpd however every time I connect the camera reboots. Thanks for any advice you might have.

jmtatsch commented 4 years ago

Try ftp

Dopeyr commented 4 years ago

Hi, I've used FTP before OK on a dafang. Maybe enabling swap would help?

If that fails, you can transfer just by using ssh e.g.

cat my-binary-file|ssh root@192.168.20.220 'cat - > /system/sdcard/my-binary-file'

(adjust names, paths as necessary)

tonysprenk commented 4 years ago

Are you making a firmware for Dafang cameras to be able to connect to HomeKit natively, without a bridge? If so I’m very excited about that! If you need anyone to test your firmware I’m happy to!

kenthinson commented 4 years ago

@tonysprenk I am working on it when I have free time but I have very little free time.

tonysprenk commented 4 years ago

I understand! Would you mind sharing the code that you have so far so I can maybe work on it myself?

kenthinson commented 4 years ago

@tonysprenk All I've done so far it work on getting the toolchain setup. I was able to get go to cross compile for mips(the architecture of the camera). I was able to compile a test hello world program and then run on the camera.

Things on my list.

  1. Figure out if the HomeKit code can be changed to use the RTSP server already in dafang hacks or if I will need to cross compile ffmpeg. Unfortunately the api is not commented and I'm not very familiar with go. So that will be a lot of front loading to learn the required go to understand his code.
  2. Once I know how to proceed get a proof of concept working on my laptop (as cross compile and test on camera is very slow)
  3. Cross compile the project and any library dependencies to mips.
  4. Check for resource contention. Might have to disable some of the other services currently running on the camera. That would require writing scripts that disable said services when HomeKit is enabled in the web GUI.
  5. Add a pairing and on / off option to the web gui.

If you want to help first step is getting the toolchain setup. Then go down the list.

tonysprenk commented 4 years ago

Sounds very promising! Keep us updated please! And thanks for putting in the work, if you need me to test anything let me know!