summaryrefslogtreecommitdiff
path: root/host/ausb/ausb_test.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-11-18 23:04:21 +0100
committerHarald Welte <laforge@gnumonks.org>2010-11-18 23:04:21 +0100
commit012362ba7d742b9ae304b09453ba6d9a49dc9d0b (patch)
treeb0bf5fed8169785c9edac3d7c2163f0be995057e /host/ausb/ausb_test.c
parent629c4f81b89c41ffc2006b7af06ae734cdcbc864 (diff)
ausb: fix interrupt URB callback
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