From owner-freebsd-wireless@freebsd.org Fri Apr 12 17:12:20 2019 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3FA11581C0E for ; Fri, 12 Apr 2019 17:12:19 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 595C184073; Fri, 12 Apr 2019 17:12:19 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id C148116E62; Fri, 12 Apr 2019 17:12:18 +0000 (UTC) Date: Fri, 12 Apr 2019 17:12:18 +0000 From: Alexey Dokuchaev To: Adrian Chadd Cc: Matthias Apitz , "freebsd-wireless@freebsd.org" Subject: Re: Atheros AR5B22 WLAN+Bluetooth support on FreeBSD Message-ID: <20190412171218.GA16463@FreeBSD.org> References: <20190409160344.GA83271@FreeBSD.org> <20190410152250.GA37191@FreeBSD.org> <20190411092758.GA6899@FreeBSD.org> <20190411104647.GA3864@c720-r342378> <20190411125242.GA64046@FreeBSD.org> <20190411131328.GA4909@c720-r342378> <20190411131859.GA17806@FreeBSD.org> <20190411142350.GA71446@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190411142350.GA71446@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 595C184073 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; TAGGED_RCPT(0.00)[]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_SHORT(-0.93)[-0.927,0]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2019 17:12:20 -0000 On Thu, Apr 11, 2019 at 02:23:50PM +0000, Alexey Dokuchaev wrote: > On Thu, Apr 11, 2019 at 06:36:26AM -0700, Adrian Chadd wrote: > > I have a tool to upload firmware -- github.com/erikarn/ath3k. > > See if that helps! > > Something's wrong: > > $ git clone https://github.com/erikarn/ath3k.git > $ cd ath3k/src/usr.bin/ath3k > $ make > $ usbconfig list | grep 0x0930 > ugen2.2: at usbus2 <...> > $ ./ath3kfw -D -d ugen2.2 -I > ath3kfw: opening dev 2.2 > ath3k_get_state: libusb_control_transfer() failed: code=-4 > main: ath3k_get_state() failed! I've booted off Fedora 26 USB thumbdrive, to discover that everything works (dualband WiFi, BT, devices can be discovered), so the hardware is not faulty. I've converted Linux' drivers/bluetooth/ath3k.c to libusb to obtain rom_version and ref_clock of my card, so I know which firmware files I need (just in case): # ./a.out get_state -> 1, state = 0xce get_version -> 20, rom_version = 0x11020000, clock value = 40 I've then rebooted back into FreeBSD. Apparently, this AR3012 hardware if very fragile, it can be easily left in confused state and won't accept further commands, "usbconfig reset" does not help. To avoid this, it is better run ./ath3kfw as root, after powercycling machine (to reset the card). This got me further: ath3kfw: opening dev 2.2 main: state=0x0e ROM version: 285343744, build version: 155, ram version: 155, ref clock=1 ath3k_init_firmware: loading ath3k-1.fw ath3k_load_fwfile: file=/home/danfe/ath3k/share/firmware/ath3k/ath3k-1.fw, size=246804 ath3k_load_fwfile: transferring 20 bytes, offset 4096 LIBUSB_FUNCTION: libusb_bulk_transfer enter LIBUSB_FUNCTION: libusb_submit_transfer enter LIBUSB_FUNCTION: libusb_submit_transfer leave 0 LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter LIBUSB_FUNCTION: libusb10_handle_events_sub enter LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter LIBUSB_FUNCTION: libusb10_handle_events_sub enter LIBUSB_TRANSFER: sync I/O done LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit LIBUSB_FUNCTION: libusb_bulk_transfer leave ath3k_load_fwfile: transferring 4116 bytes, offset 4096 ... ath3k_load_fwfile: transferring 8212 bytes, offset 4096 ... ath3k_load_fwfile: transferring 12308 bytes, offset 4096 ... ... (numbers go 16404, 20500, 24596, 28692, 32788, 36884, 40980, 45076 ...) ... ath3k_load_fwfile: transferring 65556 bytes, offset 4096 LIBUSB_FUNCTION: libusb_bulk_transfer enter LIBUSB_FUNCTION: libusb_submit_transfer enter LIBUSB_FUNCTION: libusb_submit_transfer leave 0 LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter LIBUSB_FUNCTION: libusb10_handle_events_sub enter LIBUSB_TRANSFER: sync I/O done LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit LIBUSB_FUNCTION: libusb_bulk_transfer leave Can't load firmware: err=Timeout, size=4096 ath3k_load_fwfile: transferring 65556 bytes, offset 4096 After that, ``hccontrol inquiry'' stops working at all (says "operation timed out"), dmesg shows this: ubt0: ubt_ctrl_write_callback:782: control transfer failed: USB_ERR_TIMEOUT ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x1, OCF=0x1. Timeout ./danfe P.S. Fedora is amazing (just as Ubuntu) on this laptop: everything works, WMI multimedia keys, LCD brightness control, mic/speaker mute buttons, WiFi and Bluetooth. Under FreeBSD, only WiFi works from this list. :-(