Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2022 17:27:41 -0400
From:      Farhan Khan <farhan@farhan.codes>
To:        freebsd-usb@freebsd.org, Hans Petter Selasky <hps@selasky.org>
Subject:   Re: Trouble loading firmware to USB device
Message-ID:  <8063463.T7Z3S40VBb@fedora>
In-Reply-To: <3b8991a9-4a28-df54-e7c0-921de6ad707e@selasky.org>
References:  <f47b9415c262267d5c2505463b54f58ceaf76315.camel@farhan.codes> <1901464.PYKUYFuaPT@fedora> <3b8991a9-4a28-df54-e7c0-921de6ad707e@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, April 28, 2022 2:06:57 AM EDT Hans Petter Selasky wrote:
> On 4/28/22 07:53, Farhan Khan wrote:
> >> printf("FRAME LENGTH = %d\n", usbd_xfer_max_len(xfer));
> > 
> > 64 bytes, sounds correct.
> 
> And do you get a completion on that USB transfer?
> 
> If no, then look at the firmware loading sequence.
> 
> --HPS

Works!

I used Wireshark on the hypervisor to compare the actual USB packets on 
OpenBSD and FreeBSD. Turns out, I had a constant in a macro wrong.

I was using AR9271_FIRMWARE rather than AR9271_FIRMWARE_TEXT. I did not see 
that because visually the names were close. The moment I made that adjustment, 
loading the firmware worked!

One thing I noticed between the OpenBSD and FreeBSD side: You recommended that 
I do an initial "wakeup" usbd_transfer_start(). The OpenBSD side seems to have 
an equivalent for the RX Interrupt pipe, but not the Rx Data pipe - at least 
not where I am in the code so far. I'm still not clear on why this is 
necessary or what this does.

Thank you for working through this with me. It was necessary for me to 
eliminate those problems and also get a better idea of what was happening. I 
also learned a lot of concepts along the way that will be necessary going 
forward.

- Farhan






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