summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2008-03-10 11:32:15 +0000
committerDaniel Drake <dsd@gentoo.org>2008-03-10 11:32:15 +0000
commitaae05f688dc26a013166ab9436fd25018b49d76a (patch)
tree0c73a44d55804a64642436fa9551ff17d8247ca7 /examples
parent7c5ea95297c2f3f6afc42f60c1bf1bef777bb1fb (diff)
downloadlibusb-aae05f688dc26a013166ab9436fd25018b49d76a.tar.gz
Simplify libusb_fill_control_transfer()
Transfer length can be inferred from the setup packet.
Diffstat (limited to 'examples')
-rw-r--r--examples/dpfp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/dpfp.c b/examples/dpfp.c
index a5151f2..c56e8d8 100644
--- a/examples/dpfp.c
+++ b/examples/dpfp.c
@@ -168,8 +168,7 @@ static void cb_mode_changed(struct libusb_transfer *transfer)
static int set_mode_async(unsigned char data)
{
- int bufsize = LIBUSB_CONTROL_SETUP_SIZE + 1;
- unsigned char *buf = malloc(bufsize);
+ unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
struct libusb_transfer *transfer;
if (!buf)
@@ -184,8 +183,8 @@ static int set_mode_async(unsigned char data)
printf("async set mode %02x\n", data);
libusb_fill_control_setup(buf, CTRL_OUT, USB_RQ, 0x4e, 0, 1);
buf[LIBUSB_CONTROL_SETUP_SIZE] = data;
- libusb_fill_control_transfer(transfer, devh, buf, bufsize,
- cb_mode_changed, NULL, 1000);
+ libusb_fill_control_transfer(transfer, devh, buf, cb_mode_changed, NULL,
+ 1000);
return libusb_submit_transfer(transfer);
}