Scripting the DirectFB

Uncategorized Comments Off on Scripting the DirectFB
Mar 162012

There is a new version of NodeZ2.  The biggest addition is a module for scripting the DirectFB within Node.js.  No browser required.  How cool is that!

It’s not very tested and there are holes in the implementation, but it’s still very functional.  Included are several example scripts that should get you going.  No cross compiler needed.

If you decide to flash it to the onboard memory beware, there is very little memory left in the jffs2 file system.  There is enough to store quite a bit of javascript, but if you opkg anything it should be directed to the overlayfs.

There is a problem with the keypad not working shortly after bootup.  Symptoms include not being able to use the alt key.  Until the problem is resolved you’ll need to work around it… suspend the ZipIt by pressing the power button, then wake it up by pressing power again.  This should get the keyboard working again.

NodeZ2_v4

To start one of the example scripts… cd to /root/node/dfb_examples and enter the following:

root@OpenWrt:~/node/dfb_examples# node df_window.js

Use the escape key to end the program.

Other new features include color syntax highlighting for javascript in nano.  You can add other syntax maps for bash or cpp files, but they’re not included by default.  I compiled nano to use the mouse too, but no luck.  Additional packages must be needed, I didn’t troubleshoot much.

The source for the new bindings is on github.


NodeZ2 is a tiny rootfs for the ZipIt Z2 designed to fit into the onboard flash memory.  It was created with the OpenWrt build system brought to the ZipIt by Projectgus… way to go bloke!

After flashing… the partition layout will leave ~1Mb of space for your Javascript web app, or other desired packages.  Additional packages can be added using the overlayfs and an SD card or USB memory.

Note: NodeZ2 will only start on a ZipIt that has the ‘U-Boot’ bootloader installed.

To flash NodeZ2 onto your ZipIt follow these steps:

  1. Download NodeZ2 (md5sum fa9b838736ad74f36533bc8896c60772)
  2. make an ext2 partition at least 20 MB in size, mount it then cd to the new partition
  3. unpack with the following command –>  root@OpenWrt:/# sudo tar -xjpvf ~/Downloads/NodeZ2_rc2.tar.bz2
  4. insert the SD card and boot the ZipIt
  5. After booting run    –> root@OpenWrt:/# /root/flash_NodeZ2.sh
  6. poweroff, remove the SD card, and boot the ZipIt
  7. change password     –> root@OpenWrt:/# passwd
  8. change mac address –> root@OpenWrt:/# nano /etc/config/wireless (option ‘disabled’ should be ‘1’)

 

*******   WiFi settings can be configured by pressing the ‘Home’ key followed by ‘c’  *******

Included packages:

B.A.T.M.A.N mesh networking

configure your meshnode with the included batconnect script

root@NodeZ2:/# batconnect zipit 2412 192.168.11.235 <— yields a static IP on channel 1

Node.js server side Javascript

root@NodeZ2:/# node /root/webserver.js to start the example

**use nano to edit and create new scripts

tmux terminal multiplexer

root@NodeZ2:/# readme for a list of hotkeys to use

mjpg_streamer webcam streaming server

root@NodeZ2:/# startWebCam (uvc webcam and USB mod required)

mpg123 mp3 player (also plays shoutcast streams)

root@NodeZ2:/# mpg123 -b 1024 http://ice.somafm.com/groovesalad

 

 


© 2016 engine12