From owner-freebsd-usb@freebsd.org Tue Sep 1 16:14:00 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64C853CDA48 for ; Tue, 1 Sep 2020 16:14:00 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4BgsZc1VjDz3X8g for ; Tue, 1 Sep 2020 16:14:00 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: by mailman.nyi.freebsd.org (Postfix) id 337983CDA46; Tue, 1 Sep 2020 16:14:00 +0000 (UTC) Delivered-To: usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 334353CD6F4 for ; Tue, 1 Sep 2020 16:14:00 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router10G.digiware.nl (smtp.digiware.nl [176.74.240.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BgsZb24fVz3XKl for ; Tue, 1 Sep 2020 16:13:58 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router10g.digiware.nl (localhost.digiware.nl [127.0.0.1]) by router10G.digiware.nl (Postfix) with ESMTP id 963D469C46; Tue, 1 Sep 2020 18:13:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at digiware.com Received: from router10G.digiware.nl ([127.0.0.1]) by router10g.digiware.nl (router10g.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4cYxtlpCipjl; Tue, 1 Sep 2020 18:13:55 +0200 (CEST) Received: from [192.168.10.67] (opteron [192.168.10.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by router10G.digiware.nl (Postfix) with ESMTPSA id D87B169C45; Tue, 1 Sep 2020 18:13:55 +0200 (CEST) Subject: Re: USB-dongle modem keeps changing from cuaU0 to cuaU1 and bck To: Hans Petter Selasky , usb@freebsd.org References: <8ffb4077-b0cb-ed0c-bd86-9fa164ae140d@digiware.nl> <4007b388-4f62-bcfc-1003-0ad2f079c1d4@selasky.org> From: Willem Jan Withagen Message-ID: <1d601d61-e620-69b7-a051-4f75344e5cd4@digiware.nl> Date: Tue, 1 Sep 2020 18:13:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <4007b388-4f62-bcfc-1003-0ad2f079c1d4@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: nl X-Rspamd-Queue-Id: 4BgsZb24fVz3XKl X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of wjw@digiware.nl designates 176.74.240.9 as permitted sender) smtp.mailfrom=wjw@digiware.nl X-Spamd-Result: default: False [-1.72 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.04)[-1.043]; MIME_GOOD(-0.10)[text/plain]; HFILTER_HELO_IP_A(1.00)[router10g.digiware.nl]; HFILTER_HELO_NORES_A_OR_MX(0.30)[router10g.digiware.nl]; DMARC_NA(0.00)[digiware.nl]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.55)[-0.550]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-1.03)[-1.032]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:28878, ipnet:176.74.224.0/19, country:NL]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[usb]; RCVD_IN_DNSWL_LOW(-0.10)[176.74.240.9:from] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2020 16:14:00 -0000 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: at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA) # #   bLength = 0x0012 #   bDescriptorType = 0x0001 #   bcdUSB = 0x0110 #   bDeviceClass = 0x0000  #   bDeviceSubClass = 0x0000 #   bDeviceProtocol = 0x0000 #   bMaxPacketSize0 = 0x0040 #   idVendor = 0x12d1 #   idProduct = 0x1003 #   bcdDevice = 0x0000 #   iManufacturer = 0x0001  #   iProduct = 0x0002  #   iSerialNumber = 0x0000  #   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"; };