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

Detect radio and first view #39

Closed OH1KH closed 3 years ago

OH1KH commented 3 years ago

There are some problems in radio detecting (at least with OpenGD77).

My usb rules have option that makes symlink /dev/OpenGD77. Doing ls /dev I can see that connecting the radio does the symlink. Qdmr how ever says often no radio found:

[saku@hamtpad ~]$ qdmr Debug in /home/saku/qdmr/lib/repeaterdatabase.cc@96: Loaded repeater database with 3807 entries from /home/saku/.local/share/DM3MAT/qdmr/repeater.json. Debug in /home/saku/qdmr/lib/userdatabase.cc@115: Loaded user database with 183787 entries from /home/saku/.local/share/DM3MAT/qdmr/user.json. Debug in /home/saku/qdmr/src/application.cc@62: Last known position: 61° 32' 30.0" N, 21° 35' 0.0" E Debug in /home/saku/qdmr/lib/dfu_libusb.cc@38: Try to detect USB DFU interface 483:df11. Debug in /home/saku/qdmr/lib/hid_libusb.cc@11: Try to detect USB HID interface 15a2:73. Debug in /home/saku/qdmr/lib/usbserial.cc@8: Try to detect USB serial interface 1fc9:94. Debug in /home/saku/qdmr/lib/usbserial.cc@16: Found serial port 1fc9:94: ttyACM0 'MCU VIRTUAL COM DEMO'. Debug in /home/saku/qdmr/lib/usbserial.cc@23: Cannot open serial port 'ttyACM0': Laite tai resurssi varattu Debug in /home/saku/qdmr/lib/usbserial.cc@37: Openend serial port ttyACM0 with 9600baud. Debug in /home/saku/qdmr/lib/usbserial.cc@8: Try to detect USB serial interface 28e9:18a. QCoreApplication::postEvent: Unexpected null receiver Debug in /home/saku/qdmr/lib/dfu_libusb.cc@38: Try to detect USB DFU interface 483:df11. Debug in /home/saku/qdmr/lib/hid_libusb.cc@11: Try to detect USB HID interface 15a2:73. Debug in /home/saku/qdmr/lib/usbserial.cc@8: Try to detect USB serial interface 1fc9:94. Debug in /home/saku/qdmr/lib/usbserial.cc@16: Found serial port 1fc9:94: ttyACM0 'MCU VIRTUAL COM DEMO'. Debug in /home/saku/qdmr/lib/usbserial.cc@23: Cannot open serial port 'ttyACM0': Laite tai resurssi varattu Debug in /home/saku/qdmr/lib/usbserial.cc@37: Openend serial port ttyACM0 with 9600baud. Debug in /home/saku/qdmr/lib/usbserial.cc@8: Try to detect USB serial interface 28e9:18a. QCoreApplication::postEvent: Unexpected null receiver Debug in /home/saku/qdmr/lib/dfu_libusb.cc@38: Try to detect USB DFU interface 483:df11. Debug in /home/saku/qdmr/lib/hid_libusb.cc@11: Try to detect USB HID interface 15a2:73. Debug in /home/saku/qdmr/lib/usbserial.cc@8: Try to detect USB serial interface 1fc9:94. Debug in /home/saku/qdmr/lib/usbserial.cc@16: Found serial port 1fc9:94: ttyACM0 'MCU VIRTUAL COM DEMO'. Debug in /home/saku/qdmr/lib/usbserial.cc@37: Openend serial port ttyACM0 with 9600baud. Debug in /home/saku/qdmr/lib/usbserial.cc@72: Serial port will close now. Debug in /home/saku/qdmr/lib/radio.cc@296: Found Radio: OpenGD77

Translate: Laite tai resurssi varattu = Device or resource reserved

As far as I know nothing reserves the ttyACM0 device. Sometimes it needs several startups of qrmd and even plug off/on the physical device OpenGD77. So far I have not managed to find proper way to do things so that qdmr would always find radio.

