hmatuschek / qdmr

A GUI application for configuring and programming cheap DMR radios under Linux and MacOS X.
https://dm3mat.darc.de/qdmr/
GNU General Public License v3.0
223 stars 46 forks source link

Crash of qdmr on failed decoding of codeplug for DR1801UV. #437

Closed hmatuschek closed 4 months ago

hmatuschek commented 6 months ago

Hi! I built qdmr-435-implement-manual-device-interface-selection.

In settings I deactivated auto-detect. Then clicked "download codeplug".

Debug in src/application.cc@1001: Set icon theme to 'light'. Debug in src/application.cc@81: Search for translation in '/usr/local/share/locale/de_DE/LC_MESSAGES'. Debug in src/application.cc@81: Search for translation in '/usr/local/share/locale/de/LC_MESSAGES'. Debug in src/application.cc@84: Installed translator for locale 'de_DE'. Debug in src/repeaterbookcompleter.cc@328: Loaded repeater cache of 0 entries. Debug in lib/userdatabase.cc@132: Loaded user database with 259618 entries from /home/pk/.local/share/DM3MAT/qdmr/user.json. Debug in lib/talkgroupdatabase.cc@140: Loaded talk group database with 1675 entries from /home/pk/.local/share/DM3MAT/qdmr/talkgroups.json. serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT. Debug in src/application.cc@137: Last known position: Debug in src/application.cc@189: Create main window using icon theme 'light'. serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT. qt.positioning.geoclue2: Already stopped Debug in src/application.cc@554: Last device is invalid, search for new one. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 1fc9:94. Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73. Debug in lib/dfu_libusb.cc@157: Search for DFU devices matching VID:PID 483:df11. Debug in lib/c7000device.cc@236: Search for C7000 devices matching VID:PID 1206:227. Debug in src/application.cc@558: No save device found, continue searching for unsave ones. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 1fc9:94. Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73. Debug in lib/dfu_libusb.cc@157: Search for DFU devices matching VID:PID 483:df11. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 67b:23a3. Debug in lib/c7000device.cc@236: Search for C7000 devices matching VID:PID 1206:227. ERROR in src/application.cc@562: Kein passendes Gerät gefunden.

I see no way to select the tty or to select DR1801UV. Maybe I am looking in the wrong places? Should I select DR1801UV before pressing download? Or should I be asked after pressing download? And switching off auto-detection doesnt seem to change anything for me.

I tried two different cables, both with the same result. Both cables report: idVendor=1a86, idProduct=7523

And I found my second DR1801UV which has a working codeplug installed, no difference.

Maybe the zip-file is not yet updated? md5sum qdmr-435-implement-manual-device-interface-selection.zip 537806a85dc9b21566ef380c24a8a7c5 qdmr-435-implement-manual-device-interface-selection.zip

Regards, Patrick

Originally posted by @DH1PK in https://github.com/hmatuschek/qdmr/issues/435#issuecomment-2112642974

hmatuschek commented 6 months ago

@DH1PK, I've created a separate issue for this problem. There are actually three:

  1. qdmr should not crash on an communication error
  2. qdmr should not crash on parsing an incomplete code plug
  3. There should be no communication issues with the DR-1801UV. This however, is not trivial, as the A6 chip used in the DR-1801 is a pain in the ass concerning the communication with the host.

You said, you have two of these radios. Do both have this communication issue? Also, could you get me a copy of the binary code plug (read using dmrconf). The latter should help with point 2.

DH1PK commented 6 months ago

Hi!

I tried to read the binary codeplug with dmrconf, but without success. First I tried the unpached 435 release, then I patched the PID/VID, recompiled and tried again. I don't even see dmrconf trying the PID/VID for DR1801UV, neither the original nor my patched PID/VID.

This worked some month ago when I sent you a binary codeplug.

Am I doing something wrong?

~/qdmr/2024-05-16$ lsusb | grep CH340 Bus 003 Device 021: ID 1a86:7523 QinHeng Electronics CH340 serial converter

