summaryrefslogtreecommitdiff
path: root/host/ausb/ausb_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'host/ausb/ausb_test.c')
-rw-r--r--host/ausb/ausb_test.c16
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)) {
personal git repositories of Harald Welte. Your mileage may vary