roleoroleo / yi-hack-Allwinner-v2

Custom firmware for Yi 1080p camera based on Allwinner platform
MIT License
753 stars 90 forks source link

Request: Yi Dome U Pro Support #179

Closed seventhplug closed 1 year ago

seventhplug commented 3 years ago

Hi I bought a Yi Dome U Pro 2K (BLACK) Camera i thought it would be supported. I hope you can please add this camera to your supported device.. Thank you. It has a Device ID: LFUS

roleoroleo commented 3 years ago

I need to know the firmware version. You can check it in the app.

seventhplug commented 3 years ago

Hi its. 9.0.27.19_202105131533

roleoroleo commented 3 years ago

Actually it's not supported. If you want to help me to add it to the supported devices, please make a backup copy and share it with me. Check the wiki.

seventhplug commented 3 years ago

Ok LINK REMOVED Thank you ^_^

roleoroleo commented 3 years ago

Your cam is h60ga. At the moment it's not supported, I will check it.

seventhplug commented 3 years ago

ok, thank you ^_^ appreciate it.

roleoroleo commented 3 years ago

Here it is a first alpha version: h60ga_0.1.7.tar.gz

Probably rtsp and snapshot don't work. Install it and check if ssh and web work.

seventhplug commented 3 years ago

Wow that was fast.. anyway before trying this.. is there a way to undo the hack or restore the backup i created?

roleoroleo commented 3 years ago

If you brick "softly" the cam you can restore the previous state with unhack procedure (I will create a new unhack procedure for your cam). If the brick is "hard" you need a serial connection and the backup files to restore the cam (check the wiki).

seventhplug commented 3 years ago

I already ordered my second Yi Dome U Pro. I'll wait for you unhack procedure before trying.. tnx

roleoroleo commented 3 years ago

Here it is: https://github.com/roleoroleo/yi-hack-Allwinner-v2/wiki/Remove-the-hack

seventhplug commented 3 years ago

Hi It worked. I will test it further. Thank you for your hardwork Yi-Hack

After testing this are the results

FTP Working Telnet Working SSH Working Web Interface Working PTZ Not Working -- website interface says "PTZ functions are not available for this camera model" RTSP - Not Working -- Can't Connect - Always connecting error ONVIF -- not tested Snapshot - not working MQTT -- not tested

I already enabled swap file

roleoroleo commented 3 years ago

Ok, now I need 3 copies of your video buffer. Copy the file /dev/shm/fshare_frame_buf, wait 5 seconds, copy it again, wait 5 seconds and copy it again. Zip the files and share the archive with me. I will try to enable rtsp and snapshot.

seventhplug commented 3 years ago

Hello.. Here is the file download fshare_frame_buf.rar from File Host PT

i dont know why my for loop wont work Lol.. so i manually used this command and paste it in putty.. it executes in sequence

cp /dev/shm/fshare_frame_buf fshare_frame_buf0 sleep 5 cp /dev/shm/fshare_frame_buf fshare_frame_buf1 sleep 5 cp /dev/shm/fshare_frame_buf fshare_frame_buf2 sleep 5 cp /dev/shm/fshare_frame_buf fshare_frame_buf3 sleep 5 cp /dev/shm/fshare_frame_buf fshare_frame_buf4

anyway may i request another enhancement? like DARK Mode Web interface and the ability to add other wifi networks in wpa_supplicant via web interface. Because i have a multiple AP so if one disconnects it will automatically connect to the next AP available. Thank you for your hardwork.

roleoroleo commented 3 years ago

anyway may i request another enhancement? like DARK Mode Web interface

Yes, I can add it.

and the ability to add other wifi networks in wpa_supplicant via web interface. Because i have a multiple AP so if one disconnects it will automatically connect to the next AP available. Thank you for your hardwork.

This is not possible. Wifi credentials management is not in my hack. Yi is responsible for it.

roleoroleo commented 3 years ago

@seventhplug Sorry but I can't download the file from filehost.

seventhplug commented 3 years ago

Sorry here's the new link https://www.mediafire.com/file/n5f1mxejik9us18/fshare_frame_buf.rar/file

