Posts

SoundPi - Initial Setup

These are my notes from setting up a headless Raspberry Pi to act as a Squeezebox Client and a Bluetooth audio endpoint. Image I got the image to install from  http://downloads.raspberrypi.org/raspbian_latest . SD Card Setup (on OS X) Instead of downloading a special tool, I just used what was built in to OS X. It worked fine. diskutil list diskutil unmountDisk /dev/disk3 sudo dd bs=1m if=2014-01-07-wheezy-raspbian.img  of=/dev/rdisk3 diskutil unmountDisk /dev/disk3 Base Raspberry Pi Setup Airport Extreme (my main wifi access point) doesn't have a good way of finding the DHCP clients. Instead I just starting sshing to addresses at the start of the reservation range until I found my pi at 192.168.0.7.  (A better way, arguably, would be to do an nmap scan, or use a wifi router that lets you see the client addresses). Once logged in I ran: sudo raspi-config To configure basics like hostname, change the pi password and update the tool, etc... ifconfi...

Python-gnupg on a Raspberry Pi

Installing Python-gnupg ( http://pythonhosted.org/python-gnupg/ ) on a Raspberry Pi shouldn't be much different than installing it on any other *nix system.  I'm documenting it here just for my own personal notes. Install gnupg This goes pretty much like you'd expect: sudo apt-get install gnupg Install Python-gnupg First we need pip (and setup_tools, ...): sudo apt-get install python-dev wget https://bitbucket.org/pypa/setuptools/raw/0.8/ez_setup.py -O - | sudo python curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py sudo python get-pip.py Now we can get gnupg: sudo pip install python-gnupg Basics The following script creates a key using gnupg and installs that key in ~/.gnupg: import gnupg gpg = gnupg.GPG() # generate a key # first we need the input data # really we shouldn't use key lengths shorter than 2048 input_data = gpg.gen_key_input(key_type="RSA",                  ...

ABA: Arduino + Bluetooth + Android

Image
The Bluetooth module for my Arduino (the JY-MCU) arrived a few weeks ago.  It was really inexpensive ($8.20), but took a long time to ship (3 weeks or so).  I picked it up from Deal Extreme ( http://dx.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299 ). Connecting I followed some of the instructions from http://www.hobbycomponents.com/index.php?route=product/product&product_id=116  that showed I had to connect VCC to the 5V pin, Ground to Ground (duh), the Bluetooth module's TXD to Arduino pin D10, and the Bluetooth module's RXD to Arduino pin D11.  In the end it looked like this: Be sure you hook it up correctly! One of the disadvantages of this Bluetooth module is that it apparently doesn't have any power protection.  So you could easily short it out and release the magic smoke. Once it was powered on I was able to scan for it using my Android phone and pair with the Bluetooth module (It shows up as 'linvor' and the pairing code...

Arduni-nano

Image
I just purchased an Arduino Nano ( http://arduino.cc/en/Main/ArduinoBoardNano ).  The photo in that link shows the 2.2 version, but I received the 3.0 version (pictured below).  I have a number of ideas for what I'd like to do with it, but the first order of business is getting anything to run. Arduino Nano 3.0 My platform is Windows, so I'm basically following the instructions here. Some things to note: The instructions say that the power LED is green, except that on my Arduino Nano the power LED is actually blue. The driver installation on Windows 8 'just worked', I didn't need to install any drivers, Windows found them automatically and installed the Arduino as a USB Serial Port on COM3. The instructions for the example say that the LED labeled 'L' will blink orange, on my Nano, that LED is white and so it just blinks white. That was basically it.  After following those instructions (which were pretty simple) I was able to get code runnin...

The Hows and Whys of Rooting the Droid Razr

There's no standard way of getting root access to an Android device.  I currently want to root a Droid Razr running 4.0.4 and I found some instructions for how to do so here .  The rooting process is nice in that it doesn't require running any special code that some Internet rando developed, but the instructions don't actually say what is going on. Since I can be a little paranoid, I'm not about to run whatever commands someone on the internet tells me to.  First, I want to figure out what those commands are doing. (Note that while the instructions work for the most part, they originally said to put the su binary in /system/xbin, I found that it actually needed to be placed in /system/bin and I've changed these instructions accordingly). So let's get in to it, going step by step through the commands outlined in the instructions. Hook your phone up to your computer in debugging mode and connect to it with adb. adb shell # cd /sdcard # cp su /data/local/...

Extending Existing Android Applications - Part Two

Image
In the last post I explained how to pull an Android APK apart and get it set up in Eclipse and ready for development.  In this post I'll explain how we can modify the app, making both simple modifications as well as actually changing the code to add a new activity. Prerequisites: JDGui - a Java decompilier 7zip (optional) Modify Images: This is a very simple tweak, but a good starting place.  When apktool took the APK apart it extracted all the images as well and stuck them in Eclipse.  They're found under res/drawable-*.  You can modify or replace them as you see fit, just change the file. Modify Strings: Somewhat more interesting is modifying the strings that are displayed or used.  This could be useful if, for example, you wanted to direct an application to a different URL than one it was originally programmed to contact.  Almost all of the strings in the code should be located in res/values/strings.xml.  Double click the st...

Extending Existing Android Applications - Part One

Image
There are a couple tutorials out there that show you how to reverse engineer Android applications.  Usually these leave you with smali files which you can modify and recompile or they leave you with a .jar file that you can browse with a Java decompiler.  Both of these methods leave something to be desired, namely; a good environment for writing new code. Smali files are a reliable representation of the code, but they're hard to use and they don't integrate with Eclipse and the typical development environment an Android developer is used to.  Generating a jar file is more desirable.  Of course, we need more than just the jar to compile the app; we also need its resources and the android manifest. Most tutorials focus on either apktool to get the smali files and the resources or dex2jar to get a jar file which can then be decompiled.  Here I'm going to demonstrate how to use both apktool and dex2jar together with Eclipse to reverse and then extend an And...