Difference between revisions of "Chumby tricks"

From Chumby Wiki
Jump to: navigation, search
(OSX Settings)
(Using a browser to see what's on your chumby)
Line 167: Line 167:
 
  echo "Refresh: 5; #"
 
  echo "Refresh: 5; #"
 
  echo ""
 
  echo ""
  /usr/bin/imgtool --quality=100 --mode=cap -
+
  /usr/bin/imgtool --quality=100 --mode=cap --fb=0 -
  
 
As with other such scripts, it must have UNIX-style line endings.
 
As with other such scripts, it must have UNIX-style line endings.
Line 176: Line 176:
  
 
Now open <code>http://ip.of.your.chumby/cgi-bin/custom/image</code> from your computer's browser. You should see your chumby screen there - it shows the widget, but not the Control Panel if it's open. And it refreshes every 5 seconds (on most browsers)!
 
Now open <code>http://ip.of.your.chumby/cgi-bin/custom/image</code> from your computer's browser. You should see your chumby screen there - it shows the widget, but not the Control Panel if it's open. And it refreshes every 5 seconds (on most browsers)!
 +
 +
Alteratively, if you want to see what's in the secondary framebuffer (usually control panel stuff), use:
 +
 +
#!/bin/sh
 +
echo "HTTP/1.1 200 ok"
 +
echo "Content-type: image/jpeg"
 +
echo "Refresh: 5; #"
 +
echo ""
 +
/usr/bin/imgtool --quality=100 --mode=cap --fb=1 -
  
 
=Configure your chumby to connect wirelessly through a MAC laptop=
 
=Configure your chumby to connect wirelessly through a MAC laptop=

Revision as of 01:03, 30 November 2007

NOTE - this page is for Ironforge production chumby devices - for alpha prototypes, please see Chumby Tricks for Foo/Katamari

Many of these tips and tricks require creating a text file for a script - the chumby, being a Linux-based device, requires that these scripts have UNIX-style line endings (in particular, linefeeds). For Linux users, this is easy - just use your favorite editor. For Macintosh users, the standard TextEdit application will do nicely if you use it in plain text mode. For Windows, we recommend EditPad Pro.

The chumby also has a lightweight version of vi built in.

Hidden screen in Control Panel

  • Open the Control Panel, select "Settings", then "Chumby Info"
  • In the upper right, you'll see a little "pi" symbol - touch it
  • You'll see a screen with some interesting buttons:
    • SSHD will launch the builtin Secure Shell Daemon
    • FILES will open up a simple file system browser
    • REBOOT will reboot the chumby device

Open a secure shell console on the chumby

  • Start sshd using the hidden Control Panel screen
  • Using an SSH client, log in:
    • For Microsoft Windows, you can use PuTTY.
    • For MacOS X and Linux, use the command ssh from a terminal window
  • Use the IP listed on the hidden screen, with the username "root". It will not require a password. For instance, if your chumby has the IP 192.168.1.100, on Linux or Mac, the command would be:
ssh 192.168.1.100 -l root
  • You should get a big ASCII chumby logo

Listening to Internet Radio Stations

Streaming music from SlimServer to chumby

Stream music from your computer to your chumby using SlimServer!

  • Download and install SlimServer http://www.slimdevices.com/su_downloads.html on your computer.
  • Use a Unix-style line-end compatible(linefeeds rather than carriage return line breaks) text editor (TextEdit for Mac, EditPad Pro for Windows) to create a file called "debugchumby" (no extension).
  • Insert the following code into the file, making sure the line break is Unix-style (in EditPad Pro use "Convert" > "To Unix LF")
  #!/bin/sh
  btplay http://ip.of.your.server:9000/stream.mp3 &
  • Verify the IP address is the IP address of the computer that SlimServer is running on.
  • Save the file to a USB flash drive, insert into your chumby, and reboot.
  • Play your music via the SlimServer web interface, and music should play through the chumby's speakers.
  • Enjoy!

Built in web server

On startup, the chumby launches a small HTTP server on port 80, which displays wireless statistics information - to view this page, get the IP of the chumby from the Settings->Chumby Info screen in the Control Panel, and type http://ip.of.the.chumby/ into a browser.

You can add CGI scripts to this webserver:

  • Open a console on the chumby using SSH
  • create a directory at /psp/cgi-bin
  • add your CGI scripts there
  • Make sure CGI scripts have execute permissions (chmod +x script_Name)

You can now access those scripts using the URL http://ip.of.the.chumby/cgi-bin/custom/name_of_your_script

Custom alarms

If you don't like the sound of the builtin alarms, you can override them with your own MP3 audio files

  • Get a USB flash drive, and copy your MP3 file to the top level
  • To override alarm 1, rename the file alarm1.mp3
  • To override alarm 2, rename the file alarm2.mp3
  • ...or to override both, rename the file alarm.mp3 - the individual files will override this one.
  • Plug the USB flash drive and boot your chumby - when an alarm goes off, it will use your files instead of the built in sounds

Don't make these files too big - no larger than a couple of megabytes.

Your own opening animation

If you'd like to replace the little chumby animation that happens when you start up, do the following:

  • Make your Flash animation that you want to run, be sure it calls fscommand("quit") at the end
  • Put it on a USB flash drive, and call it "opening.swf"
  • Plug it into the back of your chumby and reboot!

Your own Control Panel

Note: Requires software release 1.2 or later

So, you're so ambitious, you created you *own* Control Panel! Congratulations! Here's how to use it:

  • Put it on USB flash drive, and call it controlpanel.swf
  • Plug it into the back of your chumby and reboot!

If you have an older software release you can do something similar with a USB dongle, with the file debugchumby containing:

#!/bin/sh
chumbyflashplayer.x -i /mnt/usb/controlpanel.swf

Launching sshd at startup

  • Open up a console on the chumby
  • At the console, type: touch /psp/start_sshd
  • Now sshd will be started whenever the chumby successfully connects to a network!
  • To stop this behavior in the future, type: rm /psp/start_sshd

If you don't want to happen all the time, you can do this instead from a USB flash drive:

  • On the USB flash drive, create an empty file called start_sshd.
  • Plug it into the back of your chumby and reboot!

Make your chumby click when you touch the screen

You can have the chumby give you some simple audio feedback when you touch the screen

  • Open up a console on the chumby
  • Type echo 1 > /proc/chumby/touchscreen/touchclick
  • To turn it off, type echo 0 > /proc/chumby/touchscreen/touchclick

Run processes on start-up

  • The only way to do this right now is to use a USB drive: create a file called debugchumby and put shell script commands in there. This will run on start-up.

Run processes on Log In

  • If you want to run commands as soon as you log in, you can edit your /psp/.profile file.
  • You should probably first make a backup copy of the original: cp /psp/.profile /psp/.profile.orig
  • Next, edit /psp/.profile using the vi editor (I believe this is the only text editor installed on the chumby): vi /psp/.profile
  • Add whatever commands (try the chumby click echo command).
  • After rebooting, these commands should run upon logging into the console.

Mount NFS partitions

In order to NFS mount a remote filesystem from chumby, do the following:

# mount -t nfs -o nolock 192.168.1.115:/root/chumby /mnt/nfs

Example:

mount -t nfs -o nolock 192.168.1.101:/root /mnt/nfs

Screwed up your touchscreen calibration?

If you messed up your touchscreen calibration to the point that you can't even restore it through the Special Options mode, create a file called 'ts_settings' on a USB dongle with the contents:

136,3768,3835,-3540

...put the dongle in one of the USB ports in back of your chumby and reboot. This restores the calibration to factory settings, which is at least good enough to let you navigate the Control Panel to the calibration section.

Use wired Ethernet

Note: This has only been tested with the Linksys USB200M USB Ethernet adapter, though it *may* work with others. Also note that this example only describes how to connect using DHCP.

  • create a debugchumby file with the following contents:
#!/bin/sh
insmod /drivers/usbnet.ko
insmod /drivers/asix.ko
udhcpc -t 5 -n -p /var/run/udhcpc.eth0.pid -i eth0
ifconfig rausb0 inet 127.0.0.1
/usr/chumby/scripts/sync_time.sh
  • copy the debugchumby script to a USB drive
  • insert the USB Ethernet adapter (Linksys USB200M) into a chumby USB port
  • insert the USB drive into the other chumby USB port
  • power on your chumby

Mixing local widgets into a channel

When the chumby loads a channel from the server, it also checks for a file called profile.xml on the USB device mounted at /mnt/usb. That file should contain XML that is merged into the XML coming from the server to create the full channel. An example:

<profile>
  <widget_instances>
    <widget_instance id="1">
      <widget>
        <name>My Widget</name>
        <description>This is my widget</description>
        <version>1.0</version>
        <mode time="30" mode="timeout"/>
        <access sendable="false" deleteable="false" access="private" virtualable="false"/>
        <user username="myusername"/>
        <thumbnail href="file:////mnt/usb/mythumbnail.jpg" contenttype="image/jpeg"/>
        <movie href="file:////mnt/usb/mywidget.swf" contenttype="application/x-shockwave-flash"/>
      </widget>
      <access access="private"/>
      <mode time="30" mode="timeout"/>
    </widget_instance>
  </widget_instances>
</profile>

Replace the fields for name, description, thumbnail href, and movie href as appropriate. Note that the href fields can be full URLs to external servers that have appropriate crossdomain security, and that the widgets will have the security sandbox corresponding to those sites, not *.chumby.com. You can have multiple widget_instance nodes, however, you should have different values for id for each one.

Using a browser to see what's on your chumby

Create the file /psp/cgi-bin/image with the contents:

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type: image/jpeg"
echo "Refresh: 5; #"
echo ""
/usr/bin/imgtool --quality=100 --mode=cap --fb=0 -

As with other such scripts, it must have UNIX-style line endings.

Now set the script to be executable with the command:

chmod a+x /psp/cgi-bin/image

Now open http://ip.of.your.chumby/cgi-bin/custom/image from your computer's browser. You should see your chumby screen there - it shows the widget, but not the Control Panel if it's open. And it refreshes every 5 seconds (on most browsers)!

Alteratively, if you want to see what's in the secondary framebuffer (usually control panel stuff), use:

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type: image/jpeg"
echo "Refresh: 5; #"
echo ""
/usr/bin/imgtool --quality=100 --mode=cap --fb=1 -

Configure your chumby to connect wirelessly through a MAC laptop

OSX Settings

  • Connect your laptop to the internet via wired Ethernet
  • Open System Preferences
  • Click Sharing
  • Click the Internet tab
  • In the Share your connection from: drop-down list, choose Built-in Ethernet
  • Under To computers using:, choose Airport
  • Click Airport Options
  • Enter a Network Name (e.g. chumby)
  • Optionally enable WEP encryption by selecting the Enable encryption (using WEP) checkbox and entering a 40bit (5 char) or 128bit (13 char) WEP password.

Note: If you enter a WEP password, chumby will need the HEX equivalent of the key. ( e.g. If you enter AAAAA for the password, the WEP HEX key will be 4141414141 )

  • Click Start

chumby settings

  • Open the Control Panel
  • Click Settings
  • Click Network
  • Select create a new connection and click OK
  • Select the wireless connection that you had previously created (e.g. chumby) and click OK
  • If you had previously chosen to enable WEP encryption, enter your WEP key (e.g. 4141414141) and click OK, otherwise go to the next step
  • Select Manual and click OK
  • Enter 10.0.2.10 for the IP and click OK
  • Enter 255.255.255.0 for the netmask and click OK
  • Enter 10.0.2.1 for the network gateway and click OK
  • Enter 10.0.2.1 for the primary DNS and click OK
  • Enter 10.0.2.1 for the secondary DNS and click OK
  • Click OK on the Confirm settings screen