From Ethersex_Wiki
Revision as of 23:25, 13 August 2014 by Coffee (talk | contribs) (Transfer image from old wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
menuconfig Applications->HTTP Server->HTTPD
Pinning -
Ecmd -
Control6 -
Depends on  ?
Requires  ?
Code  ?

Web server on the ethersex

The built-in web server in Ethersex can read the files it should serve from various locations:

  • from an external dataflash
  • files stored in the flash memory of the MCU right after the firmware
  • run ECMD commands and serve the results (for AJAX)

Any of these sources for data can be enabled independent of the others. The easiest option is to initially keep the files in the internal flash memory and to access dynamic content via the HTTP ECMD interface.


General Setup  --->
[*] VFS (Virtual File System) support  --->
| |     [ ] Atmel SPI Dataflash           |  
| |     [*] VFS File Inlining             |  
| |     [ ] SD/MMC-Card Access            |  
| |     [ ] EEPROM (24cxx) Raw Access     |  
| |     [-] DC3840 Camera                 |  
Applications  --->
| |     [*] HTTP Server                   |  
| |     [ ]   Basic Authentication        |  
Applications ---> 
Etherrape Control Interface (ECMD) --->
| | [*] ECMD support                |

Embedding files

If the option Supply Inline Files is enabled, all files stored in vfs/embed/ will be automatically packed with gzip and appended to the end of the firmware when building the image. Filenames remain unchanged, however the maximum length of filenames is 6 characters.

Preprocess files with the C preprocessor or m4

To include files dependent on configuration options (or not) respectively including only parts, if a certain option is enabled, they can be preprocessed by cpp or m4, before the output is packed and appended to the firmware. For that, the file must end in .cpp or .m4. When using cpp, all defines from config.h/autoconf.h are accessible (e.g. ~np~ONEWIRE_SUPPORT~/np~). When using m4, ~np~ONEWIRE_SUPPORT turns into conf_ONEWIRE ~/np~.

Content type of the files

Because the web server can not dynamically determine the content type, this information needs to be supplied in advance. The content type is determined by the first character of the file name:

  • S (e.g. Sty.c): text/css
  • X (e.g. application/xhtml+xml;
  • everything else is served as text/html

Access files from the SD card

To serve files from an SD card, they are copied to the SD card. These can then be accessed by the browser via the following URL (IP and file

name must of course be changed)

If the file is located in a folder on the SD card, it can be accessed via the

following URL.

The length of filenames is not limited to 6 characters with the SD card.

Manually triggering ECMD commands (via HTTP)

To query the IP via ECMD, the following URL (the IP must of course be changed) can be accessed with the browser, returning the output via HTTP.

In order to use commands containing spaces, e.g. "1w list", the spaces must be replaced with "+" or "%20". The following command lists 1-wire sensors, if any are present:


Ethersex start page

If the web server is compiled in, when accessing http://YOUR_ETHERSEX_IP/ the browser should show such a page: