On 1-9-2020 17:04, Ian Lepore wrote:
On Tue, 2020-09-01 at 16:23 +0200, Willem Jan Withagen wrote:
On 1-9-2020 16:10, Hans Petter Selasky wrote:
On 2020-09-01 15:54, Willem Jan Withagen wrote:
Could it be because the dongle itself crashes?
Yes, if they reboot or there are disturbances on the USB cables, then
a new index number may be assigned during re-enumeration.
There is no hub or something in between, and it is directly connected.
So I'm guessing that the modem resets/reboots.

Let's see if devd can help.

It does not happen very often, but now already twice on a day that it
should have worked.
8-(

A typical scenario when this problem happens is:
- cuaU0 is opened by an app.
  - Something Happens(tm) to make the device disconnect from the bus,
    but cuaU0 is still open by the app so the devfs node remains.
  - The transient problems clears, the bus is re-enumerated, but since
    cuaU0 is still in use by the app, cuaU1 gets assigned.
  - Eventually the app tries to read from cuaU0 and gets an error
    return from the read and closes the device, freeing cuaU0 in devfs.

If you use devd rules to assign a particular alias based on the
device's serial number or bus:hub:port tuples, the same underlying
problem is going to be there:  the app may still have the old device
open and hasn't yet noticed that it has disappeared.  If the way the
alias is assigned is to create a symlink, and that's done using ln -fs
then it may work out.  But there may be some need to have the devd rule
signal or kill/restart your app that's doing the monitoring.

Thanx for the full explanation of the cause. Nice suggestion to use in devd.
The problem is also in the smsd application....

You can specify several ports to start a sub process on. But if after a while that process cannot open a port and get the modem initialized, it terminates. So it will not see
a modem appearing on the new/changed port.

The process that caught the correct port at start, will try about 10 times when the modem has gone, and thenĀ  close/open the port again to see if anything is out there. So creating a alias filename that is stable, and fixes the underlying redirection will
also work.
Restarting the daemon will work if all possible port gets a configuration, the process
will stick onto the available port.

--WjW
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[email protected]"

Reply via email to