Chumby Software Applications, Scripts and Tools

From Chumby Wiki
Revision as of 12:39, 18 January 2008 by Chumby (Talk | contribs)

Jump to: navigation, search

This page is an attempt to document the various scripts and applications which come pre-installed on a stock Chumby distribution.

Contents

/proc

Another page has details on Chumby device settings information on /proc

Scripts

All of these scripts are found in /usr/chumby/scripts/

Chumby inputs and outputs

ap_scan

ap_scan - Scans for wireless networks and outputs XML. If /tmp/hidden_ssid exists, the script will switch the SSID of the wireless interface to the SSID defined in /tmp/hidden_ssid before initiating the scan. If the interface was configured with a different SSID prior to a wireless scan that read from /tmp/hidden_ssid, the script will restore the original SSID when the scan has completed.

chumby_set_mute

Set the "mute" volume of the Chumby. Mute affects the Chumby speaker but not the headphones. Is this correct?

chumby_set_pan

Set the "balance" level of the Chumby. Is this correct?

chumby_set_volume

Set the master volume of the Chumby.

Chumby Info

get_voltage.sh

With no arguments, reports raw values from /proc/chumby/battery-voltage If battery or line is specified, gets specified value and converts to approximate voltage.

log-rollover-enable

Enable log-rollover in crontab

macgen.sh

Outputs wireless NIC hardware address

guidgen.sh

Extracts chumby putative ID from crypto processor

network_running.sh

Determines whether the network is running

Chumby Settings

chumby_version

Displays the software, firmware and hardware versions

   syntax: /usr/chumby/scripts/chumby_version [-s -f -h -n -t --rfs1 --rfs2]
   -s     - display software version
   -f     - display firmware build number
   -h     - display hardware version number
   -n      - display hardware serial number
   -t      - display hardware time since last crypto processor power cycle
   --rfs1  - display RFS1 md5sum
   --rfs2  - display RFS2 md5sum

disable_intro

Disable the intro screen.

download_cp

Downloads the latest Control Panel configured for this chumby, typically to /tmp

enable_intro

Enable the intro screen.

reboot_normal.sh

Reboots the Chumby -- gracefully

Daemons and housekeeping

flashplayer_watchdog

Script that watches for flashplayer hangs or exits?

headphone_manager

Daemon responsible for disabling internal speakers when external headphones/speaker is plugged in

log-rollover

Script to roll over /var/log/messages

Usually invoked from crontab:

50 2,6,10,14,18,22 * * * /usr/chumby/scripts/log-rollover

mkdevs

Simple script to automatically populate a /dev directory.

Mountmon scripts

See mountmon.conf for list of environment variables available on input
and required output values

mountmon_utils.sh

Utility functions used by mountmon scripts

add.sh

"Add" event script for mountmon

mount.sh

Mount event script for mountmon

remove.sh

Remove event script for mountmon

umount.sh

Unmount event script for mountmon

network_status.sh

Polls the status of the network interface and outputs XML to /tmp/chumby/network_status.xml

sync_time.sh

Synchronize clock with network time server

  • Called by sync_time_state.sh

sync_time_state.sh

Set or read the sync_time_state from /psp/use_ntp

time_zone.sh

update.sh

Autoupdate script

Linux stuff

script_locations.sh

Set default script directory locations (environment variable)

service_control

Service control wrapper script

Usage:
service_control service_name action [args]
This just gets the ETC_INIT_DIR value from script_locations.sh then invokes
${ETC_INIT_DIR}/${service_name} action [args]

service_getpid

Get process id(s) of running service

service_list

Get list of running services

Chumby Actions

start_control_panel

Responsible for starting the control panel in the correct mode

This is a pretty elaborate script. It checks for Control Panel updates on the network and USB drives. It checks and restarts the music player as needed, erases the display (manually!), and then starts the Control Panel flash applet.

It would be nice if we could replace this script with custom functionality in-place, but since it's on a read-only path, we can't. The Flash Applet can easily be replaced, however, by altering /tmp/cp_path or by supplying a replacement on a USB drive (see Chumby tricks ).

Calling this script directly is not enough to safely start the Control Panel.

start_intro

start_network

Starts the network after the network config has been written

start_network.sh

symlink to start_network

start_opening_anim

start_sshd.sh

Start the SSH Daemon

stop_control_panel

Stop the control panel widget from playing

update_now.sh

Sets the paranoid boot flag to boot into autoupdate mode and force an immediate reboot.

Chumby state wait

wait_for_link

Wait for the (network?) interface to establish link before proceeding

wait_for_opening

Wait for opening animation to start.

wait_for_usb

Wait for the usb subsystem to finish loading before proceeding

Applications

These applications are in /usr/bin.

  • Note: Busybox tools are not included in this list.

amixer

aplay

arecord

btplay

chumbhowld

This is an HTTP daemon listening on port 8082, and presents an XML response showing the services on the LAN advertising presence using zeroconf (aka Bonjour).

chumbipod

chumbipodd

Documented at Chumby as an iPod server.

chumbpipe

chumbpop

chumbradio

From the forum: "Require[s] an as-yet unreleased hardware accessory." [1]

chumbradiod

chumbyAuth

chumby_set_volume

chumbyflashplayer.x

This is the Adobe Flash Lite 3 Player customized for the chumby

