Developing Widgets for Chumby: Testing Widgets

From Chumby Wiki
Revision as of 14:09, 6 June 2008 by Jerecoh (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See also: Developing widgets for chumby

Testing a widget locally

The chumby itself has no substantial local storage, so you should not expect to store widgets on the chumby. If you want to run Flash movies on the device itself without uploading to the chumby servers, you'll need to do it from a USB mass storage device plugged into the back of the chumby.

Here's how to do it without bringing up a console:

  • Get a USB dongle, formatted as VFAT, and put your Flash movie on the top level.
  • Create a script file on the dongle called "debugchumby" with the contents
#!/bin/sh
chumbyflashplayer.x -i /mnt/usb/<name of flash file>.swf

The file must use UNIX-style line terminations, and the last line must be terminated.

  • Plug the dongle into the USB port on the back of your chumby
  • Power it up - after the opening animation, your widget should run

General Notes:

  • Most USB thumb drives come out-of-the-box FAT16 or FAT32 formatted (same thing as VFAT). Mac OS X can write to these drives.
  • The script file should have NO extension (like .txt etc.)
  • Mac OS X users should not use TextEdit, as this application does not support UNIX line encodings. Try creating the file in TextWranger, a free text editor.

Testing a widget from your own HTTP server

The Flash Lite player will accept a URL using the HTTP protocol, so you can host a Flash movie on your own server and run it from the command line:

# chumbyflashplayer.x -i http://www.example.com/mywidget.swf

Keep in mind that such a widget will run in the security domain of the specified server, and this may behave differently from the same widget running from our servers.

Using a secure shell (SSH) console to test widgets

To bring up an SSH console, you need to turn on the secure shell daemon (sshd) on the chumby. There area couple of ways of doing this:

From the Control Panel:

  • Bring up the Control Panel suing the squeeze sensor on the top of the chumby
  • Select the "Settings" button
  • Select the "Chumby Info" button
  • Select the "pi" symbol hidden in the upper right corner of the screen
  • Select the "SSHD button

From a USB flash drive:

  • On the USB flash drive, create a file called debugchumby, with the following contents:
#!/bin/sh
/sbin/sshd
  • Boot the chumby with that installed in one of the external USB ports

You shoud probably also put the widget you wish to test on your USB flash drive.

At this point, the chumby should allow you to log in using an ssh client. Under Windows, we recomment PuTTY, and both MacOS X and Linux typically have ssh clients builtin.

Using your ssh client, log in to the IP of the chumby, with the username "root".

# ssh root@192.168.1.142 (replace with your Chumby's IP address)

You will not be asked for a password. You should see some ASCII art of the chumby logo upon login.

Now you need to stop the currently playing Flash player, whcih is running the Control Panel and widgets - at a prompt, type:

# stop_control_panel

The touchscreen and other sensors should stop responding.

At this point, you should be able to launch your widget. For instance, if your widget is called "widget.swf" on the flash drive mounted at /mnt/usb, then you'd type:

# chumbyflashplayer.x -i /mnt/usb/widget.swf

You can use ctrl-C to exit the player.