Skip to content

Instantly share code, notes, and snippets.

@ericek111
Last active March 23, 2024 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ericek111/d2325c55921853a4592e46962dfe37f2 to your computer and use it in GitHub Desktop.
Save ericek111/d2325c55921853a4592e46962dfe37f2 to your computer and use it in GitHub Desktop.
Contesting with N1MM on Linux: a tutorial for the adventurous

Contesting with N1MM on Linux

N1MM+ has been the go-to contest logger for many hams and, thanks to its networking features, also clubs. Sadly, it's only for Windows, it's closed-source and the omnipresent bugs don't make it any more fun.

Setting up Wine

  1. Install any decently recent flavour of Wine. Usually the one provided by your distro's package manager is fine.
  2. Install winetricks.
  3. Set the required environment variables. You only need to specify $WINEARCH once, when creating the wineprefix (which is, in short, a self-contained "fake" "Windows" "installation"). When you'll want to work inside this prefix, you'll need to run the first command inside every newly opened terminal window.
export WINEPREFIX=~/.wine_n1mm
export WINEARCH=win32
  1. Use winetricks to install .NET, which N1MM uses to run:
wine wineboot
winetricks win7
winetricks dotnet46
  1. Download and install N1MM+ (in the same terminal window, wine ~/Downloads/N1MM-Logger....exe).

Patching N1MM

Due to a bug in Wine (audio enumeration is not fully implemented), N1MM seems to forget your settings on every launch, because it tries to probe all the audio devices in your system before actually reading the config files, making the whole process fail (that's the nasty error message on start, referring to NAudio).

  1. Download and unzip dnSpy-net-win32.zip.
  2. Run it inside your WINEPREFIX (WINEPREFIX=~/.wine_n1mm wine ~/Downloads/...).
  3. Inside dnSpy (File > Open), open C:\Program Files\N1MM Logger+\N1MMLogger.net.exe.
  4. Navigate to the N1MMLogger.net/N1MMLogger.net.exe/N1MMLogger.Net/NAudioPlayer class.
  5. Around the line 755 of the decompiled output (may change with updates), you should see the method SetAnnounceMixerDevice. Right click on the name (dark orange) and .
  6. Do the same with the next method, SetOutputMixerDevice.
  7. Click on the icon with two floppy drives in the toolbar next to "C#". Click OK.

Using CAT inside N1MM

Through FLrig

I personally prefer to run every ham program with FLrig, if possible. N1MM does not natively support it, but with a useful utility in hamlib called rigctlcom, we can simulate a Kenwood TS-2000 radio.

Due to some bug FLrig does not save the quite long file path to my radio's USB serial converter correctly. One workaround is to set up FLrig, save the config, make a copy, fix the xcvr_serial_port path, and then just overwrite the corrupted config with my good one on every launch. This is the command my desktop icon runs:

bash -c "cp ~/.flrig3000/FTdx3000.prefs.good ~/.flrig3000/FTdx3000.prefs ; flrig --config-dir ~/.flrig3000"

There is an open issue to allow rigctlcom to work over TCP saving us these next two commands. But until that's implemented, we need to create a virtual serial port:

sudo socat pty,raw,link=/dev/vspin0,group-late=uucp,mode=660 pty,raw,link=/dev/vsp0,group-late=uucp,mode=660

Tip

Your user must be a member of the uucp group. You can also use mode=666.

Then, "bridge" the virtual serial port onto a TCP port.

socat TCP-LISTEN:10501,fork,reuseaddr,nodelay FILE:/dev/vsp0,raw,echo=0

Finally, start rigctlcom to translate the TS-2000 commands into something FLrig can speak.

rigctlcom -vvvv -m 4 -R /dev/vspin0

Tip

If FLrig gets stuck/closed and your CAT suddenly stops working, the culprit is most likely rigctlcom. Just kill it with Ctrl+C and start it again. N1MM should recover. With the -vvvv flags, you'll see "IO error" printed in the console.

In N1MM in menu Config > Configure Ports, Mode Control, Winkey... select Port: TCP, Radio: TS-2000, and fill in your IP and port: 127.0.0.1:10501. Click the Set button and enable PTT via Radio Command, if you want to use N1MM to play back prerecorded CQ calls, for example.

I want to use my radio directly.

You can. In that case, it's just this one command. Your radio must be supported by N1MM and it's not the most stable way, in my experience.

socat TCP-LISTEN:10501,fork,reuseaddr,nodelay FILE:/dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_AH046H4J230099-if00-port0,raw,echo=0,cs8,crtscts=1,b38400,cstopb=1

Note

cstopb can be 0 (one stopbit) or 1 (two stopbits).

Routing audio

TODO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment