Skip to content

Commit

Permalink
Handle analyzer vendor requests addressed to interface, not device.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed May 15, 2024
1 parent 9ebc646 commit ca062a3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cynthion/python/src/gateware/analyzer/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from amaranth import Signal, Elaboratable, Module
from amaranth.build.res import ResourceError
from usb_protocol.emitters import DeviceDescriptorCollection
from usb_protocol.types import USBRequestType
from usb_protocol.types import USBRequestType, USBRequestRecipient

from luna.usb2 import USBDevice, USBStreamInEndpoint
from luna import top_level_cli
Expand Down Expand Up @@ -94,8 +94,11 @@ def elaborate(self, platform):
m.submodules.transmitter = transmitter = \
StreamSerializer(data_length=1, domain="usb", stream_type=USBInStreamInterface, max_length_width=1)

# Handle vendor requests
with m.If(setup.type == USBRequestType.VENDOR):
# Handle vendor requests to our interface.
with m.If(
(setup.type == USBRequestType.VENDOR) &
(setup.recipient == USBRequestRecipient.INTERFACE) &
(setup.index == 0)):

m.d.comb += interface.claim.eq(
(setup.request == USBAnalyzerVendorRequests.GET_STATE) |
Expand Down

0 comments on commit ca062a3

Please sign in to comment.