guino / Merkury720

Root and Customization for Merkury 720P and similar cameras
108 stars 20 forks source link

Connection refused using RTSP, ppstrong-a2-tuya2_geeni-2.7.7.20210311 #16

Closed jmday001 closed 3 years ago

jmday001 commented 3 years ago

Hi,

First off, I really appreciate all the work you've put in.

After some trial and error with SD cards, I was finally able to get the hack to work in full. However, I can only access mjpeg/snap and not RTSP. Whenever I attempt to connect, I get "connection refused" (unless there is a password I'm missing and didn't realize?). I followed the instructions for the patch twice, and I can confirm through telnet that it IS indeed using the patched ppsapp (as had been stated in another thread, it's coming from /mnt/mmc01/ppsapp ). I'm not sure at this point if maybe I'm missing something, but all other diagnostic have come up normal. I've included my device info below and will be happy to provide anything else that I can. I confirmed I am using the correct ppsapp that matches my info.

{"devname":"Smart Home Camera","model":"Mini 7C","serialno":"100984223","softwareversion":"2.7.7","hardwareversion":"M7C_AK_V10_1245","firmwareversion":"ppstrong-a2-tuya2_geeni-2.7.7.20210311","authkey":"z--k","deviceid":"p--5","identity":"M--2","pid":"aaa","WiFi MAC":"8--4"}

I did have an MDTNUM that was uncommented, and I attempted to follow the instructions for that, but it still did not remedy the situation. I might just be missing something really simple, so I apologize if I am. Any help would be great. Thank you!

guino commented 3 years ago

@jmday001 did you try rtsp on different clients (vlc, phone app, etc)? Can you post the url you tried?

if you post a zip of your SD card contents (without the SDT folder) I can review it.

It does like you got most everything right so it could just be the client you’re using (ie VLC for mac has been reported as not working with some of these).

jmday001 commented 3 years ago

@jmday001 did you try rtsp on different clients (vlc, phone app, etc)? Can you post the url you tried?

if you post a zip of your SD card contents (without the SDT folder) I can review it.

It does like you got most everything right so it could just be the client you’re using (ie VLC for mac has been reported as not working with some of these).

I have tried VLC on windows (switched over to TCP option), I tried NetStudio as well. The link I tried was rtsp://ip:8554 , with of course IP replaced by my cam's IP, confirmed by making sure that the deviceinfo link returned normal.

I've attached a dump of SD card contents. I'm sure I may have made a small misstep somewhere, I just can't seem to figure out --deleted--

As a note, I am using the ppsFactoryTool for access, I just omitted it from the zip.

guino commented 3 years ago

@jmday001 the patched seems to be botched -- one of the bytes appears to be incorrect (nothing that you did wrong). Can you please try this patch instead: ppsapp-rtsp.zip

Looks like the patch was creating an invalid instruction, but the one above should be ok. Let me know when you have a chance.

jmday001 commented 3 years ago

@jmday001 the patched seems to be botched -- one of the bytes appears to be incorrect (nothing that you did wrong). Can you please try this patch instead: ppsapp-rtsp.zip

Looks like the patch was creating an invalid instruction, but the one above should be ok. Let me know when you have a chance.

So, no luck on that one. I tried the original cam and flashed a new, identical unhacked one, just to make sure. I'm going to attach a few things in essence of trying not to waste your time with a back and fourth to see if maybe we can figure out what happened.

This is the telnet of the camera's ps:

PID USER VSZ STAT COMMAND

1 user       972 S    init

2 user         0 SW   [kthreadd]

3 user         0 SW   [ksoftirqd/0]

4 user         0 SW   [kworker/0:0]

5 user         0 SW   [kworker/u:0]

6 user         0 SW<  [khelper]

7 user         0 SW   [kdevtmpfs]

8 user         0 SW   [kworker/u:1]

110 user 0 SW [sync_supers]

112 user 0 SW [bdi-default]

113 user 0 SW< [kintegrityd]

115 user 0 SW< [kblockd]

121 user 0 SW [khubd]

138 user 0 SW< [cfg80211]

139 user 0 SW [kworker/0:1]

157 user 0 SW [kswapd0]

207 user 0 SW [fsnotify_mark]

215 user 0 SW< [crypto]

219 user 0 SW< [cryptodev_queue]

232 user 0 SW< [aec_event]

233 user 0 SW [aec_task]

234 user 0 SW [aec_priority]

242 user 0 SW< [ak-spi]

247 user 0 SW [mtdblock0]

252 user 0 SW [mtdblock1]

257 user 0 SW [mtdblock2]

262 user 0 SW [mtdblock3]

267 user 0 SW [mtdblock4]

272 user 0 SW [mtdblock5]

277 user 0 SW [mtdblock6]

291 user 0 SW [kworker/u:2]

312 user 0 SW< [deferwq]

314 user 0 SW [mmcqd/0]

332 user 856 S < udevd --daemon

334 user 856 S < udevd --daemon

336 user 856 S < udevd --daemon

434 user 972 S {initrun.sh} /bin/sh /mnt/mmc01/initrun.sh

454 user 0 SWN [jffs2_gcd_mtd6]

466 user 0 SW< [usb_otg_wq]

486 user 0 SW< [phy0-atbm_wq]

489 user 0 SW [phy0-usb_atbm_b]

502 user 0 SW [atbm_wtd]

523 user 832 S cmd_router

531 user 796 S ./ppsdsry

533 user 3000 S {netMserver} ./network

539 user 984 S {initS} /bin/sh home/init.d/initS

589 user 0 SW [kworker/0:2]

600 user 0 SW [flush-179:0]

623 user 1252 S /mnt/mmc01/busybox telnetd -l /bin/sh

629 user 1252 S /mnt/mmc01/busybox httpd -c /mnt/mmc01/httpd.conf -h /mnt/mmc01 -p 8080

643 user 88008 S /mnt/mmc01/ppsapp

692 user 0 SW [flush-mtd-unmap]

736 user 0 SW [kworker/0:3]

1112 user 964 S sleep 10

1124 user 980 S /bin/sh

1127 user 964 S sleep 2

1128 user 0 Z [login]

1129 user 972 R ps

Here is a readout of the camera's proc/cmdline:

mem=64M console=ttySAK0,115200n8 mtdparts=spi0.0:256k(bld)ro,64k(env)ro,64k(enc)ro,64k(sysflg)ro,2496k(sys),4608k(app),640k(cfg) ppsAppParts=5 ip=0 - ip=30;/mnt/mmc01/initrun.sh)&:::::;date>/tmp/hack;(sleep

Here is a readout of deviceinfo ((Note, this is the second camera, but it didn't work on the first either, hence the change in MAC. They're identical though.):

{"devname":"Smart Home Camera","model":"Mini 7C","serialno":"100984049","softwareversion":"2.7.7","hardwareversion":"M7C_AK_V10_1245","firmwareversion":"ppstrong-a2-tuya2_geeni-2.7.7.20210311","authkey":"3--Z","deviceid":"p--9","identity":"M--502","pid":"aaa","WiFi MAC":"8--0c"}

Here is a full readout of S90PPStrong (added a ' in front of the debug so it didn't read it as styling code and make it bold):

!/bin/sh

export PATH=/usr/bin:/sbin/:/usr/sbin:/bin

RED="" NORMAL=""

echo "${GREEN} 2015 PPStrong Tech Cop.Ltd.${NORMAL}"

mkdir -p /opt/pps MTDNUM=cat /proc/cmdline | sed 's/.*ppsAppParts=\([0-9]\).*/\1/'

'# debug MTDNUM=5

case $MTDNUM in 5) mount -t cramfs /dev/mtdblock$MTDNUM /opt/pps break ;; 7) mount -t cramfs /dev/mtdblock$MTDNUM /opt/pps break ;; 0)
sleep 10 mount -t vfat /dev/mmcblk0p1 /opt/pps break ;; *) MTDNUM=5 mount -t cramfs /dev/mtdblock$MTDNUM /opt/pps ;; esac

