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