From ffbfd566239e29f8a7b1518a41ef24d0a113a491 Mon Sep 17 00:00:00 2001 From: hiromitu Date: Wed, 29 Sep 2021 11:40:59 +0900 Subject: [PATCH] get_jpeg.cgi implemented --- filesnooper.c | 31 ++++++++++++++++++++++--------- modules/libcallback.so | Bin 10596 -> 11254 bytes scripts/get_jpeg.cgi | 17 +++++++++++++++++ scripts/honeylab_init.sh | 4 +++- scripts/still_image.html | 13 +++++++++++++ 5 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 scripts/get_jpeg.cgi create mode 100644 scripts/still_image.html diff --git a/filesnooper.c b/filesnooper.c index ca0b208..c3ebb56 100644 --- a/filesnooper.c +++ b/filesnooper.c @@ -6,7 +6,7 @@ #include #include #include - +#include #include static ssize_t (*real_write)(int fd, const void *buf, size_t count) = NULL; @@ -29,14 +29,6 @@ struct v4l2_format vid_format2; int v4l2_fd2; char v4l2_device_path2[255]; - -struct tm *gmtime_r_(const time_t *timep, struct tm *result) -{ - fprintf(stderr,"!!! called gmtime_r!!!\n"); - fflush(stderr); - - return ((gmtime_r_t)dlsym(RTLD_NEXT, "gmtime_r"))(timep, result); -} int cnt2=0; static uint32_t test_capture(void *param){ int ret=0; @@ -137,7 +129,26 @@ static uint32_t test_captureyuv(void *param){ return 0; } +static void *jpg_stream_thread(void *m) +{ + int n=0; + char filename[255]; + fprintf(stderr,"jpeg_stream_thread_start"); + while(1){ + FILE *fp; + fp=fopen("/tmp/get_jpeg", "r"); + if( fp ){ + sprintf(filename,"/tmp/snapshot.jpg"); + local_sdk_video_get_jpeg(0,filename); + remove("/tmp/get_jpeg"); + fclose(fp); + sleep(0); + }else{ + + } + } +} uint32_t local_sdk_video_set_encode_frame_callback(uint32_t param1,uint32_t param2){ void *handle; fprintf(stderr,"!!! called local_sdk_video_set_encode_frame_callback !!!\n"); @@ -158,6 +169,8 @@ uint32_t local_sdk_video_set_encode_frame_callback(uint32_t param1,uint32_t para fprintf(stderr,"enc func injection save pcb=0x%x\n",pfunccb); param2=(uint32_t)test_capture; fprintf(stderr,"override to 0x%x\n",param2); + pthread_t tid; /* Stream capture in another thread */ + pthread_create(&tid, NULL, jpg_stream_thread, NULL); } int ret=real_local_sdk_video_set_encode_frame_callback(param1,param2); /* diff --git a/modules/libcallback.so b/modules/libcallback.so index e9a69f8aee361fec59251b06b9d4e7c7bccafcb8..6742d3285063791c7af100e5b7a76facf7a7759f 100644 GIT binary patch literal 11254 zcmcIqYj9h~bzT6JOe>57Qi=;vw0$AL5^XCGNU^r8(hWp_5|vUCEzzz#&GZrkE=kBB zfC85?351Lc)=AwGz5Ei{^3x7@EM9_YVvDL%{-~;NMM;?>$lH*q=T78@ zkg40F$U5DJN*MXW$PcJS+Ku{92R<7n+7wG_-LymX_8L^Q8|{c?DIPT1A4C0qg|{2+ ztUiKF8?;J%Mohb8A$Ftu2r{23pNUR=x`J{Ka?HSYs&dUR1)y~V%(xbqg7~8yxYn39 zi+5|>L&a@AF@v%bE#E^q4$S96OiJ>j&AKr90r2DAWC~(6^#k{SUg9oq{c){I`c2}o zHT|6;34Hw_O}|-$Q7r=N`TrC+iHH7Apz8wvUtTl5OZ>ezll*6)_&(?_Z~-Cl`FsMn zV&KPs-+0g`-a#MrDFYXc{$B;wiEAoI`UiZXhC1ml0Z$n8zp05)TF6uAA2a%21dbc{ z2f#4{>$O5Q9RF*qsI(pB6QH;1_U{t^Mr@3KMH8bWeLMPTfBC$+#81$6y{DnC-hUis zA^$q)g9bkrSQvO2P$%+_qyIYiYkT|)@J*!z?R^vZWPSe4;!n_j!{~nv_?m%7HFK2Y zUqSz>(SIEH;|9Nf2hEs){|Egm2K{${FBy0i_=16joy})mVNVzBOtxGU_7t$N504+Q zGfv5w&X!%LG=3zJE99N=)MU<)eXV=!^n8j8Qn~DlAhb1=JylB0I+$syV9z)yFt#UC zWv2|1Lr0&nhezy##}6DCwnvi3(bSmN9H$4g;;H&RcG^C!Bu?Z~Wlm6>n#-rtld?R6 zN;>a~)7gxjP8G{uWvWn`O`&Zd*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mj>4I zUe*a+5uWl$;zb(0mVu;td;xLtu?~43$-7C`gLXR4 zc_e7Q1@J9w!uKZz-y--HHz^kjHZ3o}`ECh(%Sh9XcChSM;JtDKoPT<8ai?`6ua18S zaq0~_0-WDs;A>^aR~md`(Bpee3js~n-=8DSa(m(FC@-v{@}D&NRWFo@_&Wo>H4PAI z(ceb=m$e$cTFM3QZj{9o%A)%oyp9t`z-Ky5qmgKeLmQC8hF{O?>5x$4Dh=K{sZ7% zb{06&d2dMjXrT}GEh8KTX3G-4j_{1P2qOQRz@wnE2}p0&{|88)_v)Ma|0A%e@4o?? z`u+#-x;#Zt`ly;lA{^_-ZzK?R0v8PZuyhixfj2>?>5I+Rg{fn+;y!t^sqsMo0WBgP-^EHDFyn@8vr%IdF}~_ToJ?u7oz+tKJD*2A%zY^bd0~ zL490Cz89z>o4 z*6UT;_Zi@_A@B1BzXkeV0Gs#LZvb4Z0h{jvo+Tagn||l;NrRuW&phy& zA@4chMtPm$1z__X#OHv`cM5+7yl&*b0DQ&3Uj;VbO{@T0XbAmo;-7)Fvk>_iaHD)M za{bG-ZZsuQMHh?TsVPKlJ3evpls$Ir^n`5#4R1j8i}In7qsLB2hL6YV+{V4RJ8P$S zV_y>W>+(htZrJnobT*&FJ+oX++lje(fmL%M>tIV5{hdb+J}gMEGwFGvexdH~({r=4 z=R`iqts~N7{aW3T6T?y&b&IbNRnzfCiEazLd*jUtfgf*m7rWbyF^*?|)Of zDLeM)&3ES50=T^UcjtcrvW$Kre%0Xy*oqHc_Al)7al zylF_}a0@T&qhlwB4v*OckS*Svs7DjF@nXSyGtuG!NpnSbPg*uU#?Wsd_~M~qW1o;OD%48~ S-57lz;C#hy@dQP^t@vL>k9bM| diff --git a/scripts/get_jpeg.cgi b/scripts/get_jpeg.cgi new file mode 100644 index 0000000..8b00134 --- /dev/null +++ b/scripts/get_jpeg.cgi @@ -0,0 +1,17 @@ +#!/bin/sh + +echo "Cache-Control: no-cache" +echo "Content-Type: image/jpeg" +echo "" + + +touch /tmp/get_jpeg +while true +do + if [ ! -f /tmp/get_jpeg ]; then + break + fi +done + +cat /tmp/snapshot.jpg + diff --git a/scripts/honeylab_init.sh b/scripts/honeylab_init.sh index 3e51731..62fa017 100644 --- a/scripts/honeylab_init.sh +++ b/scripts/honeylab_init.sh @@ -70,8 +70,10 @@ mkdir /tmp/www mkdir /tmp/www/cgi-bin chmod 755 /tmp/www/cgi-bin cp /tmp/mmc/scripts/honeylab.cgi /tmp/www/cgi-bin +cp /tmp/mmc/scripts/get_jpeg.cgi /tmp/www/cgi-bin chmod 755 /tmp/www/cgi-bin/honeylab.cgi - +chmod 755 /tmp/www/cgi-bin/get_jpeg.cgi +cp /tmp/mmc/scripts/still_image.html /tmp/www echo "run /tmp/mmc/scripts/pre.sh" source /tmp/mmc/scripts/pre.sh diff --git a/scripts/still_image.html b/scripts/still_image.html new file mode 100644 index 0000000..876b3a7 --- /dev/null +++ b/scripts/still_image.html @@ -0,0 +1,13 @@ + + ATOM CAM STILL IMAGE TEST + + +STILL IMAGE
+ +