diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-11-18 23:04:21 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-11-18 23:08:29 +0100 |
commit | 1e04258b8d88b180a1e9d0507373bd1bcdba4935 (patch) | |
tree | f7a545e0f9eb110867e39c69a7bf73ec451daa18 | |
parent | 6506db78c1bc2d907cbdbe3560312a1b620afd16 (diff) |
ausb: fix interrupt URB callback
-rw-r--r-- | host/ausb/ausb_test.c | 16 |
1 files changed, 14 insertions, 2 deletions
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)) { |