Perhaps some delays to detect/open the port ? Perhaps a setting where user can define the used port to avoid detection routine? (Either with real name (ttyACM0) or symlinked name)

When radio is defined and qdmr opens the fist view has checkboxes "Speech Synthesis" and "Upload User database".

"Speech Synthesis" is mentioned in help, but at least with OpenGD77 has also speech file to upload. That section to define the file is missing. "Upload User database" is not mentioned (at least in this form) in help file. What is it for? I guess it could be a list of private calls/names to store. Am I wrong?

hmatuschek commented 3 years ago

The serial port is found using the Qt library. They have a nice way to iterate over all ports and even provide the USB vid/pid for each port. This allows me to find the correct port without any user interaction (the way it should be).

https://github.com/hmatuschek/qdmr/blob/2c4b31aa74ed14b5c74202eafc42901ca425f076/lib/usbserial.cc#L11-L29

I am not sure if the symlink is the actual culprit here. If the error message is "resource reserved", I guess another process is accessing the device. A symlink is just another name for the same device file, it should not open it. Maybe there is a problem with something like the modem manager. I have a line added to my rules for the Anytone AT-D878UV, although I never got any issues opening serial ports

https://github.com/hmatuschek/qdmr/blob/2c4b31aa74ed14b5c74202eafc42901ca425f076/dist/99-qdmr.rules#L7-L9

I could add a line for the OpenGD77 too, like

ATTRS{idVendor}=="1fc9" ATTRS{idProduct}=="0094", ENV{ID_MM_DEVICE_IGNORE}="1" [, OPTIONAL SYMLINK HERE]
hmatuschek commented 3 years ago

Concerning the speech synthesis: Some devices support this out of the box for example the GD77S (no display), GD77 and UV390. It is usually activated by setting a single flag in the general config section of the code-plug. I have not found the corresponding bit in the GD77 code-plug yet, hence the option has no effect for the GD77 and OpenGD77. If I need to upload a speech file to the radio, to get it working for the OpenGD77 firmware, I may not be able to support it. I want to keep the GUI as simple and general as possible. In the end, qdmr aims at being a "universal" CPS for all supported radios. This means, that I may have to skip some device-specific features if they do not "fit" into the general config scheme.

Concerning the UserDB: The user database (also sometimes called callsign database) differs from the contacts lists. It is just a list of DMR IDs with some additional information like callsign, name, country, etc. It is used by the radio to display the callsign and name instead of the DMR ID, when a call is ongoing. OpenGD77 supports a user db, but I have not implemented it in qdmr yet (see issue #15). Once it is implemented, it will use the downloaded global DMR ID table (mentioned in the first lines of the log above) to fill that user db. It selects the entries based on your DMR ID. DMR IDs are assembled hierarchically. For example my ID 2621370: The first 2 means Europe, 262 means Germany, 2621 means the states Berlin & Brandenburg. Only the last part 370 is my personal number. The rest is determined by my geographical location. Hence, qdmr selects the DMR IDs to program into the radio (they usually cannot hold the complete list) by selecting the entries closest to me. I should, however, document this in the user manual and provide some tool-tips etc in the GUI.

OH1KH commented 3 years ago

It might be that adding udev rule helped but I can not be sure as sometimes rig is found fast. At first try (without udev rule added) it took 4 tries and about 20-30sec. After adding rule rig was found immediately. But it might be because it was found once before (closed qdmr and unplug/replug rig, but anyway...). Time will show how it finds it tomorrow after closing PC for night.

I'm not sure about speech myself either. It is not clearly documented in OpenGD77 (or I cannot find that). That is no critical thing. BTW addition of firmware uploader would be nice. Now there exist python scripts for OpenGD77 firmware uploads with Linux. Windoze users can do it via CPS editor.

Help looks now lot better when it is divided into parts.

Thanks! I close this issue for now.