guino / Merkury1080P

Merkury1080P (CW017) Rooting and Customization
77 stars 16 forks source link

ppsapp patch request #45

Open desiue opened 1 year ago

desiue commented 1 year ago

hi i have also one of the LSC cams.

Some things are different. Password is admin. The and the result of http://192.168.6.143:8090/proc/self/root/mnt/mmc01/hack hack is done Telnet is working.

RTSP server is not running rtsp://192.168.x.x:8554//Streaming/Channels/101

MD5 of then SD:\home\app\ppsapp file is MD5: c83e0ba3db47c1e54a11a915e19e8e08 So it doesn't match with the List of patched ppsapp's i have found under: https://github.com/guino/ppsapp-rtsp/issues/1

:8090/devices/deviceinfo
{"devname":"Smart Home Camera","model":"Mini 16S","serialno":"100154576","softwareversion":"4.0.6","hardwareversion":"M16S_A2_V10_F37","firmwareversion":"ppstrong-a3-tuya2_lsc-4.0.6.20210311","identity":"M1N001CF3800921160","authkey":"JO5Jn2YGdmhuujGqMlPOLuBp8cgvWmwB","deviceid":"pp019c30a2ad61d07665","pid":"aaa","WiFi MAC":"b4:fb:e3:f5:f2:1a","ETH MAC":"00:00:00:00:00:00"}

