Sheevaplug Notes

My notes for getting from bare plastic to reliable boot with Fedora 17 and a SheevaPlug.

Getting /dev/ttyUSB0 Working on my F-17 Laptop

Kempy suggests connecting by running
sudo chown uucp /dev/ttyUSB0; sudo cu -s 115200 -l /dev/ttyUSB0
Although this works, I prefer to add myself to the dialout group. Best way on F-17 seems to be:
usermod -a -G dialout your-username.
Now I can connect as an ordinary user like this:
cu -s 115200 -l /dev/ttyUSB0

Modem-manager kept taking over the port so I would get:
cu: /dev/ttyUSB0: Line in use
when I tried to connect to my device.

The cleanest fix I found after much Googling is to add a custom file to /usr/lib/udev/rules.d. I called mine
77-mm-usb-cust-device-blacklist.rules. Perhaps this file would be better placed in /etc/udev/rules.d.

# edit this file, it will not be overwritten on update

ACTION!="add|change", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
ENV{DEVTYPE}!="usb_device",  GOTO="mm_usb_device_blacklist_end"

# Custom for Sheevaplug: Product: SheevaPlug JTAGKey FT2232D B
ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", ENV{ID_MM_DEVICE_IGNORE}="1"

LABEL="mm_usb_device_blacklist_end"

Installation

I installed Fedora-17-arm-kirkwood-mmcblk0.img.xz accoring to the instructions on the Fedorra site. Although I followed the steps carfully a couple of times, I couldn’t get my plug to boot. I remembered reading and ignoring something about updating u-boot to the DENX version from the Marvell version provided with the plug. I followed Martin Michlmayre’s clear instructions for u-boot update. After this update, everything as detailed on the Fedora site just worked. Note that a newer (2012.04.01-2) version of u-boot would not boot the image either.

For the Sheevaplug change usb 1:1 to usb 0:1 in the bootloader commands on the these lines:

set loadInitrd 'fatload usb 0:1 0x7400000 uInitrd-kirkwood'
set loadImage 'fatload usb 0:1 0x6400000 uImage-kirkwood'

I had to set the time by hand (date MMDDhhmmYY and hwclock -w)to get networking (and ntpd) working. This issue recurred whenever the plug was cold booted and turned out to be due to a dead RTC battery.

Changing the RTC battery.

Pry out the four feet on the bottome and remove four screws underneath. I had to pry up one metal tab on the batery holder to slide the battery out. A firm push with a screwdrive was required as the battery had leaked and was stuck in place. I cleaned the holder before installing the new battery. The original battery was an LR1130. AG10 is another part number for the same battery. 389 is the same size and specs but silver not alkaline. The first two numbers cost pennies a piece but are not available locally. A 398 was almost $6 at Radio Shack and seems to work fine other than the damage to my wallet.

yum update

I ran yum update and the updated system was not bootable. The cause of the un-bootable system was a bad kernel, see bug 834977. Update: happily, 3.7.3-101.fc17.armv5tel.kirkwood does boot.

I discovered that the problem was the 3.5.6-1 kernel by mounting the by USB stick on my laptop and reverting to the old kernel. Here’s a listing of the boot partition after yum update:

total 39824
-rw-r--r--. 1 usr usr       71 Jun 18 05:53 boot.scr
-rw-r--r--. 1 usr usr       62 Dec  9 04:28 klist.txt
-rw-r--r--. 1 usr usr      436 Jun 18 05:53 README.txt
-rw-r--r--. 1 usr usr  3291896 Jun 18 05:58 uImage-3.4.2-3.fc17.armv5tel.kirkwood
-rw-r--r--. 1 usr usr  3350824 Dec  9 04:27 uImage-3.5.6-1.fc17.armv5tel.kirkwood
-rw-r--r--. 1 usr usr  3350824 Dec  9 04:27 uImage-kirkwood
-rw-r--r--. 1 usr usr 10112646 Jun 18 05:58 uInitrd-3.4.2-3.fc17.armv5tel.kirkwood
-rw-r--r--. 1 usr usr 10308294 Dec  9 04:28 uInitrd-3.5.6-1.fc17.armv5tel.kirkwood
-rw-r--r--. 1 usr usr 10308294 Dec  9 04:28 uInitrd-kirkwood

Because the partition is fat you can’t ln to change the uImage and uInitrd-kirkwood to point to the old files. So I used cp -a:

cp -a uImage-3.4.2-3.fc17.armv5tel.kirkwood uImage-kirkwood
cp -a uInitrd-3.4.2-3.fc17.armv5tel.kirkwood uInitrd-kirkwood

System boots. Another way of doing this should be to change the values of loadImage and loadInitrd to point the the specific image and initrd.

