/* USB::DevHandle#usb_get_descriptor(type, index, buf) */
static VALUE
rusb_get_descriptor(
VALUE v,
VALUE vtype,
VALUE vindex,
VALUE vbuf)
{
usb_dev_handle *p = get_usb_devhandle(v);
int type = NUM2INT(vtype);
int index = NUM2INT(vindex);
char *buf;
int buflen;
int ret;
StringValue(vbuf);
rb_str_modify(vbuf);
buf = RSTRING_PTR(vbuf);
buflen = RSTRING_LEN(vbuf);
ret = usb_get_descriptor(p, type, index, buf, buflen);
check_usb_error("usb_get_descriptor", ret);
return INT2NUM(ret);
}