Today's subject is the beautiful FlexControl, which is a "USB Knob" ($99.99). It is designed as an adjunct input device for the Flex software defined radios, for users who need something more traditional than mouse-based pointing and clicking for tuning and managing a radio.
The product is provided for SmartSDR for Windows, the principal interface program for the Flex 6000 series. It has a great feel, and it has 3 nice buttons and status lights. SmartSDR provides a Windows driver to work with the FlexControl.
So that's fine, but I'm mainly a Linux guy. For unfortunate but understandable reasons, Flex only provides Windows control software. What does the FlexControl look like when plugged into a Linux system? I could not find any documentation.
With help from Wireshark and VirtualBox, we can do some reverse engineering.
The FlexControl is recognized by Linux (Ubuntu 14.04, but probably most other versions, too). It appears as /dev/ttyACM0 on my machine. "ACM" signifies that this is a CDC_ACM device. That category is loosely based on ancient Hayes modem interfaces, but don't worry about that! Really, it just emulates an old-fashioned serial I/O connection at 115 Kbps.
You can set up minicom or any other Linux program to talk to this device. The only remaining question is the protocol. It turns out to be simple. No surprise, this is a simple device. The scoop:
Sending from FlexControl to host:
All commands terminate with ';' (no returns or line feeds)
U; - knob CW (single tick) -- U02; U03; U04; etc - multiticks
D; - knob CCW (single tick) -- D02; D03; D04; etc - multiticks
S; - short press, main knob
L; - long press, main knob
C; - fast double click, main knob
The fast knob codes reflect multiple encoder ticks between USB polling times, so the knob should be able to keep track of fast spinning. (Alas, SmartSDR will not always keep up so well.)
XnS; - normal press, key n=1,2,3
XnL; - long press
XnC; - fast double click
U; (frequency up one tick)
X2S; (normal press, button 2)
Sending from host to FlexControl:
Ixyz; where x,y,z = 1 or 0 for LED 0, 1, 2 on or off
I001; set right hand LED on
I000; set all LEDs off
I111; set all LEDs on
Note that SmartSDR for Windows only uses a fraction of the FlexControl's button capability.
See a simple Python program to illustrate how to communicate at http://aa6e.net/wiki/FlexControl.
The FlexControl should be very useful for all kinds of DIY software projects. Connect it to your Raspberry Pi, your Arduino, your Linux PC for any kind of control project! (There are cheaper USB based controllers available -- for games, etc., but few have the right "ham" esthetics IMO.)
Maybe FlexRadio or one of the designers (K6TD or K6TU) would have divulged the same data if they were asked nicely, but it was more fun to work it out on my bench.