echo "/opt/pps/" > /tmp/PPStrong.runpath [ -e /opt/pps/initrun.sh ] && cp /opt/pps/initrun.sh /tmp/PPStart && chmod +x /tmp/PPStart && /tmp/PPStart

Here is a VLC log file (not particularly useful I think but maybe you'll catch a silly mistake):

`-- logger module started --

main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.

main: playlist is empty

main: Status file authenticated

live555 error: Failed to connect with rtsp://192.168.50.117:8554

main error: connection failed: Connection refused by peer

satip error: Failed to connect to RTSP server 192.168.50.117:8554

main error: connection failed: Connection refused by peer

access_realrtsp error: cannot connect to 192.168.50.117:8554

live555 error: Failed to connect with rtsp://192.168.50.117:8554

main error: connection failed: Connection refused by peer

satip error: Failed to connect to RTSP server 192.168.50.117:8554

main error: connection failed: Connection refused by peer

access_realrtsp error: cannot connect to 192.168.50.117:8554

live555 error: Failed to connect with rtsp://192.168.50.117:8554

satip error: Failed to connect to RTSP server 192.168.50.117:8554

access_realrtsp error: cannot connect to 192.168.50.117:8554

live555 error: Failed to connect with rtsp://192.168.50.117:8554

satip error: Failed to connect to RTSP server 192.168.50.117:8554

access_realrtsp error: cannot connect to 192.168.50.117:8554

-- logger module stopped --`

annnd I have redumped the new patched ppsapp and SD contents.--deleted--

Edited for clarity in output

guino commented 3 years ago

@jmday001 I looked at the patch and your ppsapp and it all looks correct. can you please modify your custom.sh file like this:

change: /mnt/mmc01/ppsapp & to be: /mnt/mmc01/ppsapp &> /mnt/mmc01/ppsapp.log &

Then reboot the camera, try to connect and post a zip of the ppsapp.log file created in the SD card for review.

The only thing that comes to mind right now is that you have set record_enable 0 in custom.sh -- maybe you can try 1 to make sure this version of firmware isn't don't something weird when set to 0.

jmday001 commented 3 years ago

@guino Changed record_enable to 1, and I actually got stuck in a boot loop momentarily. It made the start up chime around 3 or 4 times before it finally settled in. Everything works normally, but still no response out of the RTSP link.

Here is the zipped log. This is with record_enable set to 1.

ppsapplog.zip

guino commented 3 years ago

@jmday001 did you actually enroll this device in the tuya app (or manufacturer app) ? From the logs it looks like it's just not trying to connect to the tuya servers at all like you just didn't set it up. If you did set it up you may want to: -boot it without the SD card -go in the app and do a 'factory reset' -set it up again and re-insert the SD card (you should not need to re-do anything else)

If you didn't enroll it in the tuya app then you need to do that as that's required for initializing the device during boot (connect to the tuya server to get the time for the video feed etc).

jmday001 commented 3 years ago

@quino So, it appears that there must have been a problem during registration. Followed the steps, reset it and, in trying to set it up again, no matter what I did my phone refused to register it. Had to take my wife's phone, redo it all, and now everything is working as expected. I read some reviews that the Geeni app (which my camera uses) is notoriously unreliable on Android, with some people reporting that it had just randomly deregistered their camera for no apparent reason. So, I suspect there may have been some erroneous lines sent across my first registration.

In any case, I'm sorry to drag you through all this for such a simple problem in the end. Thank you for everything. This is fixed and I'll go ahead and close it with this comment.

guino commented 3 years ago

Thanks for reporting back and glad it's working now! I had seem people simply 'forget' to enroll the device in the app before but never seen it have enrollment issues.