/* USB::DevHandle#usb_get_descriptor_by_endpoint(endpoint, type, index, buf) */ static VALUE rusb_get_descriptor_by_endpoint( VALUE v, VALUE vep, VALUE vtype, VALUE vindex, VALUE vbuf) { usb_dev_handle *p = get_usb_devhandle(v); int ep = NUM2INT(vep); 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_by_endpoint(p, ep, type, index, buf, buflen); check_usb_error("usb_get_descriptor_by_endpoint", ret); return INT2NUM(ret); }