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";
};

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

Reply via email to