Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: gavinmc42 on January 19, 2015, 03:18:38 AM
-
Been using Busybox-httpd as my webserver.
Want to add a shell script generated SVG temperature plot file.
It looks like SVG is not a MIME type supported in Busybox-httpd.
Can it be added or does it need to be recompiled?
Or else convert .svg to .png, yikes.
-
You can add mimetypes in its (runtime) config file. See httpd.c in busybox source for an example.
-
Added this line to the httpd.conf file
.svg:image/svg+xml
Made no difference after rebooting.
Chrome auto downloads the SVG file
And Firefox says I need a plugin.
On Windows viewing the index.html file works in Chrome and Firefox.
The difference between serving the file and viewing a index.html file with .svg link?
SVG is just text, so serving it should be easy, it just needs to tell the other end (browser) it is an image.
-
No idea why it is not serving external SVG image file properly, has no trouble with .png.
Now doing inline SVG in the shell script that generates the HTML index file, it works but it is ugly.
-
Did you check the mimetype was applied? ie wget -S -O /dev/null localhost/foo.svg
-
Not connected to the net, so wget won't work.
Raspberry Pi's firewalled by the Uni :(
Just got 1st plots on the web page.
done as inline svg generated by shell scripts and spliced into the index.html file.
Takes about 10 secs but I only need 60 sec update.
-
You can convert image to png/jpg also if it fits better
-
SVG's are easy to make from shell scripts, just text files.
Nearly all browsers support SVG, some even with hardware acceleration.
Will need a conversion program to convert to png/jpg, extra programs then required.
Trying to do everything with just Linux kernel and busybox.
The minimalist IoT setup, but at HTML5 standard.
2 reasons..
I get to learn Linux at nearly the lowest level and smallest OS size.
Future IoT stuff is easier to do if libraries/programs are not needed when porting to other hardware/CPUs.
Linux is/will be every where.
We use Raspberry Pi's because they are cheaper and with more stuff than any other CPU board including Arduino.
Once it all works in shell then C compiled code can be done to make it go faster.
Could do it all in Raspbian and apt-get the extra programs but I don't learn much and I end up having to support a 4GB OS.
Did that to start with 2yrs ago, it is still working luckily.
-
hi gavinmc42,
I like your minimalist approach and wanting to do temperature graphs in the future thought I'd test svg on piCorePlayer.
I added .svg:image/svg+xml to http.conf
Stopped web server. Started it again with:
/usr/local/sbin/httpd -h /home/tc/www -c /home/tc/http.conf
svg file displayed in all web browsers I tried on Windows 7 PC and iPad.
regards
Greg
-
Hi Greg,
Will retry http.conf to get httpd serving .svg files.
Need to add some code to save previous days plots as *.svg.
Then user can view/download earlier plots.
HTML Inline SVG graphing is possible, take about 10 secs to generate plots using only every 5 mins of data.
Much longer plotting every minute.
Compiling a small C program would speed it up.
I have to use sed alot.
Starting with a basic html file called index.txt, sed looks for lines with "insertdatahere" and replaces it with the formatted svg line plot data and copies it to index.html.
Just found my 1st bug, HTML inline SVG does not like NULL values:(
Looks like it's due to i2c sensor read error.
Inline SVG on a browser is fast, png screen dump is 57kB but HTML page with inline SVG is 13kB.
-
hi gavinmc42,
Nice plot...first half.
I'll have to remember this thread when I get around to generate some temperature plots.
I have always used perl and GNUplot in the past. So shell and svg will be a new challenge.
regards
Greg
-
Yep, that plot is what happens when someone defrosts while you are debugging :)
SVG reminds me of the old HP-GL plotter language, pen up, move to x,y, pen down, line to x1,y1
Now trying to figure out Busybox-httpd CGI scripts, back to the Corebook.pdf
Got nice HTML5 spinner boxes to set temperature alarm levels.
Now trying to figure out how to get the values in the browser back to the RPi and written into the config.ini file.
I think CGI scripts is one way to do it?
That temp plot is pretty much my coding progress too - up, down, crash.
Someone is working on putting i2c-tools into busybox, when that works I can toss i2c-tools.tcz.
-
Yeah, the easiest is to put the element inside a form with "method=get action=myscript.sh". Then in myscript you will have all form elements in the $QUERY_STRING variable.
For example, it could have "name=matt&value=50", without quotes.
-
Someone is working on putting i2c-tools into busybox, when that works I can toss i2c-tools.tcz.
i2c-tools.tcz already in the repo. It is a small 66k extension, which depends on perl5.tcz However you can check whether perl is need for your application and if not you can drop it. Also in a specific case you can use a smal wrapper to interface i2c-tools.
-
Yep, that plot is what happens when someone defrosts while you are debugging :)
SVG reminds me of the old HP-GL plotter language, pen up, move to x,y, pen down, line to x1,y1
Now trying to figure out Busybox-httpd CGI scripts, back to the Corebook.pdf
Got nice HTML5 spinner boxes to set temperature alarm levels.
Now trying to figure out how to get the values in the browser back to the RPi and written into the config.ini file.
I think CGI scripts is one way to do it?
That temp plot is pretty much my coding progress too - up, down, crash.
Someone is working on putting i2c-tools into busybox, when that works I can toss i2c-tools.tcz.
Hi gavinmc42,
I don't know if you have ever looked at piCorePlayer.
Steen and I have based the gui interface all on busybox-http, shell, shell cgi and html5 only (plus a little javascript). We pass variables around via the $QUERY_STRING as suggested by curaga.
If you get stuck, I think we could help.
I like to design and build DIY amps, and wanted to include a Raspberry Pi into my prototype amps as a temperature monitoring device to track output device and heatsink temperatures. I came across Steen's piCorePlayer and realised Steen had already done all the hard work of getting piCore and a nice web interface going. I did get side tracked a little and would like to get back to my original goal.
regards
Greg
-
Typo in CGI shell script.
Easy than I thought once I got first script working.
Now to figure out how to get spinner values to update my variables.