Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio / Video feed? #10

Open
acseven opened this issue May 7, 2022 · 5 comments
Open

Audio / Video feed? #10

acseven opened this issue May 7, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@acseven
Copy link

acseven commented May 7, 2022

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

@duhow duhow added the help wanted Extra attention is needed label Nov 6, 2022
@segator
Copy link

segator commented Jul 8, 2023

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

  • /dev/ai_dev /dev/ao_dev (audio)
  • /dev/gk_video (video)

Any help would be welcome

@meidlinga
Copy link

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
Copy link

@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

This comment was marked as off-topic.

@danijelt
Copy link

Follow up on this issue: I was able to play and record audio on the device with adidemo sample app from Goke SDK. I've traced the MC34118 audio pins and when I connect the microphone and speaker, I can record and play PCM audio. This means that the audio feed is doable in theory with a custom app that would utilize the SDK.

GPIO 18 and 19 control MC34118's disable and mute pins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants