Re: Trouble loading firmware to USB device

From: Farhan Khan <>
Date: Fri, 29 Apr 2022 21:27:41 UTC
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


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 

- Farhan