Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Apr 2022 13:51:47 -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:  <92f7b8ab463d057eea5490ff330e0ec955868efc.camel@farhan.codes>
In-Reply-To: <4f9a9bd7-28e4-99c7-6394-27368fafdbb1@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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2022-04-21 at 07:57 +0200, Hans Petter Selasky wrote:
> Hi,
> 
> 8) usbdump will answer this question.
> 
> I see some more bugs:
> 
>         [ATHN_RX_INTR] = {
>                 .type = UE_INTERRUPT,
>                 .endpoint = 0x83, // AR_PIPE_RX_INTR,
>                 .direction = UE_DIR_ANY,
>                               ^^^^ try to use UE_DIR_RX here, else
> you might 
> bind for TX!
> 
> And use UE_DIR_TX for TX. Ditto for the other transfers. Any change?
> 
> Second note, is that you should set some buffer size for the 
> non-interrupt endpoints, else the buffer size will only be 
> wMaxPacketSize bytes big!
> 
> --HPS

Hi Hans!

I did both, but there is no change in the behavior,

The usb_config is listed below. I got the bufsize's by running `lsusb`
on Linux, but it should be the same basic output from FreeBSD tools. A
link to my latest commit is here:
https://github.com/khanzf/freebsd/blob/30fe0bd7677f07fd290e4150ccec620b7b09d532/sys/dev/athn/usb/if_athn_usb.c#L249

Still not working :/

- Farhan

-----
static const struct usb_config athn_config_common[ATHN_N_TRANSFERS] = {
	[ATHN_TX_DATA] = {
		.type = UE_BULK,
		.endpoint = 0x01, // AR_PIPE_TX_DATA,
		.direction = UE_DIR_TX,
		.flags = {
			.short_xfer_ok = 1,
//			.force_short_xfer = 1,
			.pipe_bof = 1
		},
		.callback = athn_data_tx_callback,
		.bufsize = 0x200,
	},
	[ATHN_RX_DATA] = {
		.type = UE_BULK,
		.endpoint = 0x82, //AR_PIPE_RX_DATA,
		.direction = UE_DIR_RX,
		.flags = {
			.short_xfer_ok = 1,
//			.force_short_xfer = 1,
			.pipe_bof = 1
		},
		.callback = athn_data_rx_callback,
		.bufsize = 0x200,
	},
	[ATHN_RX_INTR] = {
		.type = UE_INTERRUPT,
		.endpoint = 0x83, // AR_PIPE_RX_INTR,
		.direction = UE_DIR_RX,
		.flags = {
			.short_xfer_ok = 1,
//			.force_short_xfer = 1,
			.pipe_bof = 1
		},
		.callback = athn_usb_intr,
		.bufsize = 0x40,
//		.callback = athn_intr_rx_callback,
	},
	[ATHN_TX_INTR] = {
		.type = UE_INTERRUPT,
		.endpoint = 0x04, //AR_PIPE_TX_INTR,
		.direction = UE_DIR_TX,
		.flags = {
			.short_xfer_ok = 1,
//			.force_short_xfer = 1,
			.pipe_bof = 1
		},
		.callback= athn_intr_tx_callback,
		.bufsize = 0x40,
	}
};

-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92f7b8ab463d057eea5490ff330e0ec955868efc.camel>