Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2020 18:13:53 +0200
From:      Willem Jan Withagen <wjw@digiware.nl>
To:        Hans Petter Selasky <hps@selasky.org>, usb@freebsd.org
Subject:   Re: USB-dongle modem keeps changing from cuaU0 to cuaU1 and bck
Message-ID:  <1d601d61-e620-69b7-a051-4f75344e5cd4@digiware.nl>
In-Reply-To: <4007b388-4f62-bcfc-1003-0ad2f079c1d4@selasky.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>

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

Got it working, except ttyname replacement would not work....

Hence 2 cases.... to select the device.

smsd config now connects to /dev/sms-dongle

If the device is recreated/swapped, it takes the daemon a few tries to 
detect that the file-handle no longer works and to reopen it.
But thus far it gets it right every time.

--WjW

# ugen0.2: <HUAWEI Technologies HUAWEI Mobile> at usbus0, cfg=0 md=HOST 
spd=FULL (12Mbps) pwr=ON (500mA)
#
#   bLength = 0x0012
#   bDescriptorType = 0x0001
#   bcdUSB = 0x0110
#   bDeviceClass = 0x0000  <Probed by interface class>
#   bDeviceSubClass = 0x0000
#   bDeviceProtocol = 0x0000
#   bMaxPacketSize0 = 0x0040
#   idVendor = 0x12d1
#   idProduct = 0x1003
#   bcdDevice = 0x0000
#   iManufacturer = 0x0001  <HUAWEI Technologies>
#   iProduct = 0x0002  <HUAWEI Mobile>
#   iSerialNumber = 0x0000  <no string>
#   bNumConfigurations = 0x0001
#
#   ugen=ugen0.2 vendor=0x12d1 product=0x1003 ttyname=U1

attach 1001 {
         match "vendor"          "0x12d1";
         match "product"         "0x1003";
         match "ttyname"         "U0";
         action "ln -sf /dev/cuaU0.0 /dev/sms-dongle";
};
attach 1001 {
         match "vendor"          "0x12d1";
         match "product"         "0x1003";
         match "ttyname"         "U1";
         action "ln -sf /dev/cuaU1.0 /dev/sms-dongle";
};

notify 1001 {
         match "system"          "USB";
         match "subsystem"       "DEVICE";
         match "type"            "DETACH";
         match "vendor"          "0x12d1";
         match "product"         "0x1003";
         action "unlink /dev/sms-dongle";
};




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1d601d61-e620-69b7-a051-4f75344e5cd4>