USB ACM serial driver did not take maxPacketSize provided by the device into account
Change-Id: Ic93d420012d757088b20936e6c8d942ccbc0e5bf Reviewed-on: https://review.haiku-os.org/c/haiku/+/6668 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
a5afae7f96
commit
243ac0b9a6
@@ -87,6 +87,7 @@ ACMDevice::AddDevice(const usb_configuration_info *config)
|
|||||||
|| descriptor->interface_class == USB_CDC_DATA_INTERFACE_CLASS)
|
|| descriptor->interface_class == USB_CDC_DATA_INTERFACE_CLASS)
|
||||||
&& interface->endpoint_count >= 1) {
|
&& interface->endpoint_count >= 1) {
|
||||||
SetControlPipe(interface->endpoint[0].handle);
|
SetControlPipe(interface->endpoint[0].handle);
|
||||||
|
SetInterruptBufferSize(interface->endpoint[0].descr->max_packet_size);
|
||||||
} else {
|
} else {
|
||||||
TRACE("Indicated command interface doesn't fit our needs!\n");
|
TRACE("Indicated command interface doesn't fit our needs!\n");
|
||||||
status = ENODEV;
|
status = ENODEV;
|
||||||
@@ -99,15 +100,21 @@ ACMDevice::AddDevice(const usb_configuration_info *config)
|
|||||||
usb_interface_descriptor *descriptor = interface->descr;
|
usb_interface_descriptor *descriptor = interface->descr;
|
||||||
if (descriptor->interface_class == USB_CDC_DATA_INTERFACE_CLASS
|
if (descriptor->interface_class == USB_CDC_DATA_INTERFACE_CLASS
|
||||||
&& interface->endpoint_count >= 2) {
|
&& interface->endpoint_count >= 2) {
|
||||||
if (!(interface->endpoint[0].descr->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN))
|
if (!(interface->endpoint[0].descr->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN)) {
|
||||||
|
SetWriteBufferSize(ROUNDUP(interface->endpoint[0].descr->max_packet_size, 16));
|
||||||
SetWritePipe(interface->endpoint[0].handle);
|
SetWritePipe(interface->endpoint[0].handle);
|
||||||
else
|
} else {
|
||||||
|
SetReadBufferSize(ROUNDUP(interface->endpoint[0].descr->max_packet_size, 16));
|
||||||
SetReadPipe(interface->endpoint[0].handle);
|
SetReadPipe(interface->endpoint[0].handle);
|
||||||
|
}
|
||||||
|
|
||||||
if (interface->endpoint[1].descr->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN)
|
if (interface->endpoint[1].descr->endpoint_address & USB_ENDPOINT_ADDR_DIR_IN) {
|
||||||
|
SetReadBufferSize(ROUNDUP(interface->endpoint[1].descr->max_packet_size, 16));
|
||||||
SetReadPipe(interface->endpoint[1].handle);
|
SetReadPipe(interface->endpoint[1].handle);
|
||||||
else
|
} else {
|
||||||
|
SetWriteBufferSize(ROUNDUP(interface->endpoint[1].descr->max_packet_size, 16));
|
||||||
SetWritePipe(interface->endpoint[1].handle);
|
SetWritePipe(interface->endpoint[1].handle);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
TRACE("Indicated data interface doesn't fit our needs!\n");
|
TRACE("Indicated data interface doesn't fit our needs!\n");
|
||||||
status = ENODEV;
|
status = ENODEV;
|
||||||
|
|||||||
Reference in New Issue
Block a user