Date: Tue, 01 Sep 2020 09:04:45 -0600 From: Ian Lepore <ian@freebsd.org> To: Willem Jan Withagen <wjw@digiware.nl>, Hans Petter Selasky <hps@selasky.org>, usb@freebsd.org Subject: Re: USB-dongle modem keeps changing from cuaU0 to cuaU1 and bck Message-ID: <16a7523227a32a4551f4459c06101f1ca0206e9b.camel@freebsd.org> In-Reply-To: <5a58c96d-81f5-cb7d-16c5-c28250aeed7f@digiware.nl> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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-( > > --WjW > 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. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16a7523227a32a4551f4459c06101f1ca0206e9b.camel>