duhow / wibox

Fermax Wi-Box managed locally
GNU General Public License v3.0
36 stars 6 forks source link

Audio / Video feed? #10

Open acseven opened 2 years ago

acseven commented 2 years ago

I've just found your mod for Wibox and was hoping to get it running on my apartment; I couldn't make out for sure though if you have a video and audio feed available, is there or do you have plans for it?

Cheers

segator commented 1 year ago

I'm trying to figure out how to extract video and audio but I'm not an expert on linux, as following @duhow tips I trying to using strace to understand how Sofia (the original app) is working with the video audio devices

Any help would be welcome

meidlinga commented 1 year ago

A tiny bit of information: The devices have the same names, as in eWeLink FGHGF VG-IC-01 IP Cameras. Maybe this could help with reverse engineering.

https://web.archive.org/web/20221005193807/https://ramgattie.com/posts/2020/002-reverse_engineering_device_update_functionality-ewelink_camera/post.html

danijelt commented 8 months ago

@segator Did you ever find something useful with strace? I tried to cat those device files but I'm not getting anything while the channel is open in the mobile app.

I guess that the only way to access AV is to use Goke's SDK through a custom app. My research went into the direction of trying to boot OpenIPC firmware to get a more sane working environment. Getting kernel to run was surprisingly easy and it even gets to the point where Sofia is run. The only problem is that the watchdog driver fails to load, so Sofia reboots the device after a short time.

However, the good news is that the rest of the modules load fine, including bit1628a.ko which I believe is the key to getting audio and video. The driver is small, without too much code outside of device init and passing I2C communication, but somewhat messy, mentioning three separate devices: SGM6502 (video switch matrix), BIT1628A (video decoder) and NVP6134C (video decoder and audio encoder/decoder). NVP6134C's datasheet mentions I2S interface. At a quick glance, MC34118G voice interface appears to be wired to BIT1628A, which falls in line with findings in the driver. But then, it appears to a Frankenstein of a driver (and/or the IC).

Finally, there's N76E003AT20 MCU, which is probably connected to ttySGK1 and used for VDS communication. This is actually very good, as it takes care of all the signaling on L line which would otherwise have to be reimplemented outside Sofia.

Alternative approach is to reverse engineer the cloud API, write a local server and replace the URL in the firmware. On that note, UDP port 8300 mentioned in Sofia looks suspiciously like AV channel (though it could be encrypted, I don't know).

I don't know what's worse, though - reversing the device driver and the rest of communication with unknown chance of success, or trying to make sense of possibly very over-engineered and over-encrypted cloud API.

@duhow Did you try to investigate the API communication?

Alfred99-HA commented 7 months ago

I am interested in Audio/Video as well. Following above hint "eWeLink FGHGF VG-IC-0" I found the follwing Link https://ewelink.cc/ewelink-works-with-home-assistant/ As I do not own the device and due to lacking knowledge I cannot verify whether this irformation helps.