~/qdmr/2024-05-16$ dmrconf read -V -D /dev/ttyUSB0 -R dr1801uv DR1801-01-programmed.bin Debug in cli/autodetect.cc@40: Autodetect radios. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 1fc9:94. Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73. Debug in lib/dfu_libusb.cc@157: Search for DFU devices matching VID:PID 483:df11. Debug in lib/c7000device.cc@236: Search for C7000 devices matching VID:PID 1206:227. ERROR in cli/autodetect.cc@44: No matching USB devices are found. Check connection? ERROR in cli/readcodeplug.cc@28: Cannot detect radio: In autodetect.cc:44: No matching USB devices are found. Check connection?

~/qdmr/2024-05-16$ dmrconf read -V DR1801-01-programmed.bin Debug in cli/autodetect.cc@40: Autodetect radios. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@118: Search for serial port with matching VID:PID 1fc9:94. Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73. Debug in lib/dfu_libusb.cc@157: Search for DFU devices matching VID:PID 483:df11. Debug in lib/c7000device.cc@236: Search for C7000 devices matching VID:PID 1206:227. ERROR in cli/autodetect.cc@44: No matching USB devices are found. Check connection? ERROR in cli/readcodeplug.cc@28: Cannot detect radio: In autodetect.cc:44: No matching USB devices are found. Check connection?

//#define USB_VID 0x067b //#define USB_PID 0x23a3

define USB_VID 0x1a86

define USB_PID 0x7523

Regards, Patrick

allesand commented 6 months ago

Out if curiosity: "serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT." That is not a qdmr message, is it? Is there some other program claiming the port? "serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT. qt.positioning.geoclue2: Already stopped"

hmatuschek commented 6 months ago

Out if curiosity: "serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT." That is not a qdmr message, is it? Is there some other program claiming the port? "serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT. qt.positioning.geoclue2: Already stopped"

I use QTs positioning library for finding repeaters near by. However, that might actually be a hint as it may try to find GPS receivers connected via a serial port.

hmatuschek commented 6 months ago

In fact, I can reproduce the issue here with qdmr, but dmrconf works for me.

hmatuschek commented 6 months ago

Fixed that on my side in the 437-crash-on-incomplete-read-of-codeplug-dr1801uv. Let me know, if it works for you. It is still buggy:

Lets say, its implementation is on par with the manufacturer.

DH1PK commented 6 months ago

Hi!

Built 437 today and gave it a try on the "programmed" DR1801:

ebug in lib/radio.cc@61: Try to detect radio at Serial interface 'ttyUSB0'. Debug in lib/usbserial.cc@27: Try to open Serial interface 'ttyUSB0'. Debug in lib/usbserial.cc@72: Opened serial port ttyUSB0 with 9600baud. Debug in lib/auctus_a6_interface.cc@23: Open interface to Auctus A6 based radio. Debug in lib/auctus_a6_interface.cc@90: Send aa06010403bb Debug in lib/auctus_a6_interface.cc@138: Got response aa0781040183bb. Debug in lib/auctus_a6_interface.cc@90: Send aa06000006bb Debug in lib/auctus_a6_interface.cc@138: Got response aa3a800001202c4246313830312c41362d303030302d585858582c706f727461626c652c3133364d2d3137344d2c3430304d2d3438304d2cfdbb. Debug in lib/dr1801uv_interface.cc@336: ,BF1801,A6-0000-XXXX,portable,136M-174M,400M-480M, Debug in lib/auctus_a6_interface.cc@90: Send aa0a01000001c200c8bb Debug in lib/auctus_a6_interface.cc@138: Got response aa158100010001dd90000000680002e69e34c33cbb. Debug in lib/dr1801uv_interface.cc@404: Set baudrate to 115200. Debug in lib/auctus_a6_interface.cc@90: Send aa06010106bb Debug in lib/dr1801uv_interface.cc@157: Start reading 122256b of codeplug memory. Debug in lib/dr1801uv_interface.cc@173: Reset baudrate to 9600. ERROR in lib/dr1801uv_codeplug.cc@60: Cannot decode invalid channel at index 0, got promissed 41 valid channels. ERROR in lib/dr1801uv_codeplug.cc@3277: Cannot decode channel elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. Debug in lib/usbserial.cc@105: Serial port will close now. ERROR in lib/dr1801uv_codeplug.cc@60: Cannot decode invalid channel at index 0, got promissed 41 valid channels. ERROR in lib/dr1801uv_codeplug.cc@3277: Cannot decode channel elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. Speicherzugriffsfehler (Speicherabzug geschrieben)

Will try the "factory new" one...

Regards, Patrick

DH1PK commented 6 months ago

Same result with the "fresh" one, only difference is the number of promised elements:

Debug in lib/usbserial.cc@27: Try to open Serial interface 'ttyUSB0'. Debug in lib/usbserial.cc@72: Opened serial port ttyUSB0 with 9600baud. Debug in lib/auctus_a6_interface.cc@23: Open interface to Auctus A6 based radio. Debug in lib/auctus_a6_interface.cc@90: Send aa06010403bb Debug in lib/auctus_a6_interface.cc@138: Got response aa0781040183bb. Debug in lib/auctus_a6_interface.cc@90: Send aa06000006bb Debug in lib/auctus_a6_interface.cc@138: Got response aa3a800001202c4246313830312c41362d303030302d585858582c706f727461626c652c3133364d2d3137344d2c3430304d2d3438304d2cfdbb. Debug in lib/dr1801uv_interface.cc@336: ,BF1801,A6-0000-XXXX,portable,136M-174M,400M-480M, Debug in lib/auctus_a6_interface.cc@90: Send aa0a01000001c200c8bb Debug in lib/auctus_a6_interface.cc@138: Got response aa158100010001dd90000000680002e69eb193e9bb. Debug in lib/dr1801uv_interface.cc@404: Set baudrate to 115200. Debug in lib/auctus_a6_interface.cc@90: Send aa06010106bb Debug in lib/dr1801uv_interface.cc@157: Start reading 122256b of codeplug memory. Debug in lib/dr1801uv_interface.cc@173: Reset baudrate to 9600. Debug in lib/usbserial.cc@105: Serial port will close now. ERROR in lib/dr1801uv_codeplug.cc@1058: Unexpected invalid zone at index 0, was promissed 1 zones. ERROR in lib/dr1801uv_codeplug.cc@3292: Cannot decode zone elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. ERROR in lib/dr1801uv_codeplug.cc@1058: Unexpected invalid zone at index 0, was promissed 1 zones. ERROR in lib/dr1801uv_codeplug.cc@3292: Cannot decode zone elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. Speicherzugriffsfehler (Speicherabzug geschrieben)

The crash happens after clicking "OK" on the error message window.

Regards, Patrick

DH1PK commented 6 months ago

Tried building a simple codeplug with two Zones containig some simplex FM channels (from a chirp import). Uploading fails:

Debug in lib/usbserial.cc@27: Try to open Serial interface 'ttyUSB0'. Debug in lib/usbserial.cc@72: Opened serial port ttyUSB0 with 9600baud. Debug in lib/auctus_a6_interface.cc@23: Open interface to Auctus A6 based radio. Debug in lib/auctus_a6_interface.cc@90: Send aa06010403bb Debug in lib/auctus_a6_interface.cc@138: Got response aa0781040183bb. Debug in lib/auctus_a6_interface.cc@90: Send aa06000006bb Debug in lib/auctus_a6_interface.cc@138: Got response aa3a800001202c4246313830312c41362d303030302d585858582c706f727461626c652c3133364d2d3137344d2c3430304d2d3438304d2cfdbb. Debug in lib/dr1801uv_interface.cc@336: ,BF1801,A6-0000-XXXX,portable,136M-174M,400M-480M, Debug in lib/auctus_a6_interface.cc@90: Send aa0a01000001c200c8bb Debug in lib/auctus_a6_interface.cc@138: Got response aa158100010001dd90000000680002e69eb192e8bb. Debug in lib/dr1801uv_interface.cc@404: Set baudrate to 115200. Debug in lib/auctus_a6_interface.cc@90: Send aa06010106bb Debug in lib/dr1801uv_interface.cc@157: Start reading 122256b of codeplug memory. Debug in lib/dr1801uv_interface.cc@173: Reset baudrate to 9600. Debug in lib/auctus_a6_interface.cc@90: Send aa06010403bb Debug in lib/auctus_a6_interface.cc@138: Got response aa0781040183bb. Debug in lib/auctus_a6_interface.cc@90: Send aa12010200010001da8c32c00000258010bb Debug in lib/auctus_a6_interface.cc@138: Got response aa08810201008abb. Debug in lib/dr1801uv_interface.cc@430: Set baudrate to 9600. Debug in lib/dr1801uv_interface.cc@223: Write codeplug... Debug in lib/dr1801uv_interface.cc@250: Receive write-ACK. ERROR in lib/auctus_a6_interface.cc@120: Unexpected start-of-packet byte: Expected aah, got 0h. ERROR in lib/dr1801uv_interface.cc@448: Cannot complete codeplug write. ERROR in lib/dr1801uv_interface.cc@252: Cannot finish write operation properly. Partial write? ERROR in lib/dr1801uv.cc@180: Cannot write codeplug to the device. Debug in lib/usbserial.cc@105: Serial port will close now. Debug in src/application.cc@874: Write complete.

Regards, Patrick

hmatuschek commented 5 months ago

Same result with the "fresh" one, only difference is the number of promised elements:

Debug in lib/usbserial.cc@27: Try to open Serial interface 'ttyUSB0'. Debug in lib/usbserial.cc@72: Opened serial port ttyUSB0 with 9600baud. Debug in lib/auctus_a6_interface.cc@23: Open interface to Auctus A6 based radio. Debug in lib/auctus_a6_interface.cc@90: Send aa06010403bb Debug in lib/auctus_a6_interface.cc@138: Got response aa0781040183bb. Debug in lib/auctus_a6_interface.cc@90: Send aa06000006bb Debug in lib/auctus_a6_interface.cc@138: Got response aa3a800001202c4246313830312c41362d303030302d585858582c706f727461626c652c3133364d2d3137344d2c3430304d2d3438304d2cfdbb. Debug in lib/dr1801uv_interface.cc@336: ,BF1801,A6-0000-XXXX,portable,136M-174M,400M-480M, Debug in lib/auctus_a6_interface.cc@90: Send aa0a01000001c200c8bb Debug in lib/auctus_a6_interface.cc@138: Got response aa158100010001dd90000000680002e69eb193e9bb. Debug in lib/dr1801uv_interface.cc@404: Set baudrate to 115200. Debug in lib/auctus_a6_interface.cc@90: Send aa06010106bb Debug in lib/dr1801uv_interface.cc@157: Start reading 122256b of codeplug memory. Debug in lib/dr1801uv_interface.cc@173: Reset baudrate to 9600. Debug in lib/usbserial.cc@105: Serial port will close now. ERROR in lib/dr1801uv_codeplug.cc@1058: Unexpected invalid zone at index 0, was promissed 1 zones. ERROR in lib/dr1801uv_codeplug.cc@3292: Cannot decode zone elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. ERROR in lib/dr1801uv_codeplug.cc@1058: Unexpected invalid zone at index 0, was promissed 1 zones. ERROR in lib/dr1801uv_codeplug.cc@3292: Cannot decode zone elements. ERROR in lib/dr1801uv_codeplug.cc@3262: Cannot decode elements. Speicherzugriffsfehler (Speicherabzug geschrieben)

The crash happens after clicking "OK" on the error message window.

Regards, Patrick

Okay, it looks like, the codeplug gets read completely but qdmr fails to decode it. You you read the binary one using dmrconf and attach it here?

hmatuschek commented 4 months ago

Is this sill of interest? If so, please read the binary codeplug using

dmrconf read dr1801uv_codeplug.dfu

Reading the codeplug appears to work but the decoding fails. So the binary codeplug that produces the problem would be of great help.

hmatuschek commented 4 months ago

Okay, current state of knowledge:

hmatuschek commented 4 months ago

Okay, I think I've got it (the crash). It was a signal, that was send twice (downloadFinished). The decoding errors still remain. Will focus on these ones now.

hmatuschek commented 4 months ago

Fixed decoding of channels, zone issue remains.

hmatuschek commented 4 months ago

The issue was, that I did not realized that all codeplug elements can be encoded sparsely. That is, a channel might be marked as invalid or deleted among valid channels. This should be fixed now for every codeplug element.