Icom CI-V USB/TTL Rig Cable Design Using the FTDI Chipset

July 25th, 2011 § 11 comments § permalink

I spent some time this weekend with the fine folks over at NYC Resistor hacking on some ham radio related stuff. We took a crack at a USB CI-V interface for an Icom radio. Googling around, we found lots of level converters for RS-232 serial ports, but very little with USB in mind. In addition, most of the circuit designs for homebrew cable assemblies were quite complicated, and generally speaking, published in about 1992.

It turns out that the Icom CI-V interface is TTL-based, with the TX/RX cables bridged together, with a ground reference on the sleeve of the 3.5mm connector. Given the popularity of Arduino and similar chipsets that require a TTL serial interface to program and operate, we figured we could do better with a prefabricated USB-TTL cable like the TTL-232R-5V from FTDI. It turns out the resulting build is stupid-easy.

Here’s a diagram of the resulting assembly, for those who are searching for how to do this:

We turned out to require a stereo Ring-Tip-Sleeve connector rather than a mono two-conductor one, despite much documentation claiming the contrary. Your mileage may vary.

If necessary, one could also use the RTS/CTS contact-closure as a push-to-talk switch setup, which most of the popular ham radio software packages support. The total cost of this assembly is roughly $20, which is how much the cable costs. To cut costs even further (down to about $5), you could hack this together using the bare FT232RQ chip which you can get from Mouser for $4.95 as of this writing. In any case, this is a pretty massive improvement over the $60 that Icom likes to charge for the equivalent.

The drivers are available for all major platforms and are bundled in the Linux kernel already so the additional software needs are minimal for this over a ‘traditional’ RS-232 cable. We tested this on Mac, Linux, and Windows with perfect results.

Puppet, Mercurial and Syntax-Checking

July 15th, 2011 § 0 comments § permalink

I am a frequent user of Puppet for system administration, and have given a couple of presentations on how to use Puppet in a security-focused shop. One of the things I’ve found is that revision-control of the puppet configuration via an SCM is a huge win and helps enormously in troubleshooting issues and rolling back errors. Since a large part of Puppet’s configuration is essentially an interpreted language with a real syntax, it makes sense to enforce valid syntax, either at commit-time or push-time, particularly since Puppet’s syntax is quite irritating and prone to error. Searching around, I couldn’t find anyone who had done this with Mercurial, since apparently Git or SVN are the weapons of choice in the Puppet community. Since I work at a Mercurial shop, I adapted this script. Here’s how to make it work:

  1. Put this shell script somewhere world-executable:
    #!/bin/bash
    
    echo "Starting puppet syntax check"
    
    # Create a tempfile
    tempfile=`mktemp -t puppet_syntax`
    
    # Get a list of all modified files
    hg log -r tip --template "{files}\n" | sort | uniq > $tempfile
    
    # Walk through our list
    for line in $(< $tempfile); do
            # Check that it's actually a puppet file
            if [ `echo $line | grep -E "\.pp$"` ]
    		then
    		echo "Found puppet file $line"
    		hg cat -r tip $line | puppet --parseonly
                    if [ $? -ne 0 ]
    			then
                            rm -f $tempfile
                            echo "Puppet parse error found"
                            exit -1
                    fi
    		echo "Puppet file valid: $line"
            fi
    done
    rm -f $tempfile
    exit 0

     

  2. If you use a central repository that you keep your code in, you’ll probably want to use Mercurial’s ‘pretxnchangegroup’ hook. Put this section in the hgrc file for the repo in question; you may need to add the file in /path/to/repo/.hg if it doesn’t exist:
    [hooks]
    pretxnchangegroup = /usr/local/bin/puppet-syntax-check.sh
  3. That should be about it. Next time you push a changeset to your central repository, the script will be invoked. Note that only files that end in .pp will be syntax-checked. Your repository probably contains multiple sorts of configuration files which obviously won’t conform to the Puppet syntax. If the check fails, the central repository will roll back the transaction, and you’ll have to push a changeset which results in the ‘tip’ revision containing valid syntax.