forked from Bananymous/banan-os
Kernel: Only update USB max packet size for FS devices
This commit is contained in:
@@ -113,6 +113,7 @@ namespace Kernel
|
|||||||
TRY(m_controller.send_command(address_device));
|
TRY(m_controller.send_command(address_device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_speed_class == USB::SpeedClass::FullSpeed)
|
||||||
TRY(update_actual_max_packet_size());
|
TRY(update_actual_max_packet_size());
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@@ -134,18 +135,16 @@ namespace Kernel
|
|||||||
request.wLength = 8;
|
request.wLength = 8;
|
||||||
TRY(send_request(request, response_region->paddr()));
|
TRY(send_request(request, response_region->paddr()));
|
||||||
|
|
||||||
uint8_t bMaxPacketSize0;
|
const uint8_t bMaxPacketSize0 = reinterpret_cast<const uint8_t*>(response_region->vaddr())[7];
|
||||||
PageTable::with_fast_page(response_region->paddr(), [&bMaxPacketSize0] {
|
|
||||||
bMaxPacketSize0 = PageTable::fast_page_as_sized<uint8_t>(7);
|
|
||||||
});
|
|
||||||
|
|
||||||
dprintln_if(DEBUG_XHCI, "Got device descriptor");
|
|
||||||
|
|
||||||
const bool is_usb3 = (m_speed_class == USB::SpeedClass::SuperSpeed);
|
const bool is_usb3 = (m_speed_class == USB::SpeedClass::SuperSpeed);
|
||||||
const uint32_t new_max_packet_size = is_usb3 ? 1u << bMaxPacketSize0 : bMaxPacketSize0;
|
const uint32_t new_max_packet_size = is_usb3 ? 1u << bMaxPacketSize0 : bMaxPacketSize0;
|
||||||
|
|
||||||
if (m_endpoints[0].max_packet_size == new_max_packet_size)
|
if (m_endpoints[0].max_packet_size == new_max_packet_size)
|
||||||
|
{
|
||||||
|
dprintln_if(DEBUG_XHCI, "No need to update max packet size");
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
m_endpoints[0].max_packet_size = new_max_packet_size;
|
m_endpoints[0].max_packet_size = new_max_packet_size;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user