usage: /usr/bin/chumbyflashplayer.x -i <filename> [
  -m <32K memory blocks (384 = 12mb)>
  -x [X] <pixels (240)>
  -y [X] <pixels (320)>
  -s [X] <stride (x*2)>
  -n [X] <sound buffers {4..32} (16)>
  -b <samples/buffer (512)>
  -p [X] <sample rate {5000|11025|22050|44100|8000|16000} (44100)>
  -e [X] <channels {1|2} (2)>
  -k [X] <bytes/channel {1|2} (2)>
  -r [X] (rotate)
  -q [X] <quality {0|1|2} (2)>
  -d name[=value]
  -o <network open debug level {0|1|2} (2)>
  -D [X] (disable screen updates)
  -A [X] (disable audio)
  -u <1K url cache blocks (4096)>
  -a <cache aggression level (5)>
  -S <cache stats write file>
  -I <cache stats write interval (60)>
  -L <message options (3)>
     message options may be a combination of
       1 write to stderr
       2 add timestamp prefix to stderr
       4 write to syslog
 -l <log mask (127)>
          bitmap of values allowed to be displayed
                1=errors, 2=warnings, 4=info, 8=trace, 16=debug,
                32=AS trace, 64=AS debug, 128=realtime debug
  -M [X] <master_widget>
  -E <cert_list_file>
  -f <frame buffer options {0|1|2} (2)>
  -H <http and malloc options (9)>
     bitmap of options for http:
       1 use curl, 2 report memory usage, 4 verbose memory reporting,
       8 throttle http connection for large transfers,
                16 use localhost as alias for filesystem root (unsafe!)
                64 use verbose mode in libcurl
          additional bits for malloc debugging:
                32 report failed malloc() attempts
  -P <preload widget (may repeat)>
  -U (do not load /usr/widgets/preload.swf)
  -T <timing stats file>
  -K <ts quadrant key mapping {0|1} (0)>
  -Y <minimum pump delay in ms (42)>
  -Z <maximum pump delay in ms (83)>
  -z (disregard existing instance)
  -X (turn on mcheck for heap debugging)
  -t <update timing collection run in seconds (0)>
  -R (backtick result display diagnostics)
  -N <asnative & ts debug flags (0)>
  -w <backtick long timeout (10)>
  -W <action when backtick long timeout reached (0=continue, 1=abort backtick, 2=exit flashplayer)>
  -F <signal to send running instance {SIGTERM=15, SIGHUP=1, SIGUSR1=10, SIGUSR2=12)>
  -g <global heap in mb (0)>
  -G <alternate cfg file or none>
  -j <cache manager options[:cache data dir] (0)>
     bitmap of options:
     1 write cache contents on -S stats file write
  -v (display version information)
  -h (print this message)
] ([X] marks development-only options)

Undocumented switch: -Q -- unknown functionality

Use chumbyflashplayer.x -F 15 to kill the running instance. (Watchdog will restart it.)

Using -z erases the previous instance pid file, so subsequent restarts do not need -z since the original instance has been "forgotten". Also, -F will no longer work for "forgotten" instances.

chumbyradio

chumbytorrent

cpi

Usage : cpi [--help] | [-p] [-a] [-d] [-r]

Interface with Crypto Processor

Options:

   --help      Display this help screen

   -k <KEYID>  Use the specified key ID (default is 0)
   -r <FILE>   Read query XML from FILE (ignored if valid -i specified)
   -w <FILE>   Write result XML to FILE (ignored if valid -o specified)
   -i          Read query XML from stdin
   -o          Write result XML to stdout
   -p          Write putative ID of specified key index to stdout
   -a 

curl

dcid

eject

exportKeys

fbwrite

printf() to frame buffer console

gdbserver

headphone_mgr

hexdump

Dump a file or pipe in hex

imgtool

Puts an image on the Chumby screen or captures the screen to an image file.

Try this to see how it works:

chumby:~# /usr/bin/imgtool --mode=draw /www/images/chumby_logo.png

Here's an example of capturing the screen to an image file

chumby:~# /usr/bin/imgtool --mode=cap /tmp/capture.jpg


Syntax: /usr/bin/imgtool [options] file
       where file is output (mode=cap) or - to write to stdout, or
       if mode==draw, a .jpg or .png image file to write to frame buffer
       and options are any of the following:

       --debug                 Increase verbosity
       --resize=n (64)         Resize options (draw mode only)
       --gamma=f (2.2)         Screen gamma (for png decode)
       --quality=pct (30)      JPEG capture quality (0-100)
       --fb=n (0)              Write to / read from frame buffer (0 or 1)
       --fmt={jpg,png} (jpg)   Format to write (if mode==cap)
       --mode={cap,draw} (draw) Capture frame buffer to file (cap)
                                       or draw image file to frame buffer
       --help                  Display this message
  • Note: PNG capture is not supported yet on the version I have.

Here's a neat trick. Put this in /psp/cgi-bin/image

#!/bin/sh

echo "Content-type: image/jpeg"
echo "Refresh: 5; #"
echo ""

/usr/bin/imgtool --mode=cap -

Now open "http://your-chumby-ip-address/cgi-bin/custom/image". You should see your Chumby screen there. And it refreshes!

memstress

mountmon

mp3.x

openssl

Open SSL tool

perl

This is perl, v5.8.8 built for linux

scp

Secure copy

ssh

Secure shell (ssh to another machine)

switchwait

udevinfo

udevstart

udevtest

usb

wget

Get a file from the web