Read/write GD-77 codeplug in Linux in Python 3 (experimental)

OpenGD77CPS
VK3KYY
Posts: 7475
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by VK3KYY » Sun May 24, 2020 10:10 am

Normally the CPS has an existing codeplug it loads.

This is either the default codeplug which is installed with the CPS, or the Users last codeplug that they loaded or saved.

The CPS then just fills in the sections of the codeplug with the data from the radio.

I don't know what happens if the rest of the codeplug is empty, I guess the CPS probably does some checks, but I didnt write the CPS, I just decrypted and decompiled the official CPS (this sounds easy but it was a lot of work)

VK3KYY
Posts: 7475
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by VK3KYY » Sun May 24, 2020 10:17 am

Riku wrote:
Sun May 24, 2020 6:53 am
i suggest change serial module to HID device, as serial don't work on darwin.
USB HID with python on Windows is a problem, because you have to uninstall the Windows native HID drivers and install some other USB HID drivers instead.

So although you can then communicate with the official firmware, many other things stop working on the Windows PC.

Serial (USB CDCACM) is a much more portable solution, because PySerial does not require special drivers on Windows, or Linux or RPi (and probably not OSX).

The only complication is the that the COM port driver must be loaded, but this is not a problem for 99% of users, as the driver definitely works on W7,W8 and W10.

The only problem I know on Windows is some Windows language versions e.g. Polish, the CPS seems to not detect the driver, but I don't know why this is, because the CPS just looks or a COM port whose name includes "OpenGD77" and when I ask people the name of the COM port it is always "OpenGD77"

Unfortunately the people who have problems with the driver do not seem to seem to be able to help with the technical analysis of the problem.

VK3KYY
Posts: 7475
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by VK3KYY » Sun May 24, 2020 10:24 am

Riku wrote:
Sun May 24, 2020 6:53 am
i suggest change serial module to HID device, as serial don't work on darwin.
BTW.

I checked ages ago if it would be possible to build both HID for the codeplug upload and CDCACM for Hotspot mode, but the USB stack is too big to fit 2 different USB devices into the MCU ROM

Also, composite USB devices don't work correct on Windows versions below W10.

And. The USB stack source code is not designed for 2 different devices in the same firmware, at the same time, because of clashes in variable names in the core of the USB stack

So basically USB Serial (CDCACM) is the only viable option.

oh1fss
Posts: 74
Joined: Mon May 04, 2020 11:53 am

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by oh1fss » Sun May 24, 2020 12:31 pm

In the attached version there are two changes:

- Change delay in serial communications from 0.2 to 0.0
- When reading a codeplug, initialize first 0x0E bytes (which are not read nor written from/to the radio) so that CPS is happy

No changes in usage, see "./GD77transfer -h".
Attachments

[The extension tgz has been deactivated and can no longer be displayed.]


OH1E
Posts: 96
Joined: Sat Nov 16, 2019 8:59 am

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by OH1E » Sun May 24, 2020 2:53 pm

Read working fine now and can be open from cps.
With WINE CPS is bugging alot, there is no menus at all, they are empty. dunno why. but here it is prove to work screenshot
Image

oh1fss
Posts: 74
Joined: Mon May 04, 2020 11:53 am

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by oh1fss » Sun May 24, 2020 3:47 pm

CPS works fine with Wine 5.0 in Fedora 30. Menu texts are visible normally.

It's very easy to install Wine and use CPS in Linux:

# dnf install wine

$ wine OpenGD77CPSInstaller.exe

Install as usual, except no USB drivers, because USB does not work in CPS with Wine. Then execute CPS from the Wine menu.

Instead of using the read/write functionality of CPS, open/save your codeplug. Then use GD77transfer to transfer the saved codeplug file to GD-77.

OH1KH
Posts: 14
Joined: Wed Dec 18, 2019 6:54 pm
Location: Pori, Finland
Contact:

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by OH1KH » Mon May 25, 2020 5:29 am

oh1fss wrote:
Sun May 24, 2020 12:31 pm
In the attached version there are two changes:

- Change delay in serial communications from 0.2 to 0.0
- When reading a codeplug, initialize first 0x0E bytes (which are not read nor written from/to the radio) so that CPS is happy

No changes in usage, see "./GD77transfer -h".
Finally got time to test this.

Everything works!
Now just read codeplug with Python, save, edit with wine+cps, save again, and finally write with python.
(Fedora 30, Python3)

Nice, thanks!

LZ1CK
Posts: 12
Joined: Sun Jul 12, 2020 9:50 am

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by LZ1CK » Sun Jul 12, 2020 9:58 am

I need a way to read/write/edit codeplugs on Linux, so I started fiddling with this script here:

https://github.com/kzyapkov/opengd77xfer

Ideally, I want to implement parsing the codeplug to/from CSV or some other portable format. I'll probably have to look into the firmware or the CPS tool to figure out the format and semantics of fields. Any pointers are appreciated (except for NULL).

VK3KYY
Posts: 7475
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by VK3KYY » Sun Jul 12, 2020 11:54 pm

I'm not aware of any definitive documentation on the codeplug format.

You could look in the OpenGD77 firmware source

https://github.com/rogerclarkmelbourne/ ... codeplug.c
https://github.com/rogerclarkmelbourne/ ... codeplug.h

and the individual files in the CPS
e.g.
https://github.com/rogerclarkmelbourne/ ... #L127-L160

The OpenGD77 firmware only supports a small subset of the full Radioddity codeplug format, and the code in the firmware was written by reverse engineering the raw data and looking at some of the CS files.

KC7RBW
Posts: 159
Joined: Wed Nov 20, 2019 1:23 am

Re: Read/write GD-77 codeplug in Linux in Python 3 (experimental)

Post by KC7RBW » Mon Jul 13, 2020 2:10 am

LZ1CK wrote:
Sun Jul 12, 2020 9:58 am
I'll probably have to look into the firmware or the CPS tool to figure out the format and semantics of fields. Any pointers are appreciated (except for NULL).
Go to http://members.optuszoo.com.au/jason.re ... 77mods.htm and look for "codeplug map". It's not perfect, and it's based on the stock firmware, but it will get you most of the way there, and you can look at the CPS and firmware code.

Post Reply