Skip to content

Commit

Permalink
Merge pull request #264 from miek/descriptor_handler_limit_packet_length
Browse files Browse the repository at this point in the history
gateware.usb.request.standard: pass max packet size to GetDescriptor handler
  • Loading branch information
miek authored Jun 8, 2024
2 parents 664d5d1 + 9e540ae commit fe7d811
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions luna/gateware/usb/request/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_descriptor_handler_submodule(self):

# The distributed handler supports a combination of fixed and runtime descriptors directly...
if self._avoid_blockram:
return GetDescriptorHandlerDistributed(self.descriptors)
return GetDescriptorHandlerDistributed(self.descriptors, max_packet_length=self._max_packet_size)

# ...but the block handler does not. In this case, first we split the descriptors into two
# collections: fixed descriptors (for the ROM) and runtime descriptors.
Expand All @@ -75,11 +75,11 @@ def get_descriptor_handler_submodule(self):
# If there are runtime descriptors, we add a get descriptor multiplexer and a distributed handler.
if has_runtime_descriptors:
handler_mux = GetDescriptorHandlerMux()
handler_mux.add_descriptor_handler(GetDescriptorHandlerBlock(fixed_descriptors))
handler_mux.add_descriptor_handler(GetDescriptorHandlerDistributed(runtime_descriptors))
handler_mux.add_descriptor_handler(GetDescriptorHandlerBlock(fixed_descriptors, max_packet_length=self._max_packet_size))
handler_mux.add_descriptor_handler(GetDescriptorHandlerDistributed(runtime_descriptors, max_packet_length=self._max_packet_size))
return handler_mux
else:
return GetDescriptorHandlerBlock(self.descriptors)
return GetDescriptorHandlerBlock(self.descriptors, max_packet_length=self._max_packet_size)


def elaborate(self, platform):
Expand Down

0 comments on commit fe7d811

Please sign in to comment.