Booting from an SD Card

The USB stick was at risk of being unplugged by curious fingers so I dd‘d the system from the USB stick to a an SD card.

U-boot commands for the SD card were gleaned by looking at this Debian page and applying to the fedora instructions. These u-boot instructions set up u-boot to boot the system from the SD card. mmc init is repeated because it fails the first time on a cold boot. Booting should be tested under all conditions: reboot from the OS, after hardware reset and cold boot.

Marvell>> set loadImage fatload mmc 1:1 0x6400000 uImage-kirkwood
Marvell>> set loadInitrd fatload mmc 1:1 0x7400000 uInitrd-kirkwood
Marvell>> set bootcmd 'mmc init 1; mmc init 1; ${loadImage}; ${loadInitrd} ; bootm 0x6400000 0x7400000'
Marvell>> saveenv
Marvell>> boot

How to Make a PDF Fill-in Form Saveable

These notes apply to Acrobat X Pro. I don’t know about other versions or how to do this with free software. Adobe software is out of my price range too. I used my employer’s copy.

Good instructions for creating the fill-in are here.

Adobe provides instructions for making the fill-in saveable here, but it’s not clear the in their step 3 you want to pick File->Save As->Reader Extended PDF->Enable Additional Features…, not Enable Adding Text In Documents. That’s all it takes.

Sample saveable fill-in form.

mindbody api

Some notes for getting started with the MindBody API.

Read this:

http://support.mindbodyonline.com/entries/21301433-how-to-issue-api-credentials

Follow the partner program link on that page and sign up. These pages are often down; it’s not you.

Their docs:

http://api.mindbodyonline.com/Doc

Download the MBO’s API expamples.

https://github.com/mindbody/API-Examples

These examples have some errors. Some includes reference files with the names in the wrong case – they must be working on Windows. Calls to php time functions now require a timezone.

There is no example of using the SiteService or GetActivationCode request that you need to start with the API.

Here is my getActivationCode.php

<?php
require_once("../includes/siteService.php");

if (!isset($_POST['submit'])) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
        <head>
                <title>Get Activation Code Demo</title>
                <link rel="stylesheet" type="text/css" href="../styles/site.css" />
        </head>

        <body>
        <form method="post" action="getActivationCode.php">
                Source Name:
                <input type="text" size="25" name="sName"/><br/>
                Password:
                <input type="password" size="25" name="password"/><br/>
                SiteID:
                <input type="text" size="5" name="siteID" value="-99"/><br/>
                <input type="submit" value="submit" name="submit"/>
        </form>
<?php
} else {
$sourcename = $_POST["sName"];
$password = $_POST["password"];
$siteID = $_POST["siteID"];

// initialize default credentials
$creds = new SourceCredentials($sourcename, $password, array($siteID));

$siteService = new MBSiteService(true); //false for no debug!
$siteService->SetDefaultCredentials($creds);

$result = $siteService->GetActivationCode();

/* $cdsHtml = '<table><tr><td>ID</td><td>Name</td></tr>';
$cds = toArray($result->GetClassDescriptionsResult->ClassDescriptions->ClassDescription);
foreach ($cds as $cd) {
        $cdsHtml .= sprintf('<tr><td>%d</td><td>%s</td></tr>', $cd->ID, $cd->Name);
}
$cdsHtml .= '</table>';

echo($cdsHtml);  */
}

Here is ../includes/siteService.php mbApi.php is provided in the mindbody sample code.

<?php
require_once("mbApi.php");
        
class MBSiteService extends MBAPIService
{               
        function __construct($debug = false)
        {       
                $serviceUrl = "http://" . GetApiHostname() . "/0_5/SiteService.asmx?wsdl";

                $this->debug = $debug;
                $option = array();
                if ($debug)
                {
                        $option = array('trace'=>1);
                }
                $this->client = new soapclient($serviceUrl, $option);
        }
        
        /**
         * Returns the raw result of the MINDBODY SOAP call.
         * @param int $PageSize
         * @param int $CurrentPage
         * @param string $XMLDetail
         * @param string $Fields
         * @param SourceCredentials $credentials A source credentials object to use with this call
         * @return object The raw result of the SOAP call
         */     
        public function GetActivationCode(SourceCredentials $credentials = null)
        {               
                
                $params = $this->GetMindbodyParams($additions=array(), $this->GetCredentials($credentials), $XMLDetaili=null, $PageSize=null, $CurrentPage=null, $Fields=null, $UserCredentials = null);

                $result = $this->client->GetActivationCode($params);

                if ($this->debug)
                {
                        DebugRequest($this->client);
                        DebugResponse($this->client, $result);
                }

                return $result;
        }

}