From owner-freebsd-current@freebsd.org Fri Aug 16 09:07:25 2019 Return-Path: Delivered-To: freebsd-current@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 2D9F4C589E for ; Fri, 16 Aug 2019 09:07:25 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 468yBh3Lqgz403b for ; Fri, 16 Aug 2019 09:07:24 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: by mailman.nyi.freebsd.org (Postfix) id 73023C589D; Fri, 16 Aug 2019 09:07:24 +0000 (UTC) Delivered-To: current@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 72C2CC589B for ; Fri, 16 Aug 2019 09:07:24 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 468yBg09yKz403Z for ; Fri, 16 Aug 2019 09:07:22 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 966521AF112 for ; Fri, 16 Aug 2019 09:07:13 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id x7G97DGH005370 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Fri, 16 Aug 2019 09:07:13 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id x7G97Dpc005369; Fri, 16 Aug 2019 09:07:13 GMT (envelope-from phk) To: current@freebsd.org Subject: Huawei mobile/wifi gadgets: HOWTO From: Poul-Henning Kamp MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5367.1565946433.1@critter.freebsd.dk> Date: Fri, 16 Aug 2019 09:07:13 +0000 Message-ID: <5368.1565946433@critter.freebsd.dk> X-Rspamd-Queue-Id: 468yBg09yKz403Z X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-2.30 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.983,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[current@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.99)[-0.989,0]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[freebsd.dk]; NEURAL_HAM_SHORT(-0.39)[-0.387,0]; IP_SCORE(0.06)[ip: (0.09), ipnet: 130.225.0.0/16(0.09), asn: 1835(0.13), country: EU(-0.00)]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2019 09:07:25 -0000 This seems to be sort of a FAQ, and I had a chance to spend a couple of quality minutes with one of these devices. The fundamental problem is that they come up as a CD device, with Windows software to do whatever it takes. Sending them a magic USB command enables other interfaces, including serial/modem, USB ethernet etc. The remaining issue is: How to get FreeBSD do send the magic string? A file in /etc/devd along these lines will do it: notify 1000 { match "system" "GEOM"; match "type" "CREATE"; match "cdev" "iso9660/MOBILEWIFI"; action "/usr/local/sbin/usb_modeswitch -v 0x12d1 -p 0x15ca -J"; }; It works by reacting to the CD device appearing, which seems to be a sure-fire indication that the device is in wrong mode. You may have to adjust the precise "cdev" name (ls /dev/iso9660) and vendor/product numbers (usbconfig dump_device_desc), and obviously you have to install the usb_modeswitch port. The -J argument seems to be what all newer Huawei devices want. Add ifconfig_ue0=DHCP in /etc/rc.conf, and you should be set. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.