| 1 |
cwdaemon-0.10.2 |
| 2 |
=============== |
| 3 |
|
| 4 |
Cwdaemon is a small daemon which uses the pc parallel or serial port and a |
| 5 |
simple transistor switch to output morse code to a transmitter from a text |
| 6 |
message sent to it via the udp internet protocol. The program uses the |
| 7 |
soundcard or PC speaker (console buzzer) to generate a sidetone. |
| 8 |
|
| 9 |
It is called as root, with "cwdaemon -p <portnumber> -d <device>". If no |
| 10 |
portnumber is given, the default portnumber 6789 is used. Device can be one of |
| 11 |
the serial (ttyS0, ttyS1, etc) or parallel (parport0, parport1, etc) ports. |
| 12 |
Default is parport0. |
| 13 |
|
| 14 |
For FreeBSD, use ttyd0, ttyd1, etc. for the serial ports and ppi0, ppi1, etc. |
| 15 |
for the parallel ports. Default is the first parallel port. |
| 16 |
|
| 17 |
You can also use dummy device "null" instead of parallel or serial port. |
| 18 |
This device does exactly nothing (no rig keying, no ssb keying, etc.). |
| 19 |
|
| 20 |
Cwdaemon also handles PTT, and band index output for automatic switching of |
| 21 |
antennas, filters etc. Pinout is compatible with the standard (CT, TRlog). |
| 22 |
|
| 23 |
cwdaemon is available on github: https://github.com/acerion/cwdaemon |
| 24 |
cwdaemon's older webpage is http://cwdaemon.sourceforge.net/ |
| 25 |
|
| 26 |
|
| 27 |
Please note |
| 28 |
----------- |
| 29 |
BSD and/or Linux are not real-time operating systems. e.g. the timer resolution |
| 30 |
of the kernel is 10 milliseconds. You may especially notice this when using PTT |
| 31 |
and setting the PTT delay value. If you experience timing problems, you might |
| 32 |
try using the -P flag. This will set cwdaemon's priority. The default is zero, |
| 33 |
any negative value will be a higher priority, the maximum being -20. |
| 34 |
|
| 35 |
|
| 36 |
Quickstart |
| 37 |
---------- |
| 38 |
On linux run the cwsetup.sh script and next run cwdaemon with the -n flag. |
| 39 |
If this does not work, read the next paragraphs.... |
| 40 |
|
| 41 |
|
| 42 |
Setting up parallel port(s) on linux for cwdaemon |
| 43 |
------------------------------------------------- |
| 44 |
You need the parport devices to use cwdaemon. Check if you have them: |
| 45 |
|
| 46 |
ls -al /dev/parport* |
| 47 |
|
| 48 |
If you don't see any files, create the with MAKEDEV (as root user): |
| 49 |
|
| 50 |
cd /dev; ./MAKEDEV parport |
| 51 |
|
| 52 |
Next, check whether the parport and parport_pc kernel modules are loaded: when |
| 53 |
you type 'lsmod', you should (on the i386 architecture) see something like: |
| 54 |
|
| 55 |
parport_pc 23304 0 (autoclean) |
| 56 |
parport 25992 0 (autoclean) [parport_pc] |
| 57 |
|
| 58 |
The lp module should not be loaded, it is only needed if you want to use a |
| 59 |
printer and it will block the parallel port if you use cwdaemon. You can unload |
| 60 |
it with the command 'rmmod lp' as root. |
| 61 |
|
| 62 |
If you don't see any parport modules please check whether you have the line: |
| 63 |
|
| 64 |
alias parport_lowlevel parport_pc |
| 65 |
|
| 66 |
in your /etc/modules.conf file and load the modules with: |
| 67 |
|
| 68 |
modprobe parport |
| 69 |
modprobe parport_pc |
| 70 |
|
| 71 |
Be sure that parallel port support is enabled in your BIOS! If you use odd |
| 72 |
ioports or interrupts, you can do things like: |
| 73 |
|
| 74 |
modprobe parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto |
| 75 |
|
| 76 |
which configures 3 parallel ports with the second port using irq 7 and the |
| 77 |
third port some auto-detected irq. |
| 78 |
|
| 79 |
When cwdaemon is run, the ppdev kernel module should be loaded automatically. |
| 80 |
In case it doesn't, just type: |
| 81 |
|
| 82 |
modprobe ppdev |
| 83 |
|
| 84 |
PLEASE NOTE: you should probably run a 2.4 kernel to use the ppdev device with |
| 85 |
cwdaemon. |
| 86 |
|
| 87 |
Setting up serial port(s) on linux for cwdaemon |
| 88 |
----------------------------------------------- |
| 89 |
Setting up your serial ports is straightforward. Here are some commands to get |
| 90 |
you started: |
| 91 |
|
| 92 |
setserial -g /dev/ttyS* |
| 93 |
|
| 94 |
will tell you what serial lines are configured. If you see a line with |
| 95 |
"UART: unknown", this probably means there is no serial port for the device. |
| 96 |
|
| 97 |
setserial /dev/ttyS0 -v autoconfig |
| 98 |
|
| 99 |
will try to autoconfigure your first serial port. You need to run this command |
| 100 |
as root. |
| 101 |
|
| 102 |
Other valid commands are: |
| 103 |
|
| 104 |
setserial /dev/ttyS1 auto_irq skip_test autoconfig |
| 105 |
setserial /dev/ttyS3 irq 5 uart 16550A skip_test |
| 106 |
|
| 107 |
Newer distributions use a file called '/etc/serial.conf' where the information |
| 108 |
for your serial ports are stored. |
| 109 |
|
| 110 |
|
| 111 |
Setting up parallel port(s) on FreeBSD for cwdaemon |
| 112 |
--------------------------------------------------- |
| 113 |
You will need ppbus and ppi either defined in the kernel or loaded at boot time |
| 114 |
as kernel modules. ppbus and ppi are defined in the GENERIC kernel hence should |
| 115 |
work as is unless you have removed them from your kernel. If not, you can add |
| 116 |
the following in the kernel config, recompiling and reloading a kernel as |
| 117 |
outlined in the FreeBSD handbook. |
| 118 |
|
| 119 |
# Parallel port |
| 120 |
device ppbus # Parallel port bus (required) |
| 121 |
device ppi # Parallel port interface device |
| 122 |
|
| 123 |
You can also load ppbus.ko and ppi.ko at boot time instead of rebuilding your |
| 124 |
kernel. This is also outlined in the FreeBSD handbook. |
| 125 |
|
| 126 |
e.g. In /boot add |
| 127 |
|
| 128 |
ppbus_load="YES" |
| 129 |
ppi_load="YES" |
| 130 |
|
| 131 |
|
| 132 |
Setting up serial port(s) on FreeBSD for cwdaemon |
| 133 |
------------------------------------------------- |
| 134 |
The serial port driver is loaded by default in the GENERIC kernel. If not |
| 135 |
configured in the kernel, you can add to the kernel config and rebuild the |
| 136 |
kernel as outlined in the FreeBSD handbook. |
| 137 |
|
| 138 |
# Serial (COM) ports |
| 139 |
device sio # 8250, 16[45]50 based serial ports |
| 140 |
|
| 141 |
|
| 142 |
How cwdaemon works |
| 143 |
------------------ |
| 144 |
|
| 145 |
After starting, the program detaches from its controlling terminal, |
| 146 |
after that the program can be controlled via its network udp input |
| 147 |
port. |
| 148 |
|
| 149 |
You can control cwdaemon by sending requests to it. Recognized |
| 150 |
requests are listed below. Skip the quotes around codes when sending |
| 151 |
actual requests. <ESC> is ASCII escape character (decimal 27, hex 1B). |
| 152 |
Most of the requests are so called "escape requests", because they |
| 153 |
start with Escape character. |
| 154 |
|
| 155 |
<ESC>0 Reset to default values |
| 156 |
<ESC>2<speed value> Set keying speed (5 ... 60 wpm) |
| 157 |
<ESC>3<tone value> Set sidetone (300 ... 1000 Hz) |
| 158 |
<ESC>3<0> Sound off |
| 159 |
<ESC>4 Abort message |
| 160 |
<ESC>5 Stop (Exit) the daemon |
| 161 |
<ESC>6 Set uninterruptable (word- ) mode for simulator |
| 162 |
<ESC>7<weight value> Set weighting (-50 ... 50) |
| 163 |
<ESC>8<device> Set device for keying (same as -d) |
| 164 |
<ESC>9<port number> Obsolete |
| 165 |
<ESC>a<0|1> PTT keying off or on |
| 166 |
<ESC>b<0|1> SSB signal from microphone or soundcard |
| 167 |
<ESC>c<x> Tune x seconds long (limit = 10 seconds) |
| 168 |
<ESC>d<delay> PTT on delay 0..50 (0 .. 50ms) |
| 169 |
<ESC>e<bandindex> Band info output on pins 2, 7, 8, 9 of the parport |
| 170 |
(pin 2 = lsb, 9 = msb, e.g. 1000 = 160m, 1001 = 10m) |
| 171 |
<ESC>f<sound system> Set sound system, same as '-x' command line option. |
| 172 |
Recognized values are: |
| 173 |
c - console buzzer (PC speaker) - default system, |
| 174 |
o - OSS, |
| 175 |
a - ALSA, |
| 176 |
p - PulseAudio, |
| 177 |
n - none - no audio, |
| 178 |
s - soundcard - autoselect from OSS/ALSA/PulseAudio. |
| 179 |
You may experience few seconds of delay (~4 s) when |
| 180 |
switching from ALSA or PulseAudio to OSS audio |
| 181 |
system. This is because OSS waits until audio device |
| 182 |
stops being blocked by ALSA or PulseAudio. |
| 183 |
<ESC>g<volume> Set soundcard volume (0 .. 100). |
| 184 |
<ESC>h<text> This request must be followed by a second request |
| 185 |
containing only text to be played by cwdaemon. Once |
| 186 |
the cwdaemon finishes playing the text from second |
| 187 |
request, it replies to the client with "h"+"text" |
| 188 |
from first request. |
| 189 |
|
| 190 |
"text" is optional. |
| 191 |
|
| 192 |
The reply defined in first request is used by |
| 193 |
cwdaemon only once, i.e. only for a single |
| 194 |
text request that follows the escape |
| 195 |
request. If you want to receive a reply from |
| 196 |
the cwdaemon after playing each text request, |
| 197 |
you need to send the "<ESC>h" escape request |
| 198 |
first, for every text request. |
| 199 |
|
| 200 |
Example: |
| 201 |
client sends: "<ESC>hcat" |
| 202 |
client sends: "purring" |
| 203 |
server plays: "purring" |
| 204 |
server sends back: "hcat" |
| 205 |
|
| 206 |
client sends: "<ESC>hdog" |
| 207 |
client sends: "barking" |
| 208 |
server plays: "barking" |
| 209 |
server sends back: "hdog" |
| 210 |
|
| 211 |
client sends: "<ESC>h" |
| 212 |
client sends: "whispering" |
| 213 |
server plays: "whispering" |
| 214 |
server sends back: "h" |
| 215 |
|
| 216 |
client sends: "<ESC>hdog" |
| 217 |
client sends: "barking" |
| 218 |
server plays: "barking" |
| 219 |
server sends back: "hdog" |
| 220 |
|
| 221 |
client sends: "purring" |
| 222 |
server plays: "purring" |
| 223 |
server does not send a reply - none was specified this time for "purring" |
| 224 |
|
| 225 |
|
| 226 |
Any message Send morse code message (max 1 packet!) |
| 227 |
qrz de pa0rct ++test-- In- and decrease speed on the fly in 2 wpm steps. |
| 228 |
Repeated '+' and '-' characters are allowed, |
| 229 |
in such cases increase and decrease of speed is |
| 230 |
multiple of 2 wpm. |
| 231 |
de d~l~2~w~r~j pse k Add half-space delay after each character |
| 232 |
|
| 233 |
|
| 234 |
Default startup values |
| 235 |
---------------------- |
| 236 |
Speed = 24 wpm |
| 237 |
Tone = 800 Hz |
| 238 |
Sound = on |
| 239 |
Wordmode = off |
| 240 |
Weight = 0 |
| 241 |
UDP port = 6789 |
| 242 |
PTT delay = 0 (off) |
| 243 |
Device = parport0 |
| 244 |
Sound device = console buzzer |
| 245 |
|
| 246 |
|
| 247 |
Cwdaemon supports the following special characters |
| 248 |
-------------------------------------------------- |
| 249 |
* AR |
| 250 |
= BT |
| 251 |
< SK |
| 252 |
( KN |
| 253 |
! SN |
| 254 |
& AS |
| 255 |
> BK |
| 256 |
|
| 257 |
|
| 258 |
Cwdaemon parallel and serial port circuitry |
| 259 |
------------------------------------------- |
| 260 |
See the examples in the schematics directory. |
| 261 |
|
| 262 |
|
| 263 |
Tests and examples |
| 264 |
------------------ |
| 265 |
Test scripts in Perl are located in test/ directory. |
| 266 |
Example programs are located in examples/ directory. |
| 267 |
|
| 268 |
|
| 269 |
Platforms |
| 270 |
--------- |
| 271 |
cwdaemon 0.10.2 has been compiled and tested on following platforms: |
| 272 |
- Debian GNU/Linux 8, x86_64, gcc 4.9.2, libcw 6.5.1 |
| 273 |
- Alpine Linux 3.2.0, x86_64, gcc 5.2.0, libcw 6.5.1 |
| 274 |
- FreeBSD 10.0, x86_64, clang 3.3, libcw 6.5.1 |
| 275 |
|
| 276 |
|
| 277 |
Credits |
| 278 |
------- |
| 279 |
Conversion to stand-alone utility, basic work, POSIX porting, integration |
| 280 |
with unixcw and initial FreeBSD support by PG4I. |
| 281 |
Networking, daemon mode and band switching by PA0R. |
| 282 |
Rework of the device handling, echo-ing and Debian init.d support by OK1ZIA. |
| 283 |
Many contributions by DL2WRJ. Unixcw library by G0FRD. FreeBSD support by |
| 284 |
Diane Bruce, VA3DB. OpenBSD and multi-platform support by Jason L. Wright, |
| 285 |
AI4JW. |
| 286 |
|
| 287 |
All of this code is distributed under the GNU GPL license. |