Date: Thu, 21 Apr 2022 00:18:50 -0400 From: Farhan Khan <farhan@farhan.codes> To: Hans Petter Selasky <hps@selasky.org>, freebsd-usb@freebsd.org Subject: Re: Trouble loading firmware to USB device Message-ID: <6fd2d680bf9edd969476f4544314235538c7fe41.camel@farhan.codes> In-Reply-To: <d2253b56-3174-ae31-078c-ba43bb3c7fc2@selasky.org> References: <f47b9415c262267d5c2505463b54f58ceaf76315.camel@farhan.codes> <d27787a2-eb6b-25dc-2d0d-56af4184032b@selasky.org> <9315bf6d-b9a9-89a2-9a32-aca9fd9cc015@farhan.codes> <dfc1cd8a-75a9-6637-e721-83d134910185@selasky.org> <007551144c601a21e2ec8133a8359323de29725f.camel@farhan.codes> <d2253b56-3174-ae31-078c-ba43bb3c7fc2@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2022-04-20 at 20:37 +0200, Hans Petter Selasky wrote: > > Hi, > > It appears you've programmed the interrupt endpoint to only receive > one > USB packet, because there is no /* FALLTHROUGH */, but a "break;" > statement instead! > > > break; > > case USB_ST_SETUP: > > Maybe if you change that, it will work. > > --HPS Hi! I removed that break and the issue remains. I would not expect this to make a difference because the USB_ST_SETUP condition is below the USB_ST_TRANSFERRED condition and the USB_ST_TRANSFERRED condition is never called. Since I am only getting USB_ST_SETUP calls, USB_ST_TRANSFERRED's fallthrough never happens anyways. The timeline of events is this: ---- 1. athn_data_rx_callback called via usbd_transfer_start() when pipes are opened, with USB_ST_SETUP condition - no USB_ST_TRANSFERRED occurs 2. athn_usb_intr callback called via usbd_transfer_start(), also when pipes are opened. This creates a USB_ST_SETUP condition, but no USB_ST_TRANSFFERRED condition. 3. Loading firmware content via usbd_do_request_flags() 4. Sending final usbd_do_request() with length of 0. 5. msleep() called, times out with EWOUDLBLOCK condition. This should be woke up by wakeup(9), which would happen if athn_usb_intr with the USB_ST_TRANSFERRED condition happened, but it does not. 6. Firmware loading failure due to timeout. 7. Driver unloaded 8. athn_usb_intr called with USB_ST_ERROR/USB_ST_CANCELLED (Why?) ---- Between steps 4 and 5, I am expecting athn_usb_intr to be called with the USB_ST_TRANSFERRED condition which will eventually execute wakeup(9). However, this is never called and I have not been able to determine why. Do I need to run a callback manually? If how do I msleep() and make the call at the same time? Still stuck :/ - Farhan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6fd2d680bf9edd969476f4544314235538c7fe41.camel>