SimpleUSB - device selected, associated USB device not found

Hello,

I have a puzzling problem, for which a workaround has been found, but would like to understand the reason for the issue and a permanent fix.

I have a Shari PI3U running on a Lenovo M73 tiny computer. Works great, except for one little issue that was never encountered when the Shari was running on a Raspberry Pi. When powering up the computer, an error is encountered that a device has been selected, but the associated USB device not found. A work around was found at USB Device String not found. The solution works. If the text following devstr = is deleted in the simpleusb.conf file, and asterisk is restarted, the radio comes to life.

Looking for a permanent, proper solution to this. I created a systemd service which replaces the simpleusb.conf file with a clean copy at bootup, which works fine, but wondering about a real fix.

Any thoughts?

Regards,

Doug VE3XDB

So you're hitting an interesting problem with a subset of hardware we've seen where the Linux kernel seems to initialize USB hubs in random order. This makes the USB devstr field change potentially on every boot. What you're doing at boot time at the moment is probably the best solution to the problem. With the planned ASLA-based driver we're hoping to avoid this problem but using the current OSS kernel interface, the possibilities to make this "better" are limited at present.

Thank you for responding so quickly. By the way, if others are having difficulty, here is how I set up the systemd service.

Step 1. Edit simpleusb.conf, removing any text following devstr = Save the file as simpleusb.bak in /etc/asterisk

Step 2. Create the following bash script, and save it as /usr/local/bin/update_simpleusb.sh:

#!/bin/bash
cd /etc/asterisk || exit
cp simpleusb.bak simpleusb.conf

Step 3: Make the script executable.

   sudo chmod +x /usr/local/bin/update_simpleusb.sh

Step 4: Create the systemd service

To run the script at boot, you can create a systemd service. Create a new service file:

sudo nano /etc/systemd/system/update_simpleusb.service

Add the following content to the service file:

ini

[Unit]
Description=Update SimpleUSB Configuration

[Service]
Type=oneshot
ExecStart=/usr/local/bin/update_simpleusb.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Save the file as update_simpleusb.service

Step 5: Enable the service
To ensure the service runs at boot, enable it with the following command:

sudo systemctl enable update_simpleusb.service

Step 6: Reboot and Test
Reboot the system to test if the script runs at startup:

sudo reboot

After the system reboots, the script should execute automatically, changing to the /etc/asterisk directory and copying simpleusb.bak to simpleusb.conf without any prompts. You can check the status of the service to ensure it ran successfully:

sudo systemctl status update_simpleusb.service

This will show you the output and any errors if they occurred.

Hope this is helpful.

Regards,

Doug VE3XDB

I would suggest the following changes for this:

[Unit]
Description=Update SimpleUSB Configuration
Before=asterisk.service allmon3.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/update_simpleusb.sh
RemainAfterExit=no

[Install]
WantedBy=multi-user.target

You want this to run before asterisk.service and allmon3.service. Also since this terminates properly after its oneshot run successfully, having RemainAfterExit=yes is inappropriate for systemd.

Also, have you considered doing an inline edit rather than copying around a file? if you're always copying a file back into place, you're breaking the ability to reasonably use simpleusb-tune-menu or the susb command in Asterisk. You could do it in a one-liner like this:

sed -E 's/devstr=[^[:space:]]*/devstr=/g' /etc/asterisk/simpleusb.conf

Thanks for the suggestions! I like your approach because it doesn't mess with the simpleusb.conf file. I was trying to do what you suggested, but gave up and took the lazy approach. Thank you!

It didn't work, but spent some time trouble shooting, and found a spacing error in the sed command I was using. This one worked:

sudo sed -i.bak 's/^devstr *=.*/devstr =/' simpleusb.conf