Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2022 09:41:27 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Farhan Khan <farhan@farhan.codes>, freebsd-usb@freebsd.org
Subject:   Re: Trouble loading firmware to USB device
Message-ID:  <05b3c211-2b77-7e59-a9da-d28a21d5b389@selasky.org>
In-Reply-To: <9ca0e355-d780-f9c0-4d38-b99662f43edd@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> <6fd2d680bf9edd969476f4544314235538c7fe41.camel@farhan.codes> <4f9a9bd7-28e4-99c7-6394-27368fafdbb1@selasky.org> <92f7b8ab463d057eea5490ff330e0ec955868efc.camel@farhan.codes> <d6157001-deaa-fed9-a8b0-cb46cc969206@selasky.org> <7abdf40246e7f60d129b8e02451445d1f3a75883.camel@farhan.codes> <7fc346b1-b70d-8e29-860d-5ed0988a7838@selasky.org> <ded0b21703604f8ef25897c4e8891b81bc8f19ef.camel@farhan.codes> <d5b1925e-18b0-e1d7-c5c4-b4b0d3247b27@selasky.org> <9ca0e355-d780-f9c0-4d38-b99662f43edd@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?05b3c211-2b77-7e59-a9da-d28a21d5b389>