Re: Trouble loading firmware to USB device

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Wed, 27 Apr 2022 07:41:27 UTC
On 4/25/22 10:21, Hans Petter Selasky wrote:
> 
>>  status 0xeb023 
>> <OPEN|TRANSFERRING|STARTED|SHORT_XFER_OK|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0> 
>>
>> 12:25:07.785438 usbus3.3 
>> SUBM-INTR-EP=00000083,SPD=HIGH,NFR=1,SLEN=0,IVAL=1
>>  frame[0] READ 1024 bytes
>>  flags 0xa <SHORT_XFER_OK|PIPE_BOF|0>
> 
> You are asking for 1024 bytes. Try asking for only 64 bytes instead, 
> same as one wMaxPacket, before submitting the job.

Hi Farhan,

> So my question is, where am I reading 1024 bytes, such that I need to change 
> it to 64?

Somewhere in the code you are asking for a read of 1024 bytes on the 
interrupt endpoint. That is what usbdump says. That means multiple 
packets will have to be received for it to complete. I'm not sure 
exactly where the problem is, but can you add a print here:

> 	case USB_ST_SETUP:
> 		printf("====USB_ST_SETUP       athn_usb_intr\n");
> 		usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));

printf("FRAME LENGTH = %d\n", usbd_xfer_max_len(xfer));

> 		usbd_transfer_submit(xfer);

Also make sure there is only one instance of your .ko in /boot/kernel or 
/boot/modules, that you are not loading an old version of the built .ko.

--HPS