Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2020 10:22:15 +0200
From:      Willem Jan Withagen <wjw@digiware.nl>
To:        Ian Lepore <ian@freebsd.org>, Hans Petter Selasky <hps@selasky.org>, usb@freebsd.org
Subject:   Re: USB-dongle modem keeps changing from cuaU0 to cuaU1 and bck
Message-ID:  <e20854cf-17ff-73a6-e07e-6dad96249861@digiware.nl>
In-Reply-To: <16a7523227a32a4551f4459c06101f1ca0206e9b.camel@freebsd.org>
References:  <b2ca03d3-1f57-2275-3ae6-0df100ac4c1c@digiware.nl> <ace88f94-953a-3060-aefd-4b21f5a793d8@selasky.org> <8ffb4077-b0cb-ed0c-bd86-9fa164ae140d@digiware.nl> <4007b388-4f62-bcfc-1003-0ad2f079c1d4@selasky.org> <5a58c96d-81f5-cb7d-16c5-c28250aeed7f@digiware.nl> <16a7523227a32a4551f4459c06101f1ca0206e9b.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e20854cf-17ff-73a6-e07e-6dad96249861>