Dune player STB firmware ======================== STB firmware for Dune players allows to run Web applications with support of media playback on Dune players. Web browser with support of HTML, JavaScript and AJAX is used in this case as a main application UI. Media playback and other related functionality is available to Web application via Dune JavaScript STB API. See "doc/dune_js_stb_api.txt" document for the details on the API. To use STB firmware with JavaScript STB API on Dune player one need to: - prepare Dune player; - prepare initial web page; - update firmware on Dune player. Dune player preparation ----------------------- All of the following steps are required to prepare Dune player for use with STB firmware. It is assumed that regular Dune firmware is installed on the device. If STB firmware is already installed, see below how to run native Dune UI instead of Web browser. 1. Enable telnet access on the device: http://files.dune-hd.com/partners/sdk/dune_devel_info.txt Ensure telnet access is enabled on each STB boot. After turning telnet access on page "Setup" / "Information" should display "DEBUG MODE". 2. Modify Web browser setting "Setup" / "Applications" / "Web Browser" / "Overscan". Set it to "Disabled". 3. Modify Web browser setting "Setup" / "Applications" / "Web Browser" / "Zoom level". Set it to "100%". 4. Prepare initial web page that will be loaded on device start. Name it "index.html" and copy to device: telnet mkdir /config/stb_home cp .../index.html /config/stb_home/index.html sync See http://files.dune-hd.com/partners/sdk/dune_devel_info.txt for information on how to mount NFS share or where to find locally attached storages (like USB disks) being mounted. Sample initial web page is included into this SDK, see file "test/index.html". 5. Make sure device IP address is known. There are at least 3 ways to fulfill this: - configure device with manual IP address (set "Setup" / "Network" / "Mode" to "Manual" and configure all TCP/IP settings); - configure device with "Automatic (DHCP)" mode ("Setup" / "Network") and ensure DHCP server always assigns known IP address to the device; - implement JavaScript code in initial page that uses STB API and waits and displays device IP address. Sample initial page already contains such code. STB firmware update ------------------- Method of firmware update described below should work in all cases even if standard firmware update cannot be started from native Dune UI. 1. Download STB firmware. Link for download should be provided to you separately. 2. Unpack archive with firmware to the root of USB disk. 3. Rename DFF file to "dune_firmware.dff". 4. Attach USB disk to device, turn device power off and on. Press POWER button on RC. 5. Wait while device recognizes USB disk and updates firmware. Indicator on front panel flashes red and blue while firmware is updated. When indicator stops with blue for enough time (~10 seconds), power off device. 6. Detach USB disk from device, turn device power on and press POWER button on RC. STB firmware details -------------------- Web browser is loaded in STB firmware when device starts if initial web page is present. If initial web page cannot be found native Dune UI is started instead. Default initial web page loaded on start of device is /firmware/config/stb_home/index.html (if present), but if /config/stb_home/index.html exists it is loaded instead. The page can contain arbitrary HTML/JavaScript code including redirection to external sites. But it is recommended to add JavaScript code to the page that waits for assigning of IP address to device. Sample page provided with this SDK already contains such code, see file "test/index.html". Initial web page can be modified using telnet access to device. Web browser is started in special mode in STB firmware comparing to Web browser from regular Dune firmware: - all key events need to be processed by Web application, browser processes only POWER RC button; - browser is run in full screen mode and menu/status bar are not shown; - mouse cursor is hidden. Besides Web browser, native Dune UI can be started in STB firmware even if initial web page is present. To do this send device to standby mode with POWER RC button and wait until indicator on front panel becomes red. Then press BLUE/D RC button. Native Dune UI will be launched. You can switch back to Web browser by sending device to standby mode with POWER RC button and awaking it with POWER RC button again. JavaScript STB API supports launching native Dune UI with "launchNativeUi()" function. Refer to "doc/dune_js_stb_api.txt" document for details. To return to Web browser from native Dune UI started with "launchNativeUi()" function, press RETURN RC button on main screen of the UI. SSH access to device -------------------- Since telnet access to device is targeted primarily to development and often is forbidden in production environments, STB firmware comes with SSH server. Only public key authentication is supported for SSH access. Developer public key included into firmware can be found in "/firmware/config/authorized_keys" file on the device. Private part of the key required for authentication is included into "ssh_key/" directory of the SDK. To access device via SSH run the following command: ssh -i .../ssh_key/dev.key root@ If public key included into STB firmware need to be overridden, you can copy any other public key to device: telnet mkdir /config/authorized_keys cp .../other.key.pub /config/authorized_keys/ sync Restart device in order changes to take effect. Typical administrative and monitoring tasks ------------------------------------------- Below you can find examples of typical administrative and monitoring commands that can be executed on device via SSH access. Get firmware version: grep firmware_version /tmp/sysinfo.txt | awk '{print $2}' Get product id: grep product_id /tmp/sysinfo.txt | awk '{print $2}' Get serial number of device: grep serial_number /tmp/sysinfo.txt | awk '{print $2}' Get Ethernet MAC address: ifconfig eth0 | grep HWaddr | awk '{print $5}' Get Ethernet status: ifconfig eth0 | egrep '(RX|TX)' Get current device state: grep player_state /tmp/run/ext_command.state | awk -F' = ' '{print $2}' Get current playback state if playback is currently performed: grep -w playback_state /tmp/run/ext_command.state | awk -F' = ' '{print $2}' Get currently played media URL if playback is currently performed: grep playback_url /tmp/run/ext_command.state | awk -F' = ' '{print $2}' Get current state of video and audio decoders: /firmware/bin/dump_decoder_status.sh Get playback logs if playback is currently performed: cat /tmp/run/play.log* Get Web browser logs: cat /tmp/run/shell.log* Get memory usage status: cat /proc/meminfo Force loading of HTML page from given URL: echo '' >/tmp/run/web_browser_force_load Force playback of given IPTV URL: wget -q -O /dev/null 'http://127.0.0.1/cgi-bin/do?cmd=start_file_playback&media_url=udp://@239.255.0.106:5500' Force playback of given VoD URL: wget -q -O /dev/null 'http://127.0.0.1/cgi-bin/do?cmd=start_file_playback&media_url=rtsp://10.10.8.77:554/video.ts' Force stop of playback if playback is currently performed: wget -q -O /dev/null 'http://127.0.0.1/cgi-bin/do?cmd=main_screen' Reboot device: sync; reboot Starting firmware upgrade from Web application ---------------------------------------------- To start firmware upgrade from Web application do the following. 1. Create HTML page with Dune specific JavaScript code and publish it with HTTP server. In particular "startFirmwareUpgrade(, )" JavaScript STB API function should be used by page code. Example of the page can be found in the file "test/upgrade.html". 2. Publish firmware image file with HTTP server. Alternatively multicast update server can be used. See section "Running multicast update server" below for details. 3. Force load of created HTML page on device. For example: echo 'http://192.168.137.1/upgrade.html' >/tmp/run/web_browser_force_load Note, if you are using HTTP server for publishing firmware image, you need to use gzipped DFF file (.dff.gz). In this case http:// protocol is specified in the firmware upgrade URL in call to "startFirmwareUpgrade()". For example: startFirmwareUpgrade( 'http://192.168.137.1/dune_firmware_hdtv_101_120201_1421_js_stb.dff.gz', '120201_1421_js_stb'); If you are using multicast update server for publishing firmware image, you need to use DFF file (.dff). In this case udp://@ or igmp:// protocol is specified in the firmware upgrade URL in call to "startFirmwareUpgrade()". For example: startFirmwareUpgrade('udp://@239.255.0.222:5500', '120201_1421_js_stb'); That is equivalent to: startFirmwareUpgrade('igmp://239.255.0.222:5500', '120201_1421_js_stb'); Running multicast update server ------------------------------- To run multicast update server you need x86 computer with Linux OS. To run the server perform the following steps. 1. Download archive with server executable: http://files.dune-hd.com/partners/sdk/misc/dune_file_multicast_server.x86.gz 2. Unpack archive: gunzip dune_file_multicast_server.x86.gz 3. Ensure firmware image (DFF file, not gzipped and not zipped) is available on the server machine. 4. Launch multicast update server. For example: .../dune_file_multicast_server.x86 239.255.0.222 5500 \ .../dune_firmware_hdtv_101_120201_1421_js_stb.dff You can fine tune multicast update server via command-line options. To list available options run the server executable without arguments.