/* USB::DevHandle#usb_bulk_read(endpoint, bytes, timeout) */
static VALUE
rusb_bulk_read(
VALUE v,
VALUE vep,
VALUE vbytes,
VALUE vtimeout)
{
usb_dev_handle *p = get_usb_devhandle(v);
int ep = NUM2INT(vep);
int timeout = NUM2INT(vtimeout);
char *bytes;
int size;
int ret;
StringValue(vbytes);
rb_str_modify(vbytes);
bytes = RSTRING_PTR(vbytes);
size = RSTRING_LEN(vbytes);
ret = usb_bulk_read(p, ep, bytes, size, timeout);
check_usb_error("usb_bulk_read", ret);
return INT2NUM(ret);
}