roleoroleo commented 3 years ago

Done.

roleoroleo commented 3 years ago

Overwrite the files in /tmp/sd/yi-hack/bin with the content of this archive: new.tar.gz and check if rtsp and snapshot work.

seventhplug commented 3 years ago

Thank you again! rtsp and snapshot are now working.

FTP - Working Legacy FTP - Not Tested Telnet - Working SSH - Working Web Interface - Working PTZ Not Working -- website interface says "PTZ functions are not available for this camera model" RTSP -Working High and Low Stream (a bit choppy on High Stream) i guess its hardware limitations ONVIF -- Not tested Snapshot - Working High/Low Res MQTT -- Not tested

Swap File Enabled

seventhplug commented 3 years ago

ONVIF

I tried ONVIF using ONVIF Device Manager from sourceforge (https://sourceforge.net/projects/onvifdm/) i set my camera with no user/password. Its not connecting..

roleoroleo commented 3 years ago

Ok, new archive: new.tar.gz It should fix ptz.

About onvif, check if wsdd and onvif_srvd processes are running. Which network interface are you using?

seventhplug commented 3 years ago

Hi.. Test Results are PTZ - PTZ functions are not available for this camera model. Onvif - wsdd is running but not onvif_srvd

ONVIF

roleoroleo commented 3 years ago

Try to update the cache of your browser. PTZ should apper.

About onvif_srvd, try to run it manually: onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi-bin/snapshot.sh?res=low&watermark=yes --type H264

seventhplug commented 3 years ago

Hi clearing cache did the trick.. PTZ now working

but the onvif there is the output

> login as: root
> 
> 
> BusyBox v1.27.2 () built-in shell (ash)
> 
> mount: mounting none on /sys/kernel/debug failed: Resource busy
> 
>             __    __   _
>             \ \  / /  | |
>              \ \/ /   | |
>               \  /    | |
>               / /     | |
>              /_/      |_|
>  ------------------------------------
>  Welcome to XiaoYi Linux.
>  ------------------------------------
> 
> root@Gavin:~# onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 -
> -port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi-bin/snapshot.sh?r
> es=low&watermark=yes --type H264
> -ash: --type: not found
> root@Gavin:~# -ash: onvif_srvd: not found
> root@Gavin:~# cd /tmp/sd/yi-hack/bin
> [1]+  Done(127)                  onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi-bin/snapshot.sh?res=low
> root@Gavin:/tmp/sd/yi-hack/bin# ls
> base64           h264grabber_h    mosquitto_pub    rRTSPServer
> dbclient         h264grabber_l    mosquitto_sub    rmdir
> dropbearconvert  hostname         mqtt-config      scp
> dropbearkey      imggrabber       mqttv4           speaker
> dropbearmulti    ipc_cmd          netstat          ssh
> framefinder      ipc_multiplexer  onvif_srvd       tar
> gzip             ipc_read         proccgi          wsdd
> h264grabber      jq               proxychains4
> root@Gavin:/tmp/sd/yi-hack/bin# onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num
>  XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi
> -bin/snapshot.sh?res=low&watermark=yes --type H264
> -ash: --type: not found
> root@Gavin:/tmp/sd/yi-hack/bin# -ash: onvif_srvd: not found
> root@Gavin:/tmp/sd/yi-hack/bin# ./onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_n
> um XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/c
> gi-bin/snapshot.sh?res=low&watermark=yes --type H264
> -ash: --type: not found
> [1]-  Done(127)                  onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi-bin/snapshot.sh?res=low
> root@Gavin:/tmp/sd/yi-hack/bin# onvif_srvd: Error: not set no one profile more details see --help
> 
> [2]+  Done                       ./onvif_srvd --pid_file /var/run/onvif_srvd.pid --model Yi Hack --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 --port 80 --scope onvif://www.onvif.org/Profile/S --name Profile_0 --width 640 --height 360 --url rtsp://%s/ch0_1.h264 --snapurl http://%s:8080/cgi-bin/snapshot.sh?res=low
> root@Gavin:/tmp/sd/yi-hack/bin#
roleoroleo commented 3 years ago

Try again with this: /tmp/sd/yi-hack/bin/onvif_srvd --pid_file /var/run/onvif_srvd.pid --model "Yi Hack" --manufacturer Yi --firmware_ver 0.1.7 --hardware_id TEST --serial_num XXX --ifs wlan0 --port 80 --scope "onvif://www.onvif.org/Profile/S" --name Profile_0 --width 640 --height 360 --url "rtsp://%s/ch0_1.h264" --snapurl "http://%s:8080/cgi-bin/snapshot.sh?res=low&watermark=yes" --type H264

kill the previous daemon before running it: killall onvif_srvd

seventhplug commented 3 years ago

It worked.. onvif is now working on the Yi Dome U Pro..

but i tried it on my Yi Home 1080p y211ga onvif did not work.. should i file a new issue for this model?

roleoroleo commented 3 years ago

This is strange. The command I wrote above is the same that system.sh runs during the boot.

seventhplug commented 3 years ago

When i issued "killall onvif_srvd" it says that onvif_srvd is not running. I guess it doesnt automatically starts even if its turned on the web interface. I got the same error with my y211ga before this fix

roleoroleo commented 3 years ago

Try these commands and post the output:

dd bs=1 count=20 skip=656 if=/tmp/mmap.info 2>/dev/null | cut -c1-20
dd bs=1 count=4 skip=656 if=/tmp/mmap.info 2>/dev/null | cut -c1-4

And try if this works:

./onvif_srvd --pid_file /var/run/onvif_srvd.pid --model "Yi Hack" --manufacturer "Yi" --firmware_ver "0.1.7" --hardware_id XXX --serial_num SN --ifs wlan0 --port 80 --scope "onvif://www.onvif.org/Profile/S" --name Profile_0 --width 1920 --height 1080 --url "rtsp://%s/ch0_0.h264" --snapurl "http://%s:8080/cgi-bin/snapshot.sh?res=high&watermark=yes" --type H264 --name Profile_1 --width 640 --height 360 --url "rtsp://%s/ch0_1.h264" --snapurl "http://%s:8080/cgi-bin/snapshot.sh?res=low&watermark=yes" --type H264 --ptz --move_left "/tmp/sd/yi-hack/bin/ipc_cmd -M left" --move_right "/tmp/sd/yi-hack/bin/ipc_cmd -M right" --move_up "/tmp/sd/yi-hack/bin/ipc_cmd -M up" --move_down "/tmp/sd/yi-hack/bin/ipc_cmd -M down" --move_stop "/tmp/sd/yi-hack/bin/ipc_cmd -M stop" --move_preset "/tmp/sd/yi-hack/bin/ipc_cmd -p %t"
seventhplug commented 3 years ago

Ok I'll try this when I get home. After 7hrs i'll post the output. Thanks

bfboarder commented 3 years ago

Not sure if this helps, but i did try this on r40ga

And try if this works:

./onvif_srvd --pid_file /var/run/onvif_srvd.pid --model "Yi Hack" --manufacturer "Yi" --firm

For me (on a different cam (r40ga) this gives an error on the -- type H at the end (Can't set type for Profile: type dont support) removing --type H and it works

roleoroleo commented 3 years ago

Not sure if this helps, but i did try this on r40ga

Yes, it's the same.

It should be --type H264 and not --type H Please try this new system.sh: system.sh.gz

Copy it in /tmp/sd/yi-hack/script

roleoroleo commented 3 years ago

Ok, now it's clear. I reached the max size of the command line. I need to change the method to pass parameters.

bfboarder commented 3 years ago

This should fix it (at least it's working for me now)

updated (PTZ now working, I made a typo) system_new.zip

fix typo for r40ga fix command line to long

seventhplug commented 3 years ago

Try these commands and post the output:

dd bs=1 count=20 skip=656 if=/tmp/mmap.info 2>/dev/null | cut -c1-20
dd bs=1 count=4 skip=656 if=/tmp/mmap.info 2>/dev/null | cut -c1-4

And try if this works:

./onvif_srvd --pid_file /var/run/onvif_srvd.pid --model "Yi Hack" --manufacturer "Yi" --firmware_ver "0.1.7" --hardware_id XXX --serial_num SN --ifs wlan0 --port 80 --scope "onvif://www.onvif.org/Profile/S" --name Profile_0 --width 1920 --height 1080 --url "rtsp://%s/ch0_0.h264" --snapurl "http://%s:8080/cgi-bin/snapshot.sh?res=high&watermark=yes" --type H264 --name Profile_1 --width 640 --height 360 --url "rtsp://%s/ch0_1.h264" --snapurl "http://%s:8080/cgi-bin/snapshot.sh?res=low&watermark=yes" --type H264 --ptz --move_left "/tmp/sd/yi-hack/bin/ipc_cmd -M left" --move_right "/tmp/sd/yi-hack/bin/ipc_cmd -M right" --move_up "/tmp/sd/yi-hack/bin/ipc_cmd -M up" --move_down "/tmp/sd/yi-hack/bin/ipc_cmd -M down" --move_stop "/tmp/sd/yi-hack/bin/ipc_cmd -M stop" --move_preset "/tmp/sd/yi-hack/bin/ipc_cmd -p %t"

Here is the output PUTTY

Yep the Code Works PUTTY2
mapbox add geojson

seventhplug commented 3 years ago

Not sure if this helps, but i did try this on r40ga

Yes, it's the same.

It should be --type H264 and not --type H Please try this new system.sh: system.sh.gz

Copy it in /tmp/sd/yi-hack/script

onvif works upon reboot now

roleoroleo commented 3 years ago

Please send me a copy of you mmap.info.

And try these new files: onvif_srvd now reads configuration from a file. upd_1.tar.gz

With r40gb typo fixed.

seventhplug commented 3 years ago

Onvid not working again upon booting

Please rename LINK REMOVED

seventhplug commented 3 years ago

Please send me a copy of you mmap.info.

And try these new files: onvif_srvd now reads configuration from a file. upd_1.tar.gz

With r40gb typo fixed.

i tried this and onvid did not work again..

Not sure if this helps, but i did try this on r40ga

Yes, it's the same.

It should be --type H264 and not --type H Please try this new system.sh: system.sh.gz

Copy it in /tmp/sd/yi-hack/script

i revert to this system.sh and it worked again upon bootup

roleoroleo commented 3 years ago

Are you using authentication?

seventhplug commented 3 years ago

No authentication

SmartM-ui commented 3 years ago

hi, which sensors can the integration for the Dome U Pro camera import into the home assistant?
Does the motion sensor, face detection and the ability to put it in privacy mode appear? Thanks

roleoroleo commented 3 years ago

I compared again upd_1.tar.gz and system.sh.gz. upd_1.tar.gz must work. Did you copy both files: onvif_srvd and system.sh? If yes, try to run it manually with the command:

/tmp/sd/yi-hack/bin/onvif_srvd --conf_file=/tmp/onvif_srvd.conf

And post the content of the file /tmp/onvif_srvd.conf

seventhplug commented 3 years ago

Hi. Yes i copied both files

here is the output. I set rtsp (High) stream and onvif (High) Profile

login as: root

BusyBox v1.27.2 () built-in shell (ash)

            __    __   _
            \ \  / /  | |
             \ \/ /   | |
              \  /    | |
              / /     | |
             /_/      |_|
 ------------------------------------
 Welcome to XiaoYi Linux.
 ------------------------------------

root@Gavin:~# /tmp/sd/yi-hack/bin/onvif_srvd --conf_file=/tmp/onvif_srvd.conf
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 0) >= this->size() (which is 0)
Aborted
root@Gavin:~# cat /tmp/onvif_srvd.conf
pid_file=/var/run/onvif_srvd.pid
model=Yi Hack
manufacturer=Yi
firmware_ver=0.1.7
hardware_id=
serial_num=
ifs=wlan0
port=80
scope=onvif://www.onvif.org/Profile/S

#Profile 0
name=Profile_0
width=1920
height=1080
url=rtsp://%s/ch0_0.h264
snapurl=http://%s:8080/cgi-bin/snapshot.sh?res=high
type=H264

#PTZ
ptz=1
move_left=/tmp/sd/yi-hack/bin/ipc_cmd -M left
move_right=/tmp/sd/yi-hack/bin/ipc_cmd -M right
move_up=/tmp/sd/yi-hack/bin/ipc_cmd -M up
move_down=/tmp/sd/yi-hack/bin/ipc_cmd -M down
move_stop=/tmp/sd/yi-hack/bin/ipc_cmd -M stop
move_preset=/tmp/sd/yi-hack/bin/ipc_cmd -p %t
root@Gavin:~#

and here is the output i set both stream on rtsp and both profile on onvif


login as: root

BusyBox v1.27.2 () built-in shell (ash)

            __    __   _
            \ \  / /  | |
             \ \/ /   | |
              \  /    | |
              / /     | |
             /_/      |_|
 ------------------------------------
 Welcome to XiaoYi Linux.
 ------------------------------------

root@Gavin:~# /tmp/sd/yi-hack/bin/onvif_srvd --conf_file=/tmp/onvif_srvd.conf
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 0) >= this->size() (which is 0)
Aborted
root@Gavin:~# cat /tmp/onvif_srvd.conf
pid_file=/var/run/onvif_srvd.pid
model=Yi Hack
manufacturer=Yi
firmware_ver=0.1.7
hardware_id=
serial_num=
ifs=wlan0
port=80
scope=onvif://www.onvif.org/Profile/S

#Profile 0
name=Profile_0
width=1920
height=1080
url=rtsp://%s/ch0_0.h264
snapurl=http://%s:8080/cgi-bin/snapshot.sh?res=high
type=H264

#Profile 1
name=Profile_1
width=640
height=360
url=rtsp://%s/ch0_1.h264
snapurl=http://%s:8080/cgi-bin/snapshot.sh?res=low
type=H264

#PTZ
ptz=1
move_left=/tmp/sd/yi-hack/bin/ipc_cmd -M left
move_right=/tmp/sd/yi-hack/bin/ipc_cmd -M right
move_up=/tmp/sd/yi-hack/bin/ipc_cmd -M up
move_down=/tmp/sd/yi-hack/bin/ipc_cmd -M down
move_stop=/tmp/sd/yi-hack/bin/ipc_cmd -M stop
move_preset=/tmp/sd/yi-hack/bin/ipc_cmd -p %t
root@Gavin:~#
roleoroleo commented 3 years ago

Maybe empty vars are the problem. Try to fill these vars:

hardware_id=
serial_num=

and try this command:

dd bs=1 count=20 skip=784 if=/tmp/mmap.info 2>/dev/null | cut -c1-20
roleoroleo commented 3 years ago

Ok, try this: onvif_srvd.gz

seventhplug commented 3 years ago

Hello, I did not try this..

Maybe empty vars are the problem. Try to fill these vars:

hardware_id=
serial_num=

and try this command:

dd bs=1 count=20 skip=784 if=/tmp/mmap.info 2>/dev/null | cut -c1-20

I skipped ahead and tried this instead.. now onvif works..

Ok, try this: onvif_srvd.gz

and it do its boot sequence (rotating and blinking) 2-3 times before actually starting up after that its working

seventhplug commented 3 years ago

Thank you again.. here are the test results

FTP - Working Legacy FTP - Not Tested Telnet - Working SSH - Working Web Interface - Working PTZ - WORKING RTSP -Working High and Low Stream (a bit choppy on High Stream) i guess its hardware limitations ONVIF - WORKING Snapshot - Working High/Low Res MQTT -- Not tested

Swap File Enabled

I dont have any IoT knowledge at the moment so i dont know how to test MQTT sorry. Native resolution is 2304 x 1296 but downscaled to 1920x1080p i like it better because it looks smoother.

roleoroleo commented 3 years ago

Is ptz working in the right direction? Is it inverted?

mqtt is very useful if you want to integrate your cam in your domotics system. But not everyone uses it.

Thank you for your support.

EDIT

Another question. Please, check if "Hardware" and "Device ID" fields in Onvif Device Manager are empty.