Interrupt-out with Interrupt-in and libusb1.0

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
daniel_s

Interrupt-out with Interrupt-in and libusb1.0

Post by daniel_s » Sun Jan 03, 2010 4:21 pm

Hi -

The project I'm working on needs both interrupt-in and interrupt-out transfers at the same time, and I'm using libusb 1.0 at the host end, latest vusb at the driver end.

I've got control transfers working ok, and interrupt-in, but now I'm trying to get the host to send interrupt-out packets to the device, it doesn't work.

I've done the following:

USB_CFG_HAVE_INTRIN_ENDPOINT3 = 0
USB_CFG_IMPLEMENT_FN_WRITEOUT = 1
I've implemented a usbFunctionWriteOut() method

At the libusb end:

Code: Select all

int send=(buf->size)>8?8:(buf->size);
result = libusb_interrupt_transfer(h, (1 | LIBUSB_ENDPOINT_OUT), buf->buffer, send , &transferred, TIMEOUT);


When I send a couple of characters to the endpoint I get error -5 which is LIBUSB_ERROR_NOT_FOUND

I suspect that the issue is that the endpoint doesn't exist or I'm addressing it wrong. Can anyone help me with what I'm doing wrong - have I missunderstood how to address the interrupt-out endpoint?

Another related question - is an interrupt-in and an interrupt-out endpoint two endpoints or one? The host software reports that configuration as having 1 endpoint (apart from control) so does this mean I'm missing an endpoint?

I've looked for example of interrupt-out endpoints and cannot find any.

Thanks!

Daniel

daniel_s

Re: Interrupt-out with Interrupt-in and libusb1.0

Post by daniel_s » Sun Jan 03, 2010 5:38 pm

Sorry for replying to my own post, but I've managed to get it working (or at least, got past the current issue). What I didn't realise was that to use interrupt-out endpoints you need to create a custom config descriptor to describe the out endpoint. Once I did this its working a lot better.

Daniel

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Interrupt-out with Interrupt-in and libusb1.0

Post by christian » Thu Jan 07, 2010 12:25 pm

Yes. For every non-trivial configuration, you need to create your own descriptor. And in order to use more than just control transfers on endpoint 0, you must set a configuration and interface with libusb.

Post Reply