Projects > sircond
SiriusConnect Daemon
Back in 2005,
I purchased a lifetime subscription to Sirius Satellite Radio. I
also purchased a TimeTrax TTS-100 receiver package. Unlike today,
where all new cars come standard with SiriusXM receivers, back
then if you wanted to have Sirius in your car you had to purchase
an aftermarket unit and install it in your car. SiriusConnect is a
standard interface which Sirius developed to allow the
manufacturers of third-party car stereos like Kenwod and Pioneer
to control the functionality of a Sirius receiver add-on module.
While intended for use in automobiles, a company called TimeTrax
Technologies created a compatible interface designed for use with
a computer at home. The TimeTrax TTS-100 consisted of a
standard SiriusConnect car stereo receiver module and an interface
box with a USB port and an audio output jack. The TimeTrax
software allowed you to control the receiver from your Windows PC.
If you've
never heard of TimeTrax that's not surprising. It started out as a
software application for the XMPCR, one of the first
PC-controllable satellite receivers, that would capture the audio
coming from the radio and split it nicely into individual .MP3
files. This app was very controversial at the time because it
allowed people to effortlessly build up massive .MP3 collections
at virtually no cost. The author of TimeTrax sold out to a company
which was called TimeTrax Technologies. TimeTrax soon produced a
similar receiver package for Sirius. Also included in the bundle
was a Windows software package called Recast. Perhaps the most
interesting feature of Recast was its authorization mechanism:
every time you started it up, it would "phone home" to the
TimeTrax servers and verify that you were licensed to run the
software. Somewhere along the line a software engineer named
Jeremy Profitt, who reportedly helped TimeTrax Technologies to
reverse-engineer the SiriusConnect protocol, offered a similar
product called "Give Me Satellite Radio!" TimeTrax quickly put the
kibosh on it, claiming ownership of all of Jeremy's satellite
radio work; Jeremy subsequently disappeared from the satellite
radio scene. Then TimeTrax itself disappeared about a year after
that, for reasons that were never publicly disclosed. For a time
the timetraxtech.com domain pointed to the XM web site, leading to
speculation that XM and/or the RIAA had forced TimeTrax
Technologies to shut down. Oh the irony.
When TimeTrax
Technologies disappeared in 2006, their authorization servers
disappeared with them and left their customers high and dry. The
TimeTrax hardware was still working fine; it would have been a
shame to throw it away. Clearly a new software package was needed,
one that didn't depend on Draconian licensing in order to
function. Enter sircond.
The idea
behind sircond was to allow a single Sirius satellite radio
receiver to stream audio throughout the house using standard
streaming audio clients such as Winamp.While most of the software
needed to do this already existed (e.g. Icecast, Darkice) a
component that would allow the user to control the radio (turn
power on/off, change channels, adjust the volume) as well as
retrieve metadata updates (current channel name, current song
title, the name of the artist) was missing. Sircond was created to
fill this gap.
Step one was
to figure out how to communicate with the radio. Since the basic
Sirius tuner module is integrated by multiple manufacturers into
their products I knew a protocol spec must exist, but my search
was in vain. No doubt the spec was a closely-guarded corporate
secret, only released to partner companies under an iron-clad NDA.
Fortunately there were other pioneers in this area, some of whom
had posted what they had been able to learn about the protocol.
That was enough to permit basic functionality under Linux.
Beyond that,
sircond is a pretty standard network server, accepting TCP
connections from clients and processing commands presented in
plain ASCII. The sircond protocol is intended to be human- and
script-friendly. There are only four basic commands:
Commands
The SirCon Daemon's network protocol is line-oriented ASCII and is intended to be easy to use in scripts as well as directly by a human operator.
There are 4 main commands:
- GET to retrieve a setting from the radio,
- SET to change a setting,
- CONTROL to request or release exclusive read/write control of
the radio, and
- QUIT to end the session.
The first 3 each
have sub-commands; all commands and sub-commands are
case-sensitive (uppercase only). Command lines are terminated by
ASCII newline characters. Individual fields in a command line are
delimited by ASCII space characters, whereas fields in responses
are delimited by ASCII comma characters. Response fields which may
potentially contain embedded delimiters are enclosed in ASCII
double-quote characters.
CONTROL
The CONTROL command is used to acquire read/write control of the radio. Upon initial connection, the network client has read-only access to the radio status. In order to change settings (e.g. tune to a new channel, or change the gain), the client must request read/write control by issuing the CONTROL REQUEST command. Only one client can have read/write control of the radio at any one time; if no other client currently has read/write control the control request is granted immediately and the daemon sends the response CONTROL,ACQUIRED. OTOH, if another client currently has read/write control, then the client making the request is placed into a wait queue and the daemon responds with CONTROL,PENDING. Later on, when the controlling client releases control, read/write control is automatically transferred to the next client in the wait queue and that client is notified via a CONTROL,ACQUIRED message. The controlling client keeps control until it either disconnects from the daemon or explicitly releases control byissuing a CONTROL RELEASE command.
GET
A client issues a GET command to retrieve the current setting of a radio parameter.
The general form of the GET command is GET <parameter-name>.
The following parameters are supported for the GET command:
- GAIN - A signed integer value representing the current gain
setting
- MUTE - An unsigned integer "boolean" value where 1
indicated muting is active and 0 indicates muting is inactive
(and thus audio can be heard)
- POWER - An unsigned integer in the range [0..3] indicating the
radio's current power mode setting.
- CHANNEL - An unsigned integer in the range [0..223] indicating
the channel to which the radio is currently tuned.
- CHANNELINFO - Information about the current channel, including
the full name of the channel, the full Sirius genre name, and
abbreviated versions of these.
- SONGINFO - Information about the current song or program
playing on a channel.
- SID - The Siruis ID (serial number) of the radio. This number
uniquely identifies the Sirius receiver hardware and is used to
activate a subscription for that radio.
- TZINFO - Information about the current time zone.
- TIME - An ASCII string representing the current date and time
relative to the configured local time zone.
- STATUS - A general status code.
- RSSI - Three unsigned integer received signal strength
indications, one for the terrestrial antenna, one for the
satellite antenna, and one for the overall (combined) signal
strength. NOTE: if the
signal level is too low, some Sirius radios seem to have trouble
responding to commands from the PC. It's as if the firmware
inside the radio is so busy trying to process the weak signal
that it doesn't have enough time left over to respond to
external commands. In my experience, best results are obtained
with a dedicated outdoor antenna with a clear view of the
appropriate portion of the sky.
SET
A client with
read/write control issues a SET command in order to change a radio
setting. The general form of the SET command is SET
<parameter-name> <value-list>. <value-list>
varies based on the parameter, with some parameters having
multiple values and others having no values at all. Numeric
parameters must be provided in decimal representation.
The following
parameters are supported for the SET command:
- RESET Performs a software reset of the radio.
- GAIN <n> Changes the gain (volume) setting. The
parameter is a signed decimal integer in deciBels. Values in the
range -127 to 0 represent attenuation.
- MUTE <n> Turns audio muting on (1) or off (0).
- POWER <n> Set the radio's power mode (0 - 3) where 0 is
fully off and 3 is fully on. Modes 1 and 2 represent some sort
of sleep/low power states.
- CHANNEL <n> Tune the receiver to a new channel. Sirius
channel numbers range from 0 - 223, but not all channels within
that range are valid. Channel 0 is a special pseudo-channel
which displays the radio's SID (Sirius ID). Available channels
vary based on subscription; on an unsubscribed radio the only
available channels will be 0 and 184 (the preview channel).
- TZINFO <offset> <dst> Set the local time zone
info. The first parameter is a signed decimal integer
representing the offset from UTC in minutes. The second is a
daylight savings time active (1) or inactive (0) indication.
These settings affect the time information output by the radio.
- ASYNC <n> Enables asynchronous event notifications. In
addition to responding GET requests, SiriusConnect radios can
also generate asynchronous notifications when certain events
occur. The parameter for this command is a decimal number
corresponding to the sum of 0 or more of the following values:
- 1 Time
- 2 Signal quality
- 4 SONGINFO for current channel
- 8 SONGINFO for all channels
- 16 SONGID for all channels
For example,
SET ASYNC 7 enables the time, signal quality, and SONGINFO event
types, whereas SET ASYNC 0 disables all async events.
QUIT
A client
issues a QUIT command in order to terminate the session and
disconnect
from the server. Upon receipt of this command the daemon will
release read/write
control (if the client has it) and close the client's TCP
connection.