cwdaemon - Man Page
morse daemon for the serial or parallel port
Synopsis
cwdaemon [options]
Description
Cwdaemon is a small daemon which uses the pc parallel or serial port and a simple transistor switch to output morse code to a transmitter from a text message sent to it via udp port 6789.
Options
cwdaemon can be configured either through command line arguments on start of the daemon, or through requests (escaped requests) sent over network. Each escaped request starts with ASCII Escape character (decimal 27, hex 1B). The Escape character is represented in the list below by "<ESC>" string. Notice that there are no space characters between parts of escaped requests.
Some of the arguments and requests require passing a value (e.g. Morse speed [wpm], tone (frequency) [Hz] etc.). Call "cwdaemon -h" to see default values for these arguments/requests, and ranges of accepted values.
When handling command line arguments, cwdaemon does not accept invalid, malformed, or out-of-range values passed through command line. It won't attempt to guess caller's intentions, it won't try to start with some fallback value of the argument. Instead it will just print a debug message and exit. Rejection of bad values and exiting will happen before attempting to fork.
When handling escaped requests, cwdaemon usually does not accept invalid, malformed or out-of-range vales either. But instead of exiting upon receiving request with such value, it simply prints debug message, ignores the request containing such value, and waits for next request. One exception to the rule is PTT delay: requested delay values that are too large will be clipped to maximal allowed value and then will be used by cwdaemon. Requested negative or malformed values of PTT delay will be ignored.
- Print help text to stdout and exit
Command line argument: -h, --help
Escaped request: N/A
- Print version information to stdout and exit
Command line argument: -V, --version
Escaped request: N/A
- Set hardware keying device
Command line argument: -d, --cwdevice <device>
Example command line: cwdaemon --cwdevice ttyS0
Example command line: cwdaemon -d /dev/ttyUSB0Escaped request: <ESC>8<device>
See chapter "Devices" below for more information.
- Don't fork daemon, run in foreground
Command line argument: -n, --nofork
Escaped request: N/A
Debug information will be printed to stdout (unless different debug output is selected, or debug output is silenced by setting debug output verbosity).
- Provide device-specific options to keying device's driver
Command line argument: -o, --options <option>
Example command line: cwdaemon -d /dev/ttyUSB0 -o key=RTS -o ptt=none
Example command line: cwdaemon -d /dev/ttyUSB0 -o key=RTS --option ptt=noneEscaped request: N/A
This passes <option> to the driver for the keying device selected by the -d / --cwdevice option. Multiple <option> values can be passed in multiple -o invocations. These options must always follow the -d / --cwdevice option on the command line.
The driver for serial devices understands the following options (without spaces):
key=DTR|RTS|none
Use DTR or RTS line for CW keying, or none to disable CW keying. Default is DTR.
ptt=RTS|DTR|none
Use RTS or DTS line for SSB PTT, or none disable PTT. Default is RTS.
- Set network UDP port
Command line argument: -p, --port <port number>
Escaped request: <ESC>9<port number>
This escaped request is obsolete and has no effect. Command line argument works as expected.
- Set process priority (niceness)
Command line argument: -P, --priority <priority>
Escaped request: N/A
- Set Morse speed [wpm]
Command line argument: -s, --wpm <speed>
Escaped request: <ESC>2<speed>
- Set PTT delay [ms] (TOD, Turn On Delay)
Command line argument: -t, --pttdelay <delay>
Escaped request: <ESC>d<delay>
- Turn PTT keying on/off
Command line argument: N/A
Escaped request: <ESC>a<{0|1}>
0 - PTT off, 1 - PTT on
- Set sound system (sound backend)
Command line argument: -x, --system <system>
Escaped request: <ESC>f<system>
See chapter "Sound System" below for more information.
- Set sound volume for soundcard [%]
Command line argument: -v, --volume <volume>
Escaped request: <ESC>g<volume>
- Set Morse weighting
Command line argument: -w, --weighting <weighting>
Escaped request: <ESC>7<weighting>
- Set tone (frequency) of sound [Hz]
Command line argument: -T, --tone <tone>
Escaped request: <ESC>3<tone>
Notice that sending escaped request with value '0' silences cwdaemon.
- Increase verbosity of debug output
Command line argument: -i
Escaped request: N/A
The argument can be repeated up to four times (-iiii) to gradually increase the verbosity. Alternatively you can use -y/--verbosity option.
- Set verbosity threshold for debug strings
Command line argument: -y, --verbosity <threshold>
Escaped request: N/A
Alternatively you can use -i option.
See chapter "Debugging" below for more information.
- Set numeric value of libcw debug flags
Command line argument: -I, --libcwflags <flags>
Escaped request: N/A
- Set debug output
Command line argument: -f, --debugfile <output>
Escaped request: N/A
Print debug information to <output> instead of stdout. Value of <output> can be explicitly stated as "stdout" (when not forking). Value of <output> can be also "stderr" (when not forking). Special value of <output> being "syslog" is reserved for future use. For now it will be rejected as invalid. Passing path to disc file as value of <output> works in both situations: when forking and when not forking.
- Reset some of cwdaemon parameters
Command line argument: N/A
Escaped request: <ESC>0
The request resets program's parameters to cwdaemon default values, unless the defaults were overridden with command line arguments - then the values passed in command line are used.
- Abort currently sent message
Command line argument: N/A
Escaped request: <ESC>4
- Exit (close) daemon
Command line argument: N/A
Escaped request: <ESC>5
- Set word mode
Command line argument: N/A
Escaped request: <ESC>6
- Set SSB way
Command line argument: N/A
Escaped request: <ESC>b<{0|1}
0 - microphone, 1 - soundcard
- Tune for a number of seconds
Command line argument: N/A
Escaped request: <ESC>c<seconds>
Tune for <seconds> seconds. The tuning is performed by both selected sound system, and by current hardware keying device.
- Set band switch output
Command line argument: N/A
Escaped request: <ESC>e<value>
This argument sets band switch output on parport bits 9 (MSB), 8, 7, 2 (LSB).
Devices
Any serial device that supports getting and setting the modem control lines can be used. On Linux, ttyS0, ttyS1, etc. will work. On FreeBSD these devices are known as ttyd0, ttyd1, etc. On OpenBSD, these same devices are known as tty00, tty01, etc., but may vary with platform.
For parallel ports on Linux try parport0 (default) or parport1, and on FreeBSD, ppi0 (default), ppi1, etc. OpenBSD does not support parallel port operation, and defaults to 'tty00'.
You can also specify a full path to the device in /dev/ dir, e.g. '/dev/ttyUSB0'.
For completeness, a dummy 'null' device is provided. This device does exactly nothing (no rig keying, no ssb keying, etc.).
Sound System
´sound system´ should be one of following:
´c´ - console buzzer (PC speaker) - default system,
´o´ - OSS,
´a´ - ALSA,
´p´ - PulseAudio,
´n´ - none - no audio,
´s´ - soundcard - autoselect from OSS/ALSA/PulseAudio.
Debugging
cwdaemon can print debug strings. Each debug string in cwdaemon has specified verbosity (verbosity level), and can be printed (or not) depending on current verbosity threshold specified for cwdaemon. The verbosity level value for each string can be changed in future versions of cwdaemon. Don't depend on current setup.
The verbosity threshold can be specified through command line arguments: -i, -y, or --verbosity. -y and --verbosity accept "threshold" value (single character) as specified below:
´n´ - none
´e´ - errors
´w´ - warnings (default)
´i´ - information
´d´ - details
By default the threshold is set to "warnings" - cwdaemon will print all errors and warnings. Changing the threshold to "information" will make the cwdaemon print errors, warnings, and information.
Debug strings can be printed to stdout, stderr, or disc file. Printing to stdout or stderr is available only if cwdaemon has not forked. Printing to disc file is available regardless of whether cwdaemon has forked or not. You can specify intended debug output using -f or --debugfile command line argument. Values "stdout" and "stderr" passed to cwdaemon with these arguments are recognized as special file names. "syslog" value is also treated as special value, but is not supported at the moment. Every other value will be treated as path to disc file. "stdout" is a default debug output for non-forked cwdaemon. You don't have to specify this explicitly through command line arguments, but you can.
Regardless of values passed through -f or --debugfile arguments, cwdaemon opens a syslog file and (when forked) prints some (few) messages to the syslog. There is no way to override this at the moment. Which messages are always printed to syslog, and which can be printed to other file, is settled for now, but may be changed in the future. Don't depend too much on current setup.
Bugs
When an escaped request "f" (change sound system) is sent asking for switching to sound system that is generally supported by libcw, but not available on given machine, cwdaemon will not recognize that the sound system is not available. It will close current audio system, and will attempt to open unavailable audio system. That fails, and cwdaemon falls back to Null audio system. If the falling back fails, it will result in cwdaemon working without any sound system, and it may potentially crash the daemon on next attempt to play audio.
See Also
The provided README in /usr/share/cwdaemon for a description of the circuitry, usage and testing of cwdaemon.
Author
Cwdaemon was written by Joop Stakenborg <pg4i at amsat.org>, Rein Couperus <pa0r at amsat.org>, Wolf-Ruediger Juergens, DL2WRJ <WJuergens at t-online.de> and Ladislav Vaiz, OK1ZIA <ok1zia at nagano.cz>. Cwlib is taken and adapted from the unixcw package, version 2.2 by Simon Baldwin, G0FRD. FreeBSD support mostly done by Diane Bruce, VA3DB. OpenBSD support by Jason L. Wright, AI4JW.
Since 2012 the main developer is Kamil Ignacak <acerion@wp.pl>.