Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2019 17:12:18 +0000
From:      Alexey Dokuchaev <danfe@freebsd.org>
To:        Adrian Chadd <adrian.chadd@gmail.com>
Cc:        Matthias Apitz <guru@unixarea.de>, "freebsd-wireless@freebsd.org" <freebsd-wireless@freebsd.org>
Subject:   Re: Atheros AR5B22 WLAN+Bluetooth support on FreeBSD
Message-ID:  <20190412171218.GA16463@FreeBSD.org>
In-Reply-To: <20190411142350.GA71446@FreeBSD.org>
References:  <CAJ-VmommKkeioPDEF%2BCiT9k-3pNZa39ELJsuU8C1hHZ9%2BsvRtA@mail.gmail.com> <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> <CAJ-VmokDt0Ss9awPwAf-pk8=s6XqGJyBbfYTAg1BHrVM06HeGQ@mail.gmail.com> <20190411142350.GA71446@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <vendor 0x0930 product 0x021c> 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. :-(



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190412171218.GA16463>