Saturday, May 9, 2009

Converting the Toshiba 320CDS to a digital picture frame


Inspired by the many digital picture frame tutorials online I decided to make one myself.
First I jotted down some goals:
  1. Use a minimal amount of hardware and achive total silence.
    Solution: Strip away, speakers, battery, CD- and floppy drive. Instead of the hard drive use a Compact Flash card with a CF-IDE bridge.
  2. Use a minimal amount of wires.
    Solution: Use wireless networking.
  3. Design with a thin and flat formfactor.
    Solution: Mount everything between two sheets of transparent polycarbonate or acrylic glass (plexi glass).
  4. Run without keyboard or mouse.
    Solution: Remote control via ssh and/or vnc.
  5. Easy power up/down via the power button.
    Solution: Autologin in console and run X and other stuff from .bash_profile
    Problem: Since the Toshiba 320CDS uses an APM BIOS it cannot read events on the power button. In other words it cannot power down nicely using the power button. Any ACPI BIOS would be able to.
  6. Display a slide show of images.
    Solution: Use Feh, a very capable lightweight image viewer.
  7. Lenghten the life of the CF card by minimising disk writes/reads after boot.
    Solution: Do not use swap on the CF card, store images online, configure the system to report less.
  8. Display a Pong Clock.
    Solution: Use the pong xscreensaver.
    Problem: Won't run smoothly @233 MHz

Install a minimal debian installation
  1. Follow this excellent tutorial: wiki.dennyhalim.com/debian-minimal-desktop-installation

Additional Debian packages to use
  • Remote control with: ssh and x11vnc
  • Disable screen blanking in x: x11-xserver-utils
  • Wireless support: wpasupplicant wireless-tools
  • Image viewer: feh
  • Remove the mouse cursor: unclutter
  • Mount any ftp/sftp/... as local directory: curlftpfs

Set up wireless networking with 3Com Office Connect 11g PCMCIA

  1. Download the correct firmware from: prism54.org
  2. Install the packages wireless-tools and wpasupplicant
  3. Follow this excellent tutorial: http://ubuntuforums.org/showthread.php?t=318539
  4. To use multiple networks, use the following configuration to activate roaming mode:
    • Edit /etc/network/interfaces:
      allow-hotplug wlan0
      auto wlan0
      iface wlan0 inet manual # this has to be set to manual, dhcp configuration is done later
      wpa-driver wext
      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
      #id_str="[NAME_OF_NETWORK]" is the identifier that corresponds to the network configuration in wpa_supplicant.conf
      iface
      [NAME_OF_NETWORK] inet dhcp

    • Create a /etc/wpa_supplicant/wpa_supplicant.conf containing:
      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      network={
      ssid="[YOUR_SSID]"
      scan_ssid=1
      psk=[YOUR_PRESHARED_KEY_IN_HEX]
      key_mgmt=WPA-PSK
      pairwise=TKIP
      group=TKIP
      id_str="[NAME_OF_NETWORK]"
      }

Autologin in debian without starting x first

Follow one of the two examples here: www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html


Starting X after autologin:
  1. Add startx to .bash_profile

Set up and use curlftps after autoloing:

  1. Add your USER to the group fuse:
    sudo adduser USER fuse
    For this to activate you have to log in again, the easiest way to do this is:
    su USER
  2. Mount your remote directory by adding this line to .bash_profile:
    curlftpfs -r -o user=FTPUSERNAME:FTPPASSWORD FTPURL DIRTOMOUNTIN
  3. If you ever have to unmount the directory you can do this with umount as root or with fusermount -u as a user.

Start remove mouse cursor and start slideshow after starting x:

  1. Add these lines to ~/.config/openbox/autostart.sh:
    unclutter &
    feh --full-screen --randomize --auto-zoom --slideshow-delay 10 /home/makkan/images/ &

Disable screen blanking:

  1. First of all make sure the bios doesn't blank the screen.
  2. Add these two lines to .bash_profile:
    setterm -blank 0
    setterm -powersave off
  3. Edit /etc/console-tools/config
    Change this line: BLANK_TIME=30
    To: BLANK_TIME=0
  4. In your ~/.config/openbox/autostart.sh add these lines:
    xset -dpms &
    xset s off &
    xset s noblank &


Reduce disk writes

  1. If you have to use swap to get things working set it to minimal use by editing: /etc/sysctl.conf
    Add the line: vm.swappiness=0
  2. In /etc/sysctl.conf also activate laptop mode by adding the line:
    vm.laptop_mode=5
  3. Activate your new configuration by typing: sudo sysctl -p
  4. Rsyslog writes a MARK every 20:th minute, disable this by editing /etc/default/rsyslog and set:
    RSYSLOGD_OPTIONS="-m 0"
    Restart rsyslog with:
    sudo /etc/init.d/rsyslog restart
  5. Cron writes a report every hour/day/week and so forth. Disable this by editing:
    /etc/crontab