:8090/proc/cmdline
mem=64M console=ttySAK0,115200n8 loglevel=10 mtdparts=spi0.0:256k(bld),64k(env),64k(enc),64k(sysflg),3m(sys),4032k(app),640k(cfg) ppsAppParts=5 ip=0 - ip=30;/mnt/mmc01/initrun.sh)&:::::;date>/tmp/hack;(sleep
8090/proc/self/root/etc/init.d/S90PPStrong
#!/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
desiue commented 1 year ago

ppsapp.zip

could you please, if you have time, patch my file? Thanks a lot

guino commented 1 year ago

@desiue when you said RTSP server is not running, did you modify tuya_config.json to enable ONVIF (which enables RTSP) ? you can just execute this command in telnet to enable it: /mnt/mmc01/set onvif_enable 1 -- then wait 30 seconds and reboot the device to make it effective.

desiue commented 1 year ago

oh so easy? unbelievable! Now its works with VLC - open Network and then: rtsp://admin:admin@192.168.x.x:8554/Streaming/Channels/101

http://192.168.6.143:8090/proc/self/root/home/cfg/tuya_config.json
{
    "version":  1,
    "sleep_mode":   0,
    "alarm_fun_onoff":  0,
    "alarm_fun_sensitivity":    1,
    "alarm_fun_mode_switch":    0,
    "alarm_fun_time_start": 0,
    "alarm_fun_time_end":   0,
    "flip_onoff":   0,
    "light_onoff":  1,
    "night_mode":   1,
    "sound_detect_onoff":   0,
    "sound_detect_sensitivity": 0,
    "watermark_onoff":  1,
    "event_record_time":    60,
    "enable_event_record":  2,
    "record_enable":    1,
    "motion_trace": 1,
    "motion_area_switch":   0,
    "motion_area":  "",
    "motion_tracking":  0,
    "cry_detection_switch": 0,
    "humanoid_filter":  0,
    "loudspeaker_vol_pct":  100,
    "onvif_enable": 0,
    "onvif_pwd":    "admin"
}

so i try /mnt/mmc01/set onvif_enable 1 on telnet

{
    "version":  1,
    "sleep_mode":   0,
    "alarm_fun_onoff":  0,
    "alarm_fun_sensitivity":    1,
    "alarm_fun_mode_switch":    0,
    "alarm_fun_time_start": 0,
    "alarm_fun_time_end":   0,
    "flip_onoff":   0,
    "light_onoff":  1,
    "night_mode":   1,
    "sound_detect_onoff":   0,
    "sound_detect_sensitivity": 0,
    "watermark_onoff":  1,
    "event_record_time":    60,
    "enable_event_record":  2,
    "record_enable":    1,
    "motion_trace": 1,
    "motion_area_switch":   0,
    "motion_area":  "",
    "motion_tracking":  0,
    "cry_detection_switch": 0,
    "humanoid_filter":  0,
    "loudspeaker_vol_pct":  100,
    "onvif_enable": 1,
    "onvif_pwd":    "admin"
}

One more question. I want to live stream directly to youtube. Its that possible directly from the cam?

For example i stream with ffmpeg -some parameters- direct to rtmps://a.rtmps.youtube.com/live2/xxx-xxxx-xxxxx-xxxx-xxxxx

guino commented 1 year ago

@desiue I've never done it, but I saw something like:

ffmpeg -i rtsp://admin:admin@192.168.x.x:8554/Streaming/Channels/101 -vcodec copy -acodec aac -f flv rtmps:/a.rtmps.youtube.com/live2/xxxxxx-xxxxxx-xxxxxxxx
desiue commented 1 year ago

ffmpeg -i rtsp://admin:admin@192.168.6.143:8554/Streaming/Channels/101 -vcodec copy -acodec aac -f flv rtmps://a.rtmps.youtube.com/live2/xxxxxxxxxxx

works very well. my idea was to stream directly from the camera to youtube without detours.

unfortunately there was another burglary yesterday in the house. Therefore, I have now set the focus on the alarm. is there a way to send a mail or message when motion is detected?

At the moment it only works with the app. Which I actually no longer wanted to use.

guino commented 1 year ago

@desiue have a look at this wiki: https://github.com/guino/BazzDoorbell/wiki/%5BHow-to%5D-Use-notifications-MQTT-log_parser-without-a-patched-ppsapp-%3F -- this script detects motion and sends out a message using mqtt, it can be modified to send a web request to trigger some other alert. The example uses mqtt because it is meant to integrate with home assistant or any other software that is going to receive the alert and do something with it, but if the device has internet access it could do something like fire an event in ifttt or whatever server/service you want to use for notifications (you could build one yourself too).

You could for instance setup a webhook applet in ifttt.com to trigger a notification within the ifttt app, then modify the log_parser script to execute something like this when the motion is detected:

/mnt/mmc01/busybox wget -O- http://maker.ifttt.com/trigger/EVENTNAME/with/key/KEYVALUE?value1=Backyard

(You do need to set EVENTNAME with the trigger event name configured in the webhook applet, and need to configure KEYVALUE with your key (which you get by clicking on the webhooks applet documentation) -- the value can be anything you want so if you have multiple cameras you could say Backyard, FrontDoor, Fence, Camera4, etc.

You can test the trigger commands on a computer with wget and just copy/paste them onto the script.

desiue commented 1 year ago

i have something simillar to IFTTT its caled pushsafer from https://www.pushsafer.com. Its possible to generate an Link like https://www.pushsafer.com/api?k="youKeyHere"&s=61&v=3&pr=2&m=YourMessege Or Mail so if you open This Link all Phones get an Emergency Alert. My problem is that this is https and wget dosent wort with it, curl i could't found.

Do you have an idea how to configure the "log_parser script" to open this link?

guino commented 1 year ago

@desiue there's no tool within the device that will work with httpS right now -- that's why I suggested ifttt as it supports both httpS and http (as shown in my example). If your service doesn't support http (only httpS) then your options are: 1-Find a version of wget/curl for ARMv5 that has httpS support and was compiled with uclibc OR statically compiled and place it in the SD card so you can use it -- I'm not sure how the certificates would work on this so you may need to use the option to ignore the certificate anyway. OR 2-Download the sources and toolchain to compile the tool yourself and place it on the SD card so you can use it. OR 3-Make a simple web server on a local machine that receives http requests from the device and makes the httpS request from your local machine (which will definitely support httpS) -- the machine you were using to run ffmpeg is likely a good candidate for this. There are countless ways you could this web server: httpd/lighttpd with cgi, nodejs, custom application, even some fancy scripting with netcat can work. Basically you just need to make a web server that will listen for some HTTP request like http://IP/cameramotion and will do the httpS request to your server (curl/wget/etc) then use the local http URL on the camera.

desiue commented 1 year ago

ok i think the easy way will be wget to IFTTT and then to Pushsafer. I take a look in my custom.sh

`#!/bin/sh if [ ! -e /tmp/customrun ]; then echo custom > /tmp/customrun cp /mnt/mmc01/passwd /etc/passwd /mnt/mmc01/busybox telnetd -l /bin/sh /mnt/mmc01/busybox httpd -c /mnt/mmc01/httpd.conf -h /mnt/mmc01 -p 8080 if [ -e /mnt/mmc01/ppsapp ]; then PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}') kill $PPSID

/mnt/mmc01/set record_enable 0

/mnt/mmc01/set enable_event_record 1

/mnt/mmc01/set onvif_enable 1

/mnt/mmc01/ppsapp & fi

/mnt/mmc01/offline.sh &

fi if [ ! -e /tmp/cleanupdate +%Y%m%d ]; then rm -rf /tmp/cleanup* touch /tmp/cleanupdate +%Y%m%d /mnt/mmc01/cgi-bin/cleanup.cgi > /tmp/cleanup.log fi`

but i can't found anyting about the "log_parser.sh" and on the SD card is no file with this name log_parser.sh

did you have more information about how i can do this?

"Then modify the log_parser script to execute something like this when the motion is detected:" /mnt/mmc01/busybox wget -O- http://maker.ifttt.com/trigger/EVENTNAME/with/key/KEYVALUE?value1=Backyard

thank you for your patience

i found something similar https://github.com/guino/BazzDoorbell/wiki/%5BHow-to%5D-Play-a-sound-when-motion-is-detected i try it....

desiue commented 1 year ago

ok i have added /mnt/mmc01/ppsapp 2>&1 | /mnt/mmc01/log_parser.sh &

to the custom.sh on the SD Card / .


`#!/bin/sh
if [ ! -e /tmp/customrun ]; then
 echo custom > /tmp/customrun
 cp /mnt/mmc01/passwd /etc/passwd
 /mnt/mmc01/busybox telnetd -l /bin/sh
 /mnt/mmc01/busybox httpd -c /mnt/mmc01/httpd.conf -h /mnt/mmc01 -p 8080
 if [ -e /mnt/mmc01/ppsapp ]; then
  PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
  kill $PPSID
  #/mnt/mmc01/set record_enable 0
  #/mnt/mmc01/set enable_event_record 1
  #/mnt/mmc01/set onvif_enable 1
  /mnt/mmc01/ppsapp 2>&1 | /mnt/mmc01/log_parser.sh &
  #/mnt/mmc01/ppsapp &
 fi
 #/mnt/mmc01/offline.sh &
fi
if [ ! -e /tmp/cleanup`date +%Y%m%d` ]; then
 rm -rf /tmp/cleanup*
 touch /tmp/cleanup`date +%Y%m%d`
 /mnt/mmc01/cgi-bin/cleanup.cgi > /tmp/cleanup.log
fi
`

And created log_parser.sh with


#!/bin/sh

# contains(string, substring)
#
# Returns 0 if the specified string contains the specified substring,
# otherwise returns 1.
contains() {
    string="$1"
    substring="$2"
    if test "${string#*$substring}" != "$string"
    then
        return 0    # $substring is in $string
    else
        return 1    # $substring is not in $string
    fi
}

main() {
    IFS='$\n'
    while true; do
        read -r BUF;
        if [ $? -ne 0 ]; then
            sleep 1;
            continue
        fi
        if contains "$BUF" "--motion detection alarm --"; then
/mnt/mmc01/busybox wget -O- http://maker.ifttt.com/trigger/motion/json/with/key/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#/mnt/mmc01/cgi-bin/play.cgi /mnt/mmc01/yoursound.wav
#            /mnt/mmc01/busybox wget -O- http://10.10.10.87:8080/motion?Doorbell
        elif contains "$BUF" "##doorbell_push 3"; then
            /mnt/mmc01/busybox wget -O- http://10.10.10.87:8080/doorbell?Doorbell
        fi
    done
}

main

This command /mnt/mmc01/busybox wget -O- http://maker.ifttt.com/trigger/motion/json/with/key/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

works over telnet but the scripts dosen't work.

did you have any ideas or hints?

oh i think i have forgotten to copy ppsapp from the home/app/ppsapp of the SD card to the root of the SD card i will check it...

ok device is still rebooting if i copy the ppsapp to root directory of the SD card.

so i try this https://github.com/guino/BazzDoorbell/issues/4#issuecomment-1208466146 it dosen't work... so i try to check the code


/ # ps | grep -v grep | grep ppsapp | awk '{print $1}'
559
/ #   /mnt/mmc01/busybox mkfifo /tmp/log
mkfifo: /tmp/log: File exists
/ # ls -la /tmp/log
prw-r--r--    1 user     root             0 Nov 19 15:17 /tmp/log
/ # ls -la /tmp/redir.log
-rw-r--r--    1 user     root            82 Dec 31  2015 /tmp/redir.log
/ # cat /tmp/redir.log
# Previous state saved. To restore, use:
/mnt/mmc01/reredirect -N -O 29 -E 27 559
/ #
desiue commented 1 year ago

so i tried /mnt/mmc01/log_parser.sh /mnt/mmc01/output.log < /tmp/log & and cat /tmp/log

so im tgiggering motion an looking for evenets on the log

======send packet 1 368 tx data failed! -1 != 1456 [15:36:20.097 ERR rtsp_demo.c:1501]err_cnt = 1 ======send packet 1 368 [15:36:22.622 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [11-19 15:36:25:297 TUYA Debug][tuya_ipc_p2p.c:4279] session detect run [11-19 15:36:25:877 TUYA Debug][tuya_ipc_api.c:352] ipc get service time 1668868585 3600 [15:36:27.622 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:36:28.084 INFO pps_record_ctrl.c:355]record_enable 0, record_type 2, is_recording 0, event_duration: 60, now: 1633921, record_end_time 0, diff -1633921 [15:36:29.366 INFO pps_device_led_ctrl.c:179]led event: net connected [15:36:32.620 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [11-19 15:36:36:347 TUYA Debug][tuya_ipc_p2p.c:4279] session detect run [15:36:37.628 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:36:38.086 INFO pps_record_ctrl.c:355]record_enable 0, record_type 2, is_recording 0, event_duration: 60, now: 1643922, record_end_time 0, diff -1643922 [15:36:40.706 INFO pps_device_led_ctrl.c:179]led event: net connected [15:36:42.630 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [11-19 15:36:46:472 TUYA Debug][tuya_ipc_api.c:352] ipc get service time 1668868606 3600 TX DATA REMAIN 368 bytes ======send packet 1 368 tx data failed! -1 != 1456 [15:36:45.759 ERR rtsp_demo.c:1501]err_cnt = 1 ======send packet 1 368 [11-19 15:36:47:427 TUYA Debug][tuya_ipc_p2p.c:4279] session detect run [15:36:47.665 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:36:48.087 INFO pps_record_ctrl.c:355]record_enable 0, record_type 2, is_recording 0, event_duration: 60, now: 1653923, record_end_time 0, diff -1653923 [15:36:52.056 INFO pps_device_led_ctrl.c:179]led event: net connected [15:36:52.680 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:36:55.398 INFO pps_tuya_media.c:1878]md_common_callback... call user###pps_media_md_task_loop_call_line:1453 crc:39ee [15:36:56.797 DEBUG pps_tuya_ipc_event.c:20]md time inteval 767 [11-19 15:36:57:548 TUYA Debug][tuya_ipc_api.c:610] size:6881 type: 1 [11-19 15:36:57:552 TUYA Debug][tuya_ipc_notification.c:565] cloud config Not Inited [11-19 15:36:57:553 TUYA Debug][iot_httpc.c:909] Post Data: {"type":"Motion","t":1668868617} [11-19 15:36:57:554 TUYA Debug][iot_httpc.c:920] Post URL: https://a2.tuyaeu.com/d.json?a=tuya.device.storage.config.get&devId=bf2f8645eed949b6c0wars&et=1&t=1668868617&v=3.1&sign=5e039f1e5643e433565aa00ac54af7e5 [11-19 15:36:58:148 TUYA Debug][mqtt_client.c:149] mqtt_ping -->> [11-19 15:36:58:151 TUYA Debug][mqtt_client.c:180] mqtt_ping <<-- [11-19 15:36:58:190 TUYA Debug][tuya_tls.c:966] sock(26) Suit:TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256 Cost:1(setup)590(shake)0(verify) [11-19 15:36:58:192 TUYA Debug][httpc.c:757] Connect: a2.tuyaeu.com Port: 443 cost 43(tcp)593(tls) [11-19 15:36:58:205 TUYA Debug][mqtt_client.c:1043] ping respond. update fail_cnt:0 time 1668868618 [11-19 15:36:58:240 TUYA Debug][iot_httpc.c:549] Malloc Buffer Size:1336 [11-19 15:36:58:256 TUYA Debug][iot_httpc.c:676] Decode Rev:(null) [11-19 15:36:58:259 TUYA Debug][iot_httpc.c:784] call time-set 1668868618 [11-19 15:36:58:262 TUYA Debug][cloud_operation.c:305] require CA for url ty-eu-storage30-pic.s3.eu-central-1.amazonaws.com [11-19 15:36:58:268 TUYA Debug][cloud_operation.c:316] CA exist for url already [11-19 15:36:58:270 TUYA Debug][tuya_ipc_notification.c:592] cloud config Init Success [11-19 15:36:58:273 TUYA Debug][cloud_operation.c:617] en with key[a5c4f0b7f49eabea] iv[a5c4f0b7f49eabea], size 6881 to 6896 [15:36:57.699 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [11-19 15:36:58:481 TUYA Debug][tuya_ipc_p2p.c:4279] session detect run [15:36:58.096 INFO pps_record_ctrl.c:355]record_enable 0, record_type 2, is_recording 0, event_duration: 60, now: 1663933, record_end_time 0, diff -1663933 [11-19 15:36:58:997 TUYA Debug][tuya_tls.c:966] sock(26) Suit:TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA Cost:1(setup)696(shake)0(verify) [11-19 15:36:59:4 TUYA Debug][httpc.c:757] Connect: ty-eu-storage30-pic.s3.eu-central-1.amazonaws.com Port: 443 cost 21(tcp)704(tls) [11-19 15:36:59:95 TUYA Debug][cloud_operation.c:1212] HTTPS PUT https://ty-eu-storage30-pic.s3.eu-central-1.amazonaws.com/30c104-69942910-pp019c30a2ad61d07665/detect/1668868617.jpeg done,size 6960 cost 816 ms [11-19 15:36:59:106 TUYA Debug][tuya_ipc_notification.c:192] notify DP:115 timeout:5 [11-19 15:36:59:108 TUYA Debug][tuya_ipc_notification.c:198] count:1 and len:706 [11-19 15:36:59:109 TUYA Debug][tuya_ipc_notification.c:216] final:{"v":"3.0","bucket":"ty-eu-storage30-pic","files":[["/30c104-69942910-pp019c30a2ad61d07665/detect/1668868617.jpeg","a5c4f0b7f49eabea"]]} [11-19 15:36:59:110 TUYA Debug][smart_frame.c:2268] Send Raw: {"115":"eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvMzBjMTA0LTY5OTQyOTEwLXBwMDE5YzMwYTJhZDYxZDA3NjY1L2RldGVjdC8xNjY4ODY4NjE3LmpwZWciLCJhNWM0ZjBiN2Y0OWVhYmVhIl1dfQ=="} retrans:1 [11-19 15:36:59:144 TUYA Debug][mqc_app.c:970] Send MQTT Msg.P:4 N:64627 Q:1 [11-19 15:36:59:146 TUYA Debug][app_agent.c:2059] Prepare To Send Lan:{"dps":{"115":"eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvMzBjMTA0LTY5OTQyOTEwLXBwMDE5YzMwYTJhZDYxZDA3NjY1L2RldGVjdC8xNjY4ODY4NjE3LmpwZWciLCJhNWM0ZjBiN2Y0OWVhYmVhIl1dfQ=="}} [11-19 15:36:59:169 TUYA Debug][smart_frame.c:1139] report finish 0 [11-19 15:36:59:171 TUYA Debug][tuya_ipc_notification.c:226] notification_message_upload success [15:36:58.421 INFO pps_tuya_media.c:1808]motion detected upload pic [15:36:58.757 DEBUG pps_sdcard_hisilinux.c:298]SDCard: total_size: 3.7G, used: 0.0G, free: 3.7G [15:36:58.758 DEBUG pps_sdcard.c:580]sdcard avail bytes:3935117312, more than 512MB. [11-19 15:37:00:618 TUYA Debug][gw_intf.c:4555] dev delete -->> [11-19 15:37:00:618 TUYA Debug][gw_intf.c:4600] dev delete <<-- [15:37:02.684 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:37:03.426 INFO pps_device_led_ctrl.c:179]led event: net connected [11-19 15:37:07:128 TUYA Debug][tuya_ipc_api.c:352] ipc get service time 1668868627 3600 [15:37:07.701 INFO pps_tuya_netmng.c:669]WIFI[0] Get IP:192.168.6.143 [15:37:08.107 INFO pps_record_ctrl.c:355]record_enable 0, record_type 2, is_recording 0, event_duration: 60, now: 1673943, record_end_time 0, diff -1673943 [11-19 15:37:09:537 TUYA Debug][tuya_ipc_p2p.c:4279] session detect run

if i trigger the motion detection there will be something like

[tuya_ipc_notification.c:226] notification_message_upload success [15:36:58.421 INFO pps_tuya_media.c:1808]motion detected upload pic

so im a little bit wondering why the log_parser.sh are searching for alarm, maybe i am looking in the wrong file

if contains "$BUF" "--motion detection alarm --"; then

maybe this is the problem... so i try to replace it with

if contains "$BUF" "motion detected"; then

desiue commented 1 year ago

... i got it ... once an then no more ...

in the custom.sh on the SD Card / has to be something like this /mnt/mmc01/ppsapp 2>&1 | /mnt/mmc01/log_parser.sh &

and i dont have any messages in /mnt/mmc01/output.log so i have changed the /mnt/mmc01/output.log to /tmp/log in the log_parser.sh #DEBUG_FILE=/mnt/mmc01/output.log

and the "--motion detection alarm --" to

if contains "$BUF" "notification_message_upload"; then

guino commented 1 year ago

@desiue post a zip of your SD card contents without the SDT folder so I can review.. You don't need a patched ppsapp so you should not have one in the SD card anyway -- you should be using the information here: https://github.com/guino/BazzDoorbell/wiki/%5BHow-to%5D-Use-notifications-MQTT-log_parser-without-a-patched-ppsapp-%3F

desiue commented 1 year ago

but I don't think it works quite reliably now. Maybe I have configured something wrong, attached the files. LSC_Cam_20221121.zip sometimes 30minutes the camera reboots unexpectedly

Unfortunately I have the problem that PushSafer wants money for the messages. I have already bought the license from PushOver. Unfortunately I come back to the https problem.

I don't think I can manage to compile wget/curl by myself. Doesn't it exist somewhere ready to use? I have found this post https://github.com/guino/BazzDoorbell/issues/39#issuecomment-880881655 he wrote something about how he run curl on the Doorbell, i found curl under https://github.com/bol-van/bins/tree/master/armhf/static downloaded and copy to SD Card. Hm... maybe wrong version.

/ # /mnt/mmc01/curl
Illegal instruction (core dumped)
/ #
desiue commented 1 year ago

did you make it to play an sound? i tried it with

/mnt/mmc01 # /mnt/mmc01/cgi-bin/play.cgi /mnt/mmc01/home/sound/dingdong.wav
Content-type: text/plain

4+0 records in
4+0 records out
4 bytes (4B) copied, 0.012973 seconds, 308B/s
35+0 records in
35+0 records out
35 bytes (35B) copied, 0.006019 seconds, 5.7KB/s
1+0 records in
1+0 records out
1 bytes (1B) copied, 0.009901 seconds, 100B/s
Playing /mnt/mmc01/home/sound/dingdong.wav
/mnt/mmc01 #

but I hear nothing

guino commented 1 year ago

@desiue your SD card files seem fine assuming you don't have a ppsapp file in the root of the SD card.

I have not been able to find a version of curl/wget with httpS support pre-compiled for armv5. The version you found is in fact the wrong version and that's why you get the 'Illegal instruction' error -- it likely was compiled for armv7 (which is the most common).

The simplest solution would be to use IFTTT.com as I suggested before (since it supports http directly). I don't think it's worth spending a lot of time trying to compile something with httpS support and it will be unlikely you'll find it pre-compiled for armv5. The only alternative is to create a web server locally to receive the request from the device and make the request to your pushsafer service (as I also previously suggested).

Regarding the audio playback -- the command you used is correct but the file must exist and your SD card didn't have that home/sound/dingdong.wav file -- there's a /home/sound/dingdong.wav in the device itself (at least on my version), so you should be able to do:

/mnt/mmc01 # /mnt/mmc01/cgi-bin/play.cgi /home/sound/dingdong.wav

It is possible your firmware version doesn't have that file or has other sound files -- you can do ls -la /home/sound to see what may be there (it may be in a different location too).

desiue commented 1 year ago

I tried it with this command. i can't hear anything. do you have to unmute previously it?

`/ # /mnt/mmc01/cgi-bin/play.cgi /home/sound/dingdong.wav Content-type: text/plain

4+0 records in 4+0 records out 4 bytes (4B) copied, 0.000611 seconds, 6.4KB/s 25+0 records in 25+0 records out 25 bytes (25B) copied, 0.002803 seconds, 8.7KB/s 1+0 records in 1+0 records out 1 bytes (1B) copied, 0.000323 seconds, 3.0KB/s Playing /home/sound/dingdong.wav / # / # `

guino commented 1 year ago

@desiue I've never had to do anything to unmute it before it plays -- did you adjust te addresses in your cgi files to these (specific to your firmware version): snap.cgi and mjpeg.cgi address: 0x037c2f4 play.cgi request address: 0x037cb00

The zip you posted with your SD card contents didn't include the cgi files so I could not check that.

desiue commented 1 year ago

so i have adjusted the three files.

#!/bin/sh
# JPEG address (only enter the digits after 0x)
#ADDRESS=2d6648
ADDRESS=037c2f4
# Get ppsapp PID
PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
/mnt/mmc01/jpeg-arm /proc/$PPSID/mem $ADDRESS 57336 2> /dev/null
/mnt/mmc01/cgi-bin # cat mjpeg.cgi
#!/bin/sh
# JPEG address (only enter the digits after 0x)
#ADDRESS=2d6648
ADDRESS=037c2f4
# Get ppsapp PID
PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
/mnt/mmc01/jpeg-arm /proc/$PPSID/mem $ADDRESS 57336 mjpeg 2> /dev/null
#!/bin/sh
# JPEG address (only enter the digits after 0x)
#ADDRESS=2d6648
ADDRESS=037c2f4
# Get ppsapp PID
PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
/mnt/mmc01/jpeg-arm /proc/$PPSID/mem $ADDRESS 57336 mjpeg 2> /dev/null
/mnt/mmc01/cgi-bin # cat snap.cgi
#!/bin/sh
# JPEG address (only enter the digits after 0x)
#ADDRESS=2d6648
ADDRESS=037c2f4
# Get ppsapp PID
PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
/mnt/mmc01/jpeg-arm /proc/$PPSID/mem $ADDRESS 57336 2> /dev/null
/mnt/mmc01/cgi-bin # cat play.cgi
#!/bin/sh
echo -e "Content-type: text/plain\r"
echo -e "\r"
# Set here the request address for ppsapp
#REQADDR=$((0x42d6e4))
EQADDR=$((0x037cb00))
# Get ppsapp PID
PPSID=$(ps | grep -v grep | grep ppsapp | awk '{print $1}')
# Get file (from command line or query)
if [ "$1" != "" ]; then
 FNAME=$1
else
 FNAME=$QUERY_STRING
fi
# Check file
if [ ! -e "$FNAME" ]; then
 echo $FNAME does not exist!
 exit 0
fi
# Check if it's already playing something
PLAYING=$(/mnt/mmc01/busybox dd if=/proc/$PPSID/mem bs=1 skip=$REQADDR count=4| /mnt/mmc01/busybox od -t x4 | /mnt/mmc01/busybox head -1 | awk '{print $2}')
if [ "$PLAYING" == "00000000" ]; then
 # Write filename
 echo -en "$FNAME\x00" | /mnt/mmc01/busybox dd of=/proc/$PPSID/mem bs=1 seek=$((REQADDR+8))
 # Request playback
 echo -en "\x01" | /mnt/mmc01/busybox dd of=/proc/$PPSID/mem bs=1 seek=$REQADDR
 echo Playing $FNAME
else
 echo "Can't play right now as something is already playing!"
fi
/mnt/mmc01/cgi-bin #

now i have a new error message

/bin/sh: mnt/mmc01/cgi-bin: Permission denied
/ # Content-type: text/plain
/bin/sh: Content-type:: not found
/ #
/ # dd: invalid number ''
/bin/sh: dd:: not found
/ # Can't play right now as something is already playing!
> /mnt/mmc01/cgi-bin #
>

are these the right values?

snap.cgi and mjpeg.cgi address: 0x037c2f4 play.cgi request address: 0x037cb00

guino commented 1 year ago

@desiue you accidently removed the 'R' in front of this line in your play.cgi file: REQADDR=$((0x037cb00)) -- fix that and try again.