Skip to content

dmr-tools/anytone-emu

Repository files navigation

AnyTone emulator

This little program emulates several AnyTone devices, such that codeplugs written by the manufacturer CPS, can be captured and analyzed. For the maximum convenience, this tool either generates a pair of pseudo-terminals (under Linux), that can be exposed as COM ports to wine. This allows for running the manufacturer CPS in wine, eliminating the need for a windows VM. Alternatively, it opens a serial interface (one of a pair of so-called virtual null-modem cables) under windows and emulates an AnyTone device there.

Build & install

This tool is build with Qt 6 using QtSerialPort to talk to the serial port on windows and Linux. You will need these development packages to build anytone-emu. The build tool is cmake, so that one is needed too.

Usage under wine

For example, the call

 > anytone-emu --device=dmr6x2uv --dump 

or equivalently, the call showing all default-values

 > anytone-emu --device=dmr6x2uv --dump --loglevel=info --interface=pty

will create a pseudo-terminal and connect the emulation of a BTECH DMR-6X2UV to that. This PTY is then linked to ~/.local/share/anytone-emu/anytoneport. From there, your CPS can access it through wine.

To expose this PTY to applications running under wine, run

> wine regedit

And add a string-value to the key HKEY_LOCAL_MACHINE\Software\Wine\Ports. The name is then (e.g.) COM1 while the value should point to the linked PTY. $HOME/.local/share/anytone-emu/anytoneport, where $HOME should the absolute path to you home directory.

Then, you may need to restart the wineserver with

wineserver -k

Then start the CPS application using wine and select the configured COM port as the interface to the device within the CPS.

CPSs under wine

There are several CPSs, which do not appear to run easily under wine. This table collects which CPSs appear to work with wine.

CPS Version Wine 6 Wine 8 Remark
AnyTone D868UVE 1.40 not tested yes
AnyTone D878UV 3.02n no crashes
AnyTone D878UV II 3.02n not tested crashes
AnyTone D578UV (II) 1.18 not tested crashes
BTECH DMR-6X2UV 2.04 not tested yes
BTECH DMR-6X2UV Pro 1.01k yes not tested
Alinco DJ-MD5 1.13e not tested yes

Command line options

  • --help -- Obvious help message.
  • --version -- Show version number
  • --dump -- Just dumps the received codeplug as a hex-dump. Either to stdout or to a file, specified by --output.
  • --diff=MODE -- Dumps only the difference between codeplugs. The MODE specifies the codeplugs to be compared. The first mode compares each received codeplug with the first one, while previous compares the last two received codeplugs.
  • --interface=IF -- Specifies the interface to the CPS. This is either pty or comX. The former will create a PTY pair and link $HOME/.local/share/anytone-emu/anytoneport to it. This then allows to set this PTY as a COM port in the wine regedit. If anytone-emu is run under windows, a null-modem emulator (e.g., com2com) can be used to connect the CPS to the emulator. In this case, the null-modem emulator will create two virtual COM ports. One is passed to anytone-emu as comX the other is set in the CPS.
  • --device=DEVICE_ID -- Specifies which radio to emulate. Must be one of d868uve, d878uv, d878uv2, d578uv, d578uv2, dmr6x2uv or dmr6x2uv2.
  • --output=PATTERN -- Specifies the output filename pattern using printf format. E.g., a pattern like "codeplug_%02d.hex" will generate a series of files named "codeplug_00.hex", "codeplug_01.hex",... for each received codeplug.

License

anytone-emu Copyright (C) 2023 Hannes Matuschek

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.