Trouble loading firmware to USB device
- Reply: Hans Petter Selasky : "Re: Trouble loading firmware to USB device"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 12 Apr 2022 22:10:02 UTC
Hi all, I am trying to load the copy the OpenBSD athn code. Currently I am trying to load the firmware of the device but running an issue where the interrupt RX callback is getting an USB_ERR_CANCELLED event. Based on my reading of the OpenBSD code, it appears that the OpenBSD driver will load the firmware in chunks, then submit a NULL (size 0) usbd_do_request to indicate completion of the firmware. At this, the driver will tsleep() for 1 second. If it breaks with a return value of 0, the driver will continue successfully. My understanding is that this should trigger an Rx Interrupt, which should run the wakup() that the tsleep() is looking for. However, in my case the USB_ST_SETUP condition is run, but it seems to block indefinitely. Meanwhile, the tsleep() expires, returns a EWOULDBLOCK and eventually runs the detach handler. As a result, the blocking callback receives a USB_ST_ERROR with the value USB_ERR_CANCELLED. What might be causing the blocking of the callback? Am I loading the firmware incorrectly? My firmware code is here: https://github.com/khanzf/freebsd/blob/ar9271-check/sys/dev/athn/usb/if_athn_usb.c#L934 The interrupt handler, athn_usb_intr, is line 2405. The OpenBSD equivalent of the firmware loader is this: https://github.com/openbsd/src/blob/master/sys/dev/usb/if_athn_usb.c#L642 The interrupt handler is also athn_usb_intr online 1874. Any assistance would be great, been stuck for a few weeks :/ -- Farhan Khan PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE