Remove 'actual_length' parameter of USB_tranfer_compl

We can simply cut the returned data octet string to the actual length
instead.  In this case, we must also adjust for the control pipe header
in case of CONTROL IN transfers.
This commit is contained in:
Harald Welte 2019-01-13 23:04:48 +01:00
parent a362722b96
commit 66858d15a7
2 changed files with 4 additions and 3 deletions

View File

@ -492,8 +492,10 @@ void USB__PT_PROVIDER::transfer_completed(USB_Transfer *t)
xfc.transfer__hdl() = t->mID;
xfc.ttype() = ttype_usb2titan((enum libusb_transfer_type) t->mXfer->type);
xfc.endpoint() = t->mXfer->endpoint;
xfc.data() = OCTETSTRING(t->mXfer->length, t->mXfer->buffer);
xfc.actual__length() = t->mXfer->actual_length;
unsigned int len = t->mXfer->actual_length;
if (t->mXfer->type == LIBUSB_TRANSFER_TYPE_CONTROL && t->mXfer->buffer[0] & 0x80)
len += 8;
xfc.data() = OCTETSTRING(len, t->mXfer->buffer);
xfc.status() = t->mXfer->status;
incoming_message(xfc);
}

View File

@ -43,7 +43,6 @@ module USB_PortTypes {
USB_endpoint endpoint,
USB_transfer_type ttype,
octetstring data,
integer actual_length,
USB_transfer_status status
};