From 1e04258b8d88b180a1e9d0507373bd1bcdba4935 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 18 Nov 2010 23:04:21 +0100 Subject: ausb: fix interrupt URB callback --- host/ausb/ausb_test.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'host/ausb') diff --git a/host/ausb/ausb_test.c b/host/ausb/ausb_test.c index db4f0ab..e8493bb 100644 --- a/host/ausb/ausb_test.c +++ b/host/ausb/ausb_test.c @@ -29,16 +29,26 @@ static struct usb_device *find_cj_usbdev(int num) return NULL; } -static void int_cb(struct usbdevfs_urb *uurb) +static void int_cb(struct usbdevfs_urb *uurb, void *data) { struct ausb_dev_handle *ah = uurb->usercontext; + unsigned char *buffer = uurb->buffer; + int i; fprintf(stdout, "int_cb() called, "); ausb_dump_urb(uurb); - if (ausb_submit_urb(ah, uurb)) + for (i = 0; i < uurb->actual_length; i++) + printf("%02x ", buffer[i]); + + if (ausb_submit_urb(ah, uurb)) { fprintf(stderr, "unable to resubmit urb\n"); + ausb_close(ah); + exit(1); + } + + fflush(stdout); } int main(int argc, char **argv) @@ -76,6 +86,8 @@ int main(int argc, char **argv) exit(1); } + ausb_register_callback(ah, USBDEVFS_URB_TYPE_INTERRUPT, &int_cb, ah); + #if 1 ausb_fill_int_urb(uurb, 0x81, buffer, sizeof(buffer)); if (ausb_submit_urb(ah, uurb)) { -- cgit v1.2.3