Java JCE for Debian Beaglebone

I needed to add SSL support for the new Fabric web service running on the Beaglebone Black.  I’m worried about the typical authorization / authentication issues and have not found a ton of support online for how to manage this in Spray.  The main bit of work that I had to do to add this was to include the JCE jars for the JRE installation.  Not terribly difficult and just like the earlier post for installing the JDK to begin with.

$ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip
$ unzip jce_policy-8.zip 
$ cd UnlimitedJCEPolicyJDK8/
$ sudo mv * /opt/jdk/jdk1.8.0_33/jre/lib/security/

Restarting the service picked up the new jars no problem.

Beaglebone Debian SPI setup

It’s been surprisingly difficult to find consensus on how to set up the Debian SPI interface on the Beaglebone Black.  Fortunately, Maniacal Labs has posted a nice easy approach that can be easily modified for Debian.

Load uEnv.txt either by plugging the BBB into your computer via USB or via:

sudo nano /boot/uEnv.txt

Paste the following line at the end of the file:

optargs=quiet drm.debug=7 capemgr.enable_partno=BB-SPIDEV0

Save the file and reboot your beaglebone black:

sudo reboot

Make sure it is enabled:

ls -al /dev/spidev*

You should see the following:

crw-rw---T 1 root spi 153, 1 May 15 02:22 /dev/spidev1.0
crw-rw---T 1 root spi 153, 0 May 15 02:22 /dev/spidev1.1

Most of this was copied from the instructions on https://github.com/ManiacalLabs/BiblioPixel/wiki/SPI-Setup.

iOS Support Matrix

I’ve been looking for a concise representation of versioning and architecture support in the iOS world.  lumenEssence depends on an available serial port and that went by the wayside with the Lightning connector.  But now I want to support BLE which is more readily available with the ARM64 iPhones which are incompatible with the iOS 6.0 version I need for the iPhone 4.  Which iOS version works where?  How do I need to build the openframeworks libraries?  Frustrating.

Luckily there is this great support matrix available that’s helped me understand all of the dependencies and is helping me with scripting different builds for different platforms.

Bluetooth Dropin

Getting the XBee API communication to work through Bluetooth was pretty straightforward.  Main issue was that the Bluetooth is straight through communication which means that the receiver sees the TX Request message instead of the expected RX Response from the network.  In the code where we check for RX_RESPONSE I added a check for TX_REQUEST.  Paylods are unchanged and easily extracted from the object.  Added that check on both sides and success!

void processRXResponse() {
   uint8_t* data;
   uint8_t dataLength;
   int apiId = xbee.getResponse().getApiId();
   if (apiId == ZB_TX_REQUEST) {
      // Probably a transparent interface, e.g. Bluetooth
      int TxRequestFrameHeaderLength = 13;
      data = xbee.getResponse().getFrameData() + TxRequestFrameHeaderLength;
      dataLength = xbee.getResponse().getFrameDataLength() - TxRequestFrameHeaderLength;
   } else {
      xbee.getResponse().getZBRxResponse(rxResponse);
      // TODO: Check data length for potential errors
      data = rxResponse.getData();
      dataLength = rxResponse.getDataLength();
   }
}

This was working on the laptop no problem.  However when I went to use the iPhone…  So it looks like the HC-05 Bluetooth chip is not compatible with the iDevices.  Boooo.  Need to upgrade (e.g $$$).

Bluetooth

So with the tree, I started thinking it might be good to have a deployment that doesn’t depend on XBee.  It’s a pain to have the XBee radio attached to the phone and it would be nice to hand over control to someone else’s phone.  I’ve known about the Bluetooth to XBee converters and actually ordered a couple last year but didn’t have a reason to check it out until now.  Unfortunately I have an old undocumented version I got from EBay.  A little testing and serial magic and I have it configured and communicating with the laptop.  Next is some testing with the XBee APIs to see if this is indeed drop in replaceable.  Also, need to see if we can use the iPhone app on non-jailbroken phones using the BLE4 standard.  But that will require a better part.

IMG_3010

Beaglebone Java Installation

I’m starting to work on a new project that brings together some of the work that I’ve done on previous installations.  One of the products that I’ve wanted to use is the Beaglebone Black.  I used the Raspberry Pi for lumenEssence but I found the SD card management a bit heavy.  Beaglebone seems to have some better traction in production deployments so I’m going to give it a try.  The first thing I need to do is get Java installed.

Let’s download it from Oracle:

$  wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u33-b05/jdk-8u33-linux-arm-vfp-hflt.tar.gz

Then we need to create the destination folder and unpack the distribution:

$ sudo mkdir /opt/jdk
$ sudo tar -zxf jdk-8u33-linux-arm-vfp-hflt.tar.gz -C /opt/jdk

Now let’s use linux alternatives to set the java targets:

$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_33/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_33/bin/javac 100

Check that you have your installation:

$ java -version

You should see something like this:

$ java -version
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)

Now let’s test it out. Create a new class using Nano.

public class Test {
 public static void main(String[] args) {
 System.out.println("We made it!");
 }
}

Compile and run:

$ javac Test.java 
$ java Test
We made it!
$

No funding…but be hopeful!

So I didn’t get funding from Burning Man.  It’s a huge bummer but I’m not letting it deter me.  We’re currently in the process of getting a Kickstarter funding project together so keep an eye out for it.  I’ll include a link to it here.

Let me know if you’re interested in helping out!