Closed KB4MDD closed 11 months ago
After spending a great deal of time researching this issue, the increased time is the result of the call to usb_find_devices()
in res_usbradio. This function call takes around 1.5 seconds with each call.
This is a libusb function, as such, we have no control over the speed. The extra time could simply be related to this computer, having multiple radio adapters, the use of USB 3 ports, or this version of libusb.
The proposed change listed above does not work consistently. chan_simpleusb and chan_usbradio call the init routine in res_usbradio several times as it tries to associate with the usb device. It seems that some of that code could be optimized to reduce the number of calls.
The better solution seems to be to update lasthidtime
after calls to res_usbradio. I have changed the code to do this and I am getting consistent results.
I will propose a set of changes in a pull request.
Note: There are some slight differences between the hidthread in chan_simpleusb and chan_usbradio. I will investigate these changes as I review the code.
Note: I think we should consider moving from libusb 0.1 to libusb 1.0. We are using the old version of libusb - I don't know that the new one would make any difference, but the maintainers suggest that all new development use the 1.0 api. There is a compability package that allows the code to stay the same, but use libusb 1.0.
chan_simpleusb and chan_usbradio can report the message HID process has died or something!! in appropriately. I loaded Debian 12 on a Dell Wyse 5070. This machine has two radio adapters.
chan_simpleusb kept reporting that the HID process had died. After debugging, I determined that the hid thread took approximately 6 seconds to iterate and initialize the usb device.
The usbradio_read routine checks to see if the hid thread has updated its timer within the last 3 seconds. If 3 seconds has been exceeded, it posts the above message. It signals app_rpt to restart the affected node's thread. The process repeats over and over - due to the fact that the hid thread cannot get everything setup and initialized in time.
I proposed changing this timeout to a minimum of 9 seconds. This change will be in chan_simpleusb line 1787 and chan_usbradio line 1794.
I have not seen this problem on my Wyse 3040, but it is not running Debian 12. The Wyse 5070 has 4gb of memory and either an Intel® Pentium Silver J5005 (Quad Core 1.5GHz, up to 2.8GHz burst) or Intel® Celeron J4105 (Quad Core 1.5GHz, up to 2.5GHz burst.
The problem occurs event when one adapter is plugged into the system.