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

Port scripts to rootfs #3

Merged
merged 32 commits into from
Nov 12, 2018
Merged

Port scripts to rootfs #3

merged 32 commits into from
Nov 12, 2018

Conversation

jmtatsch
Copy link
Contributor

@jmtatsch jmtatsch commented Aug 15, 2018

Worst known issues:

[ ] ALSA capture broken in the rtspserver

2018-08-15 02:50:41.408 ( 586.924s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error
2018-08-15 02:50:41.409 ( 586.924s) [DeviceSource    ]        ALSACapture.cpp:737    ERR| Audio Get Frame Data error

@jmtatsch jmtatsch mentioned this pull request Aug 15, 2018
@jmtatsch
Copy link
Contributor Author

@nik0 do you understand why currentpic.cgi delivers zero length pages?

@nik0
Copy link
Contributor

nik0 commented Aug 15, 2018

I am not at home at this moment (holidays) will look when I will get back..

@nik0
Copy link
Contributor

nik0 commented Aug 15, 2018

Maybe I am wrong (I looked on my phone) but I don’t see getimage binary, no ?

@jmtatsch
Copy link
Contributor Author

getimage binary is in /usr/bin, it also produces a valid looking jpg.
There seems to be a timing issue though. Only if i cat a prerecorded image instead of getimage, i am able to produce a non-zero length page before some timeout :(

@nik0
Copy link
Contributor

nik0 commented Aug 23, 2018

I tried to test:

  • For me getimage does not have the execution rights
  • Anyway getimage does not produce any jpeg, the video server has a lot of log error, and is not stable at all

@p4u
Copy link

p4u commented Aug 25, 2018

Once this PR is merged, this patch should be applied:

diff --git a/etc/init.d/rcS b/etc/init.d/rcS
index 1bb2f01..b696407 100755
--- a/etc/init.d/rcS
+++ b/etc/init.d/rcS
@@ -75,6 +75,14 @@ fi
 ntp_srv="$(cat "/etc/ntp_srv.conf")"
 busybox ntpd -p "$ntp_srv"
 
+## Install busybox and dropbear applets
+[ ! -d /usr/bin ] && mkdir /usr/bin
+[ ! -d /usr/sbin ] && mkdir /usr/sbin
+busybox --install
+[ ! -e /usr/bin/ssh ] && ln -s dropbearmulti /usr/bin/ssh
+[ ! -e /usr/bin/scp ] && ln -s dropbearmulti /usr/bin/scp
+[ ! -e /usr/bin/dropbear ] && ln -s dropbearmulti /usr/bin/dropbear
+
 # Start Motor:
 insmod /lib/modules/$KERNEL_VERSION/sample_motor.ko
 

Cause many binaries are missing in your rootfs. But instead of uploading to GIT the links to busybox, it's better to let busybox install himself in boot time.

@p4u
Copy link

p4u commented Aug 26, 2018

And another small patch

diff --git a/var/www/cgi-bin/action.cgi b/var/www/cgi-bin/action.cgi
index 3ad22fd..78b14f5 100755
--- a/var/www/cgi-bin/action.cgi
+++ b/var/www/cgi-bin/action.cgi
@@ -6,6 +6,7 @@ echo "Cache-Control: max-age=0, no-store, no-cache"
 echo ""
 
 source ./func.cgi
+source /usr/scripts/common_functions.sh
 
 if [ -n "$F_cmd" ]; then
   if [ -z "$F_val" ]; then

@p4u
Copy link

p4u commented Aug 26, 2018

In addition the following directories are missing:

/usr/userscripts/
/var/tmp/
/var/spool/cron/crontabs/

@p4u
Copy link

p4u commented Aug 26, 2018

Came on, merge this PR and let's work together in the same repository! I'd send PR but they are dependent on the work done by @jmtatsch

By the way, this EXT3 rootfs is the correct way to do it. The VFAT/sdcard rootfs method should be removed... So let's make this thing work :)

@jmtatsch
Copy link
Contributor Author

@p4u We need to figure out why currentpic.cgi doesn't work. Sadly I am out of ideas.

@p4u
Copy link

p4u commented Aug 31, 2018

It works for me. Just change the getimage path to full path (instead of relative).

#!/bin/sh

echo "Content-type: image/jpeg"
echo ""
/usr/bin/getimage

I also found that v4lrtspserver log is taking a lot of space (14GB) cause there are many log errors related with the sound driver. I fixed it by disabling the sound (add -A option to /etc/rtspserver.conf)

@jmtatsch
Copy link
Contributor Author

@p4u Great news, does the preview image on the website work then?

@jmtatsch jmtatsch changed the title Port scripts to rootfs [WiP] Port scripts to rootfs Sep 1, 2018
@jmtatsch
Copy link
Contributor Author

jmtatsch commented Sep 1, 2018

@nik0 could you please compile rtspserver-master again with the new location for the motion scripts?

@benleb
Copy link

benleb commented Sep 1, 2018

Nice work @jmtatsch & @p4u!
Replacing motor with its full-path /usr/bin/motor in /var/www/cgi-bin/action.cgi also fixes the controls in the webinterface :)

@jmtatsch
Copy link
Contributor Author

jmtatsch commented Sep 1, 2018

@benleb does the preview image in the webui work for you? for me it still doesn't :(

@anmaped
Copy link

anmaped commented Sep 3, 2018

Hi guys! Are you building the rootfs with buildroot? Could you share the configuration files? I think instead of an ext3 partition is better to use jffs2 inside the sdcard. Are uboot and kernel able to do it?

@jmtatsch
Copy link
Contributor Author

jmtatsch commented Sep 9, 2018

@anmaped I don't know for certain, but I don't think so. Your ideas and help is welcome .

@jmtatsch
Copy link
Contributor Author

jmtatsch commented Sep 9, 2018

webui image and motion detection work for me now

@anmaped
Copy link

anmaped commented Sep 10, 2018

@jmtatsch It works for me as well.

I have a from scratch build of a new toolchain, kernel, and rootfs compilation script. Is there someone interested to test it in different versions of dafang ? It includes opkg and all the wireless tools (iwlist iwconfig etc..).

It is able to use dd to flash a partition in the sdcard with the rootfs.ext3 and then to resize it using the resize2fs tool. I think it is better than using git and using another device to flash it.

It would be great if we could do some script for modifying the rootfs automatically with these new ports (website, scripts and others).

@jmtatsch
Copy link
Contributor Author

@anmaped sounds great, i'd be willing to test.

@jmtatsch
Copy link
Contributor Author

Playing sounds and mic audio is still broken for me.

@nik0
Copy link
Contributor

nik0 commented Sep 11, 2018

Do you have any audio logs ? Server, or dmeg ?

@jmtatsch
Copy link
Contributor Author

@nik0 sure

v4l2rtspserver-master.log:

2018-09-11 15:01:27.606 (15924.297s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error
2018-09-11 15:01:27.606 (15924.297s) [DeviceSource    ]        ALSACapture.cpp:737    ERR| Audio Get Frame Data error
2018-09-11 15:01:27.607 (15924.297s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error
2018-09-11 15:01:27.607 (15924.298s) [DeviceSource    ]        ALSACapture.cpp:737    ERR| Audio Get Frame Data error
2018-09-11 15:01:27.607 (15924.298s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error
2018-09-11 15:01:27.608 (15924.298s) [DeviceSource    ]        ALSACapture.cpp:737    ERR| Audio Get Frame Data error
2018-09-11 15:01:27.608 (15924.299s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error
2018-09-11 15:01:27.608 (15924.299s) [DeviceSource    ]        ALSACapture.cpp:737    ERR| Audio Get Frame Data error
2018-09-11 15:01:27.609 (15924.299s) [DeviceSource    ]        ALSACapture.cpp:732    ERR| Audio Polling Frame Data error

dmsg:

[   19.931043] ------ come to i2s_enable 
[   19.934947] cgu_set_rate, parent = 860160000, rate = 11289600, n = 76, reg val = 0x2000204c
[   19.934958] i2s_set_rate, i2s clk rate is 11289600
[   19.934968] codec_codec_ctl: set sample rate...
[   19.934979] dp->filter convert_16bits_stereo2mono
[   19.940026] dma dma0chan24: Channel 24 have been requested.(phy id 7,type 0x06 desc a115e000)
[   19.949193] codec_codec_ctl: set device...
[   19.949209] codec_set_device 13 
[   19.952553] codec_set_device: set device: MIC...
[   20.355674] cgu_set_rate, parent = 860160000, rate = 4096000, n = 210, reg val = 0x200020d2
[   20.355691] i2s_set_rate, i2s clk rate is 4096000
[   20.355702] codec_codec_ctl: set sample rate...
[   20.355748] SOUDND ERROR: xb_snd_dsp_ioctl(line:2271) ioctl command 1074024550 is not supported

@nik0
Copy link
Contributor

nik0 commented Sep 11, 2018

I am not sure if available but did you test something like "audioplay"
Now the audio should be Linux standard with a /dev/dsp device

@jmtatsch
Copy link
Contributor Author

audioplay executable is missing :)

@jmtatsch
Copy link
Contributor Author

I will transplant one and report back

@p4u
Copy link

p4u commented Sep 11, 2018 via email

@nik0
Copy link
Contributor

nik0 commented Sep 11, 2018

Yes you can do that.
Now I don't understand why the server is not working. Did you use the -a (new) option ?

@jmtatsch
Copy link
Contributor Author

Mic somewhat works with -a parameter, however the image is mostly frozen and the audio stuttering.
There seems to be memory leaking:

------ come to i2s_enable 
[   20.335650] cgu_set_rate, parent = 860160000, rate = 11289600, n = 76, reg val = 0x2000204c
[   20.335669] i2s_set_rate, i2s clk rate is 11289600
[   20.335681] codec_codec_ctl: set sample rate...
[   20.335693] dp->filter convert_16bits_stereo2mono
[   20.362167] codec_codec_ctl: set device...
[   20.362189] codec_set_device 13 
[   20.380701] codec_set_device: set device: MIC...
[   20.796110] cgu_set_rate, parent = 860160000, rate = 4096000, n = 210, reg val = 0x200020d2
[   20.796128] i2s_set_rate, i2s clk rate is 4096000
[   20.796139] codec_codec_ctl: set sample rate...
[   23.576711] free: 0, user: 8
[   23.579942] prepare-buffer underrun
[   23.716314] free: 0, user: 7
[   24.679466] free: 0, user: 8
[   24.682460] prepare-buffer underrun
[   24.992860] free: 0, user: 7
[   37.033600] free: 0, user: 8
[   37.036640] prepare-buffer underrun
[   37.203494] free: 0, user: 7
[   64.243331] free: 0, user: 8
[   64.246324] prepare-buffer underrun
[   64.281050] free: 0, user: 7
[   69.290834] free: 0, user: 8
[   69.293865] prepare-buffer underrun
[   69.330449] free: 0, user: 7
[  113.319198] free: 0, user: 8
[  113.322254] prepare-buffer underrun
[  113.515657] free: 0, user: 7
[  116.526857] free: 0, user: 8
[  116.529856] prepare-buffer underrun
[  116.709258] free: 0, user: 7
[  153.720602] free: 0, user: 8
[  153.723621] prepare-buffer underrun
[  153.736762] free: 0, user: 7

@nik0
Copy link
Contributor

nik0 commented Sep 11, 2018

Did you change the parameters ? Something like 8000 for in

@jmtatsch
Copy link
Contributor Author

you mean AUDIOINBR=8000?
Makes it a bit smoother, no more underruns, stable at 60 mb free ram, 60 % cpu for the rtspserver though, bad video quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants