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

qdmr 0.11.2 fails to conect to AnytoneD878UVIIPlus after Firmware-Update to Version 3.02 #334

Closed DK8KK closed 1 year ago

DK8KK commented 1 year ago

Since April 23th. a new Firmware (3.02) is available for D878UVII/IIPlus devices. After FW install qdmr can't find the radio anymore. Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

majkrzak commented 1 year ago

How does the radio identify itself after upgrade? Have they changed the vid or pid?

DK8KK commented 1 year ago

Cześć dzień dobry Piotr,

Piotr Majkrzak @.***> [03.05.2023 13.28.06 -0700]:

How does the radio identify itself after upgrade? Have they changed the vid or pid?

I am not sure what they have done. After connecting the radio to my notebook an starting qdmr afterwards for downloading the codestack I got these lines of messages:

Debug in @.: Set icon theme to 'light'. Debug in @.: Search for translation in '/usr/local/share/locale/de_DE/LC_MESSAGES'. Debug in @.: Search for translation in '/usr/local/share/locale/de/LC_MESSAGES'. Debug in @.: Installed translator for locale 'de_DE'. Debug in @.: Loaded repeater cache of 0 entries. Debug in @.: Loaded user database with 236849 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/user.json. Debug in @.: Loaded talk group database with 1652 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/talkgroups.json. Debug in @.: Last known position: 49° 42' 42.5" N, 8° 34' 16.6" E Debug in @.: Create main window using icon theme 'light'. Debug in @.: Last device is invalid, search for new one. Debug in @.: Search for serial port with matching VID:PID 28e9:18a. Debug in @.: Search for serial port with matching VID:PID 1fc9:94. Debug in @.: Search for HID interfaces matching VID:PID 15a2:73. Debug in @.: Search for DFU devices matching VID:PID 483:df11. ERROR in @.***: Kein passendes Gerät gefunden

Thanks for your feedback.

Mit freundlichen Grüßen Yours sincerely / vy 73 es 55 de Karlheinz, DK8KK

Karlheinz -- Diese Nachricht wurde mit einer Petroleumlampe in das offene Ende eines Glasfaserkabels gemorst.

    German Amateur Radio Station DK8KK
/~  LOC JN49HR, DOK K07, CQ-Zone 14, ITU-Zone 28, IARU-Region 1

Q///~ Karlheinz Geyer (;#) P.O. Box 11 40 /_\ D–64659 Alsbach-Hähnlein I I –Germany– E-Mail ━●● ━●━ ━━━●● ━●━ ━●━ @ ━●● ●━ ●━● ━●━● ●━●━●━ ━●● ●

DK8KK commented 1 year ago

Device Info: Radio ID:2630539 Radio Name: DK8KK Model: D878UVII Freq Range:400-480 136-174 Firmware Ver: 3.02 Hardware Ver: 1.10(GD) Radio Data Ver: 1.00 Last Pro Date: 21-04-2023 Pic Ver: 1.21 Lange Ver: 1.00 Sct 3258 Ver: V2.01.07BA BT Soft Ver: ET12_AQQX_V10036 Aprs Bord Ver: V104

hmatuschek commented 1 year ago

From the debug output, it looks like, they have changed the devices VID/PID with the minor FW update. You could verify that with lsusb to list all connected USB devices. It should have the VID/PID combination: 28e9/018a.

I hope, they haven't changed the protocol. This would be very bad. Under windows, the VID/PID does not matter, as the device is addressed via the selected COM port. I, however, use it to identify the anytones automatically.

DK8KK commented 1 year ago

Glückauf Hannes,

Hannes Matuschek @.***> [04.05.2023 02.10.02 -0700]:

From the debug output, it looks like, they have changed the devices VID/PID with the minor FW update. You could verify that with lsusb to list all connected USB devices. It should have the VID/PID combination: 28e9/018a.

Already done, lsusb shows:

[...] Bus 001 Device 009: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode [...]

Mit freundlichen Grüßen Yours sincerely / vy 73 es 55 de Karlheinz, DK8KK

Karlheinz -- Diese Nachricht wurde mit einer Petroleumlampe in das offene Ende eines Glasfaserkabels gemorst.

    German Amateur Radio Station DK8KK
/~  LOC JN49HR, DOK K07, CQ-Zone 14, ITU-Zone 28, IARU-Region 1

Q///~ Karlheinz Geyer (;#) P.O. Box 11 40 /_\ D–64659 Alsbach-Hähnlein I I –Germany– E-Mail ━●● ━●━ ━━━●● ━●━ ━●━ @ ━●● ●━ ●━● ━●━● ●━●━●━ ━●● ●

majkrzak commented 1 year ago

I found following change log of 3.02n firmware which may be very releated to the issue:

These firmware releases, D878UV-V3.02N & D878UVII-V3.02N are to correct these issues in the V3.02 firmware & CPS releases.

1.Digital Monitor double slot not working properly.

  1. CPS of the AT-D878UV II PLUS did not read the radio correctly.
DK8KK commented 1 year ago

Dear Piotr,

Piotr Majkrzak @.***> [04.05.2023 07.33.58 -0700]:

I found following change log of 3.02n firmware which may be very releated to the issue:

 These firmware releases, D878UV-V3.02N & D878UVII-V3.02N
 are to correct these issues in the V3.02 firmware & CPS releases.

 1.Digital Monitor double slot not working properly.
 2. CPS of the AT-D878UV II PLUS did not read the radio correctly.

Thanks for that hint... I have upgraded my radio to FW Ver. 3.02N the error still persists unfortunately :-(

qdmr can't find radio D878UVIIPLUS anymore...

Debug in @.: Set icon theme to 'light'. Debug in @.: Search for translation in '/usr/local/share/locale/de_DE/LC_MESSAGES'. Debug in @.: Search for translation in '/usr/local/share/locale/de/LC_MESSAGES'. Debug in @.: Installed translator for locale 'de_DE'. Debug in @.: Loaded repeater cache of 0 entries. Debug in @.: Loaded user database with 236849 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/user.json. Debug in @.: Loaded talk group database with 1652 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/talkgroups.json. Debug in @.: Last known position: 49° 42' 42.5" N, 8° 34' 16.6" E Debug in @.: Create main window using icon theme 'light'. Debug in @.: Last device is invalid, search for new one. Debug in @.: Search for serial port with matching VID:PID 28e9:18a. Debug in @.: Search for serial port with matching VID:PID 1fc9:94. Debug in @.: Search for HID interfaces matching VID:PID 15a2:73. Debug in @.: Search for DFU devices matching VID:PID 483:df11. ERROR in @.***: Kein passendes Gerät gefunden.

lsusb reports:

[...] Bus 001 Device 012: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode [...]

Mit freundlichen Grüßen Yours sincerely / vy 73 es 55 de Karlheinz, DK8KK

Karlheinz -- Diese Nachricht wurde mit einer Petroleumlampe in das offene Ende eines Glasfaserkabels gemorst.

    German Amateur Radio Station DK8KK
/~  LOC JN49HR, DOK K07, CQ-Zone 14, ITU-Zone 28, IARU-Region 1

Q///~ Karlheinz Geyer (;#) P.O. Box 11 40 /_\ D–64659 Alsbach-Hähnlein I I –Germany– E-Mail ━●● ━●━ ━━━●● ━●━ ━●━ @ ━●● ●━ ●━● ━●━● ●━●━●━ ━●● ●

hmatuschek commented 1 year ago

Ok, the VID/PID matches. So, the only option is, that QSerialPort does not find it. Check dmsg when plugging the device in, whether the kernel recognizes it as a serial interface. lsusb only lists the description, this does not mean, that it is actually handled as a USB CDC-ACM (serial over USB) device.

DK8KK commented 1 year ago

Guten Abend lieber Hannes,

Hannes Matuschek @.***> [04.05.2023 12.43.31 -0700]:

Ok, the VID/PID matches. So, the only option is, that QSerialPort does not find it. Check dmsg when plugging the device in, whether the kernel recognizes it as a serial interface. lsusb only lists the description, this does not mean, that it is actually handled as a USB CDC-ACM (serial over USB) device.

I've monitored with dmesg before already of course... here comes the latest output...

[45481.191172] usb 1-2: new full-speed USB device number 13 using xhci_hcd [45481.341756] usb 1-2: New USB device found, idVendor=28e9, idProduct=018a, bcdDevice= 1.00 [45481.341769] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [45481.341777] usb 1-2: Product: GD32 Virtual ComPort in FS Mode [45481.341784] usb 1-2: Manufacturer: GD32Microelectronics [45481.341790] usb 1-2: SerialNumber: 000000010000 [45481.342119] usb 1-2: Device is not authorized for usage [45481.346979] cdc_acm 1-2:1.0: ttyACM0: USB ACM device [45481.347859] usb 1-2: authorized to connect

Mit freundlichen Grüßen Yours sincerely / vy 73 es 55 de Karlheinz, DK8KK

Karlheinz -- Diese Nachricht wurde mit einer Petroleumlampe in das offene Ende eines Glasfaserkabels gemorst.

    German Amateur Radio Station DK8KK
/~  LOC JN49HR, DOK K07, CQ-Zone 14, ITU-Zone 28, IARU-Region 1

Q///~ Karlheinz Geyer (;#) P.O. Box 11 40 /_\ D–64659 Alsbach-Hähnlein I I –Germany– E-Mail ━●● ━●━ ━━━●● ━●━ ━●━ @ ━●● ●━ ●━● ━●━● ●━●━●━ ━●● ●

hmatuschek commented 1 year ago

Is the device /dev/ttyACM0 created? If so, how are the rights set on this device.

The line Device is not authorized for usage puzzles me. According to https://askubuntu.com/questions/1269595/usb-device-is-not-authorized-for-usage, this could be usbguard preventing access to the device.

DK8KK commented 1 year ago

Glückauf Hannes,

Hannes Matuschek @.***> [05.05.2023 01.59.40 -0700]:

Is the device /dev/ttyACM0 created? If so, how are the rights set on this device.

[...] crw-rw-rw- 1 root tty 5, 0 5. Mai 08:53 tty drwxrwxrwt 3 root root 80 5. Mai 11:23 shm crw-rw----+ 1 root dialout 166, 0 5. Mai 11:24 ttyACM0 drwxr-xr-x 3 root root 60 5. Mai 11:24 serial [...]

The line Device is not authorized for usage puzzles me. According to [1]https://askubuntu.com/questions/1269595/usb-device-is-not-authorized -for-usage, this could be usbguard preventing access to the device.

Nop... the last line states clearly the proper authorisation of the device and its usage.

[63219.937643] usb 1-2: SerialNumber: 000000010000 [63219.938058] usb 1-2: Device is not authorized for usage [63219.942421] cdc_acm 1-2:1.0: ttyACM0: USB ACM device [63219.943266] usb 1-2: authorized to connect

The error persits even if I disable usb-guard for testing purposes. Furthermore all versions of qdmr (0.11.2 and earlier) worked flawlessly with usb-guard in place since months. So I don't think it has anything to do with the reported error.

usb-guard list-devices:

[...] 56: allow id 28e9:018a serial "000000010000" name "GD32 Virtual ComPort in FS Mode" hash "WCj9d/e5iB5iDlye8oLmnxsoNQUvEedzZbzwX5LeeRA=" parent-hash "jEP/6WzviqdJ5VSeTUY8PatCNBKeaREvo2OqdplND/o=" via-port "1-2" with-interface { 02:02:01 0a:00:00 } with-connect-type "hotplug" [...]

Mit freundlichen Grüßen Yours sincerely / vy 73 es 55 de Karlheinz, DK8KK

Karlheinz -- Diese Nachricht wurde mit einer Petroleumlampe in das offene Ende eines Glasfaserkabels gemorst.

    German Amateur Radio Station DK8KK
/~  LOC JN49HR, DOK K07, CQ-Zone 14, ITU-Zone 28, IARU-Region 1

Q///~ Karlheinz Geyer (;#) P.O. Box 11 40 /_\ D–64659 Alsbach-Hähnlein I I –Germany– E-Mail ━●● ━●━ ━━━●● ━●━ ━●━ @ ━●● ●━ ●━● ━●━● ●━●━●━ ━●● ●

majkrzak commented 1 year ago

I can see on the Anytone-878 groups.io group, that some people reports multiple problems with firmware > 3.01. Like high BER for example. I would personally recommend not to upgrade it at this point.

allesand commented 1 year ago

Note: a fellow ham reported that 3.02N on a 878 Plus (not 878 II Plus) is working ok with qdmr 0.11.2. I have not upgraded my 878 yet, will report when done.

(See below, works as expected. Strange.)

DK8KK commented 1 year ago

I've freshly build qdmr 0.11.3 (!) from sources. qdmr seems to work afterwards but it still can't connect to the AnyTone D878UVIIPlus-Radio with firmware 3.02N installed. qdmr 0.11.3 with genuine AnyTone FW 3.02 official release works neither. Conclusion: qdmr =>0.11.2 fails to "see"/"connect to" and "read from/write to" AnyTone D878UVIIPlus devices with firmware >3.01 installed. :-( So, the error originally described is still present.

Debug in src/application.cc@863: Set icon theme to 'light'. Debug in src/application.cc@77: Search for translation in '/usr/local/share/locale/de_DE/LC_MESSAGES'. Debug in src/application.cc@77: Search for translation in '/usr/local/share/locale/de/LC_MESSAGES'. Debug in src/application.cc@80: Installed translator for locale 'de_DE'. Debug in src/repeaterbookcompleter.cc@326: Loaded repeater cache of 0 entries. Debug in lib/userdatabase.cc@132: Loaded user database with 236849 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/user.json. Debug in lib/talkgroupdatabase.cc@140: Loaded talk group database with 1646 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/talkgroups.json. Debug in src/application.cc@133: Last known position: 49° 43' 15.4" N, 8° 34' 16.4" E Debug in src/application.cc@185: Create main window using icon theme 'light'. Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

allesand commented 1 year ago

Setup here:

Distributor ID: Ubuntu Description: Ubuntu 22.04.2 LTS Release: 22.04 Codename: jammy

qdmr Version 0.11.3 (up to date github version)

D878UVII Plus (with Bluetooth and analog APRS RX) FW 3.02n (just updated) APRS V106

qdmr output: Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@169: Found ttyACM3 (USB 28e9:18a). Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. Debug in lib/usbdevice.cc@247: Check if serial port ttyACM3 still exisist and has VID:PID 28e9:18a. Debug in lib/radio.cc@56: Try to detect radio at Serial interface 'ttyACM3'. Debug in lib/usbserial.cc@90: Try to open Serial interface 'ttyACM3'. Debug in lib/usbserial.cc@124: Opened serial port ttyACM3 with 115200baud. Debug in lib/anytone_interface.cc@307: Anytone: In program-mode now. Debug in lib/anytone_interface.cc@336: Found radio 'D878UV2', version 'V100'. Debug in lib/anytone_radio.cc@192: Download of 15 bitmaps.

dmesg output: [ 105.884655] usb 2-1.2: new full-speed USB device number 6 using ehci-pci [ 105.997185] usb 2-1.2: New USB device found, idVendor=28e9, idProduct=018a, bcdDevice= 1.00 [ 105.997211] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 105.997220] usb 2-1.2: Product: GD32 Virtual ComPort in FS Mode [ 105.997227] usb 2-1.2: Manufacturer: GD32Microelectronics [ 105.997233] usb 2-1.2: SerialNumber: 000000010000 [ 105.998688] cdc_acm 2-1.2:1.0: ttyACM3: USB ACM device

Works as expected. Strange. What distribution are you using?

DK8KK commented 1 year ago

Thx @allesand for reply. === OS === Distriutor ID: »debian· Version:»·······bullseye (stable) Release:»·······11.7 Codename:»······bullseye·

=== QDMR === Version 0.11.3 (up to date github version)

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/hmatuschek/qdmr.git fetch = +refs/heads/:refs/remotes/origin/ [branch "master"] remote = origin merge = refs/heads/master [pull] ff = only

=== ANYTONE AT-D878UVII PLUS === Radio ID:2630539 Radio Name: DK8KK S/N: E2207161237 Model Name: D878UVII Freq Range 400–480, 136–174 Firmware Ver: 3.02n Hardware Ver: 1.10(GD) Radio Data Ver: 1.00 Last Pro Date: 21-04-2023 PIC Ver: 1.21 Lange Ver: 1.00 Sct 3258 Ver: V2.01.07BA BT Soft Ver: ET12_AQQX_V10036 Aprs Bord Ver: V104

=== qdmr debug output === Debug in src/application.cc@863: Set icon theme to 'light'. Debug in src/application.cc@77: Search for translation in '/usr/local/share/locale/de_DE/LC_MESSAGES'. Debug in src/application.cc@77: Search for translation in '/usr/local/share/locale/de/LC_MESSAGES'. Debug in src/application.cc@80: Installed translator for locale 'de_DE'. Debug in src/repeaterbookcompleter.cc@326: Loaded repeater cache of 0 entries. Debug in lib/userdatabase.cc@132: Loaded user database with 239772 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/user.json. Debug in lib/talkgroupdatabase.cc@140: Loaded talk group database with 1646 entries from /home/dk8kk/.local/share/DM3MAT/qdmr/talkgroups.json.

(Trying to read codeplug from device, see Bild2.png)) Debug in src/application.cc@185: Create main window using icon theme 'light'. Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

(Trying to let qdmr look for known devices attached, see Bild3.png) Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

=== dmesg | /var/log/syslog === [...] [31994.009364] usb 1-2: new full-speed USB device number 21 using xhci_hcd [31994.160197] usb 1-2: New USB device found, idVendor=28e9, idProduct=018a, bcdDevice= 1.00 [31994.160211] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [31994.160220] usb 1-2: Product: GD32 Virtual ComPort in FS Mode [31994.160226] usb 1-2: Manufacturer: GD32Microelectronics [31994.160233] usb 1-2: SerialNumber: 000000010000 [31994.160261] cdc_acm 1-2:1.0: ttyACM0: USB ACM device [...]

=== ll -l /dev/ttyA* crw-rw----+ 1 root dialout 166, 0 4. Jun 11:46 /dev/ttyACM0

=== lsusb === [...] Bus 001 Device 017: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode [...]

=== usb-devices === [...] T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 17 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=02(commc) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=28e9 ProdID=018a Rev=01.00 S: Manufacturer=GD32Microelectronics S: Product=GD32 Virtual ComPort in FS Mode S: SerialNumber=000000010000 C: #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=100mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=01 Driver=cdc_acm I: If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm [...] Bild1 Bild2 Bild3

allesand commented 1 year ago

One interesting thing: ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

Why is the error message in German, while all other messages from qdmr are in English? Any chance to try qdmr on, for example, an Ubuntu live system? IIRC it is possible to temp. install additional packages? For a test whether your radio works with qdmr on a different system?

hmatuschek commented 1 year ago

Concerning the translated error message: Some message are translated, if the same message may reach the GUI.

Before we chase ghosts @DK8KK, are you member of the dialout group? Your users needs to be a member to access serial ports. Also, sometimes, the modemmanager may interfere. Unless you use some old-school dialup modem, you may uninstall it, if installed.

DK8KK commented 1 year ago

Glückauf, yes, I am a member of group "dialout" on my computer. Once again, this error has nothing to do with my local settings. If I drop firmware 3.02N oder 3.02 from the radio and flush back version 3.01 to it the whole story works again. I need to check if this is also true for qdmr 0.11.3.

hmatuschek commented 1 year ago

Ok, this will be hard to reproduce. I've just updated my D878UV (not II) to FW version 3.02N and it works nicely. I may need a wireshark capture of the communication between the original CPS and the device to see, what has changed. What puzzles me, is that there are no error messages. Usually qdmr yells a lot of stuff, if somethings goes wrong. Here, it silently walks by the device and not even attempts to connect to it. The only thing I could imagine, is, that AnyTone messed with the EP configuration and QSerialPort just ignored it. Could you run a detailed lsusb? E.g.

lsusb --verbose -d 28e9:018a

Mine (D878UV) reports:

Bus 001 Device 025: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x28e9 GDMicroelectronics
  idProduct          0x018a 
  bcdDevice            1.00
  iManufacturer           1 GD32Microelectronics
  iProduct                2 GD32 Virtual ComPort in FS Mode
  iSerial                 3 000000010000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0043
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0 
      CDC Header:
        bcdCDC               1.10
      CDC Call Management:
        bmCapabilities       0x00
        bDataInterface          1
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
DK8KK commented 1 year ago

Settings untouched here, qdmr 0.11.3. installed and Anytone runs fw 3.02N...

=== lsusb --verbose -d 28e9:018a === lsusb.txt

allesand commented 1 year ago

878 UVII Plus bought around Nov. 2022, running FW 3.02n (so should be the same device as DK8KK?), which works like expected (qdmr output in https://github.com/hmatuschek/qdmr/issues/334#issuecomment-1574329363):

lsusb --verbose -d 28e9:018a

Bus 002 Device 004: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x28e9 GDMicroelectronics
  idProduct          0x018a 
  bcdDevice            1.00
  iManufacturer           1 GD32Microelectronics
  iProduct                2 GD32 Virtual ComPort in FS Mode
  iSerial                 3 000000010000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0043
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0 
      CDC Header:
        bcdCDC               1.10
      CDC Call Management:
        bmCapabilities       0x00
        bDataInterface          1
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
$ ls -l /dev/ttyACM3 
crw-rw---- 1 root dialout 166, 3 Jun  4 21:27 /dev/ttyACM3

Diff with DK8KK's output:

$ diff -c 878-mine Downloads/lsusb.txt 
*** 878-mine    2023-06-04 21:31:23.888720450 +0200
--- Downloads/lsusb.txt 2023-06-04 21:32:24.296886406 +0200
***************
*** 1,4 ****
! Bus 002 Device 004: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
  Device Descriptor:
    bLength                18
    bDescriptorType         1
--- 1,4 ----
! Bus 001 Device 025: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
  Device Descriptor:
    bLength                18
    bDescriptorType         1

Diff with the output from Hannes 878 (non-II):

$ diff -c 878-mine 878-hannes 
*** 878-mine    2023-06-04 21:31:23.888720450 +0200
--- 878-hannes  2023-06-04 21:35:11.673231963 +0200
***************
*** 1,4 ****
! Bus 002 Device 004: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
  Device Descriptor:
    bLength                18
    bDescriptorType         1
--- 1,4 ----
! Bus 001 Device 025: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode
  Device Descriptor:
    bLength                18
    bDescriptorType         1
hmatuschek commented 1 year ago

Ok, this is weird. It looks like, the port slips by the VID/PID detection via QSerialPort. I've added some debug messages in the fix-anytone-detection-issues branch. If this is the case, I doubt that I can fix that, as it would be an issue with QSerialPort.

DK8KK commented 1 year ago

Glückauf Hannes,

thanks for keeping the ball rolling.

I've update my qdmr repo and rebuild qdmr afterwards without errors. My AnyTone D878UVIIPLUS still runs firmware 3.02N.

Unfortunately the error still persists... qdmr cannot connect to the radio with a firmware >3.01 installed.

Debug in src/application.cc@185: Create main window using icon theme 'light'. Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@162: Search for serial port with matching VID:PID 28e9:18a. Debug in lib/usbserial.cc@162: 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@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

lsusb: Bus 001 Device 008: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode

hmatuschek commented 1 year ago

I haven't touched the detection yet. I do not know, what is wrong with it. I only added additional debug messages during the detection. These are only present in the fix-anytone-detection-issues branch.

allesand commented 1 year ago

@DK8KK You can switch to that branch via

$ git switch fix-anytone-detection-issues

Maybe the additional debug messages give a hint what's going wrong.

It should look s.th. like this

Debug in src/application.cc@446: Last device is invalid, search for new one.
Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 28e9:18a in 5 ports.
Debug in lib/usbserial.cc@178: VID:PID 8086:1c3d of ttyS4 does not match.
Debug in lib/usbserial.cc@172: Found ttyACM3 (USB 28e9:18a).
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM0 does not match.
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM1 does not match.
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM2 does not match.
Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 1fc9:94 in 5 ports.
Debug in lib/usbserial.cc@178: VID:PID 8086:1c3d of ttyS4 does not match.
Debug in lib/usbserial.cc@178: VID:PID 28e9:18a of ttyACM3 does not match.
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM0 does not match.
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM1 does not match.
Debug in lib/usbserial.cc@178: VID:PID bdb:1911 of ttyACM2 does not match.
Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73.
Debug in lib/dfu_libusb.cc@156: Search for DFU devices matching VID:PID 483:df11.
Debug in lib/usbdevice.cc@247: Check if serial port ttyACM3 still exisist and has VID:PID 28e9:18a.
Debug in lib/radio.cc@56: Try to detect radio at Serial interface 'ttyACM3'.
Debug in lib/usbserial.cc@90: Try to open Serial interface 'ttyACM3'.
Debug in lib/usbserial.cc@124: Opened serial port ttyACM3 with 115200baud.
Debug in lib/anytone_interface.cc@307: Anytone: In program-mode now.
Debug in lib/anytone_interface.cc@336: Found radio 'D868UVE', version 'V102'.
DK8KK commented 1 year ago

1) git pull 2) git switch fix-anytone-detection-issues 3) rebuilding qdmr + make install

Error persists, debug output: Debug in src/application.cc@185: Create main window using icon theme 'light'. Debug in src/application.cc@446: Last device is invalid, search for new one. Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 28e9:18a in 1 ports. Debug in lib/usbserial.cc@178: VID:PID 8086:9d2f of ttyACM0 does not match. Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 1fc9:94 in 1 ports. Debug in lib/usbserial.cc@178: VID:PID 8086:9d2f of ttyACM0 does not match. Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73. Debug in lib/dfu_libusb.cc@156: Search for DFU devices matching VID:PID 483:df11. ERROR in src/application.cc@450: Kein passendes Gerät gefunden.

lsusb: Bus 001 Device 009: ID 28e9:018a GDMicroelectronics GD32 Virtual ComPort in FS Mode

allesand commented 1 year ago

Random thought: my laptop does not have USB 3.0. The detected 8086:9d2f is a USB 3.0 controller. Do you happen to have a USB 2.0 hub that you can put between laptop and AnyTone to see if that makes any difference? Or does your PC also have USB 2.0 ports?

hmatuschek commented 1 year ago

Ok, this is strange. Indeed, QSerialPort reports the wrong VID/PID for the device. This way, I cannot detect it.

toco commented 1 year ago

I have similar results when trying with 3c7f6ac40fe8976bceceaf8164745baa5a4a7c3c on my Raspberry Pi:

dmrconf detect --verbose
Debug in cli/autodetect.cc@40: Autodetect radios.
Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 28e9:18a in 2 ports.
Debug in lib/usbserial.cc@178: VID:PID 1106:3483 of ttyACM0 does not match.
Debug in lib/usbserial.cc@176: Cannot identify port ttyAMA0, no VID or PID.
Debug in lib/usbserial.cc@164: Search for serial port with matching VID:PID 1fc9:94 in 2 ports.
Debug in lib/usbserial.cc@178: VID:PID 1106:3483 of ttyACM0 does not match.
Debug in lib/usbserial.cc@176: Cannot identify port ttyAMA0, no VID or PID.
Debug in lib/hid_libusb.cc@128: Search for HID interfaces matching VID:PID 15a2:73.
Debug in lib/dfu_libusb.cc@156: Search for DFU devices matching VID:PID 483:df11.
ERROR in cli/autodetect.cc@44: No matching USB devices are found. Check connection?

What kind of config info would you need?

hmatuschek commented 1 year ago

I use the list of QSerialPortInfo instances to iterate over the present serial ports on all platforms. These objects provide the VID and PID for the device. I then check if they match. If so, I can (usually) be save to talk to a known radio and may request some information from the device. Some radios use generic USB CDC-ACM chips, these devices are marked as unsave e.g., https://github.com/hmatuschek/qdmr/blob/2e0cce66f06a040178dfc0ab310a393cd89c8122/lib/dr1801uv_interface.cc#L295 If a device is unsave, the user must verify the used port. However, I have not implemented means to specify the port and device beforehand, as it used to work reliably using the VID/PID,

hmatuschek commented 1 year ago

Maybe, it is not even a QSerialPort issue: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1539348

allesand commented 1 year ago

1106:3483 is also a USB 3.0 controller, is it? Hm, someone else had the same idea:

https://askubuntu.com/questions/343522/usb-to-serial-adapter-doesnt-works

Since the AnyTone has just that (USB-to-serial converter) and it is not detected correctly on a USB 3.0 port now, maybe try an USB 2.0 hub between PC and radio? In https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1539348 also XHCI (thus USB 3.0) is involved.

Yes, that would only be a workaround, but if USB 3.0 vs. USB 2.0 makes a difference, that's at least a reason why it works in most settings, but not in all?

hmatuschek commented 1 year ago

I don't believe, that this is the actual issue. In one of these bug reports, they describe, that the USB device re-connects as a different device and udev gets then confused. As this issue appears with a small firmware update on the radio, they might have done something similar. Maybe, the bootloader already initializes the USB interface and then, the firmware does it again, effectively reconnecting the device to the host. This, however, is just guessing around.

@DK8KK : Do you switch the radio on, while it is connected to the computer? (likely not)

However, this is something, I cannot fix in qdmr. I would therefore move this issue to the discussion.