remote: usb: use 0x43/0xc3 for packet header

The previous value -- 0xc0 -- is used by Windows all the time to query
special descriptors.  This was causing a conflict when using the USB
bridge on a Windows device.

Change the magic packet from "Vendor: Device" queries to "Vendor:
Other" by setting the bottom two bits.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-05-21 09:14:18 +08:00
parent 10670e22ac
commit faf6554c89
1 changed files with 6 additions and 6 deletions

View File

@ -20,12 +20,12 @@ import time
# The SETUP packet looks like this: # The SETUP packet looks like this:
# #
# +----+----+----------+----+----+ # +----+----+----------+----+----+
# | C0 | 00 | ADDRESS | 04 | 00 | read packet # | C3 | 00 | ADDRESS | 04 | 00 | read packet
# +----+----+----------+----+----+ # +----+----+----------+----+----+
# 1 1 4 1 1 # 1 1 4 1 1
# #
# +----+----+----------+----+----+ # +----+----+----------+----+----+
# | 40 | 00 | ADDRESS | 04 | 00 | write packet # | 43 | 00 | ADDRESS | 04 | 00 | write packet
# +----+----+----------+----+----+ # +----+----+----------+----+----+
# 1 1 4 1 1 # 1 1 4 1 1
# #
@ -37,8 +37,8 @@ import time
# byte indicates what type of packet it is, and that it is a Wishbone Bridge # byte indicates what type of packet it is, and that it is a Wishbone Bridge
# packet. This is the value "0x40" (VENDOR type packet destined for DEVICE) # packet. This is the value "0x40" (VENDOR type packet destined for DEVICE)
# with the "Data Phase Transfer" bit either set or cleared: # with the "Data Phase Transfer" bit either set or cleared:
# - Read: 0xc0 # - Read: 0xc3
# - Write: 0x40 # - Write: 0x43
# #
# The next byte is bRequest, which in the current implementation is unused. # The next byte is bRequest, which in the current implementation is unused.
# Set this value to 0. # Set this value to 0.
@ -103,7 +103,7 @@ class CommUSB:
def usb_read(self, addr, depth=0): def usb_read(self, addr, depth=0):
try: try:
value = self.dev.ctrl_transfer(bmRequestType=0xc0, value = self.dev.ctrl_transfer(bmRequestType=0xc3,
bRequest=0x00, bRequest=0x00,
wValue=addr & 0xffff, wValue=addr & 0xffff,
wIndex=(addr >> 16) & 0xffff, wIndex=(addr >> 16) & 0xffff,
@ -127,7 +127,7 @@ class CommUSB:
def usb_write(self, addr, value, depth=0): def usb_write(self, addr, value, depth=0):
try: try:
self.dev.ctrl_transfer(bmRequestType=0x40, bRequest=0x00, self.dev.ctrl_transfer(bmRequestType=0x43, bRequest=0x00,
wValue=addr & 0xffff, wValue=addr & 0xffff,
wIndex=(addr >> 16) & 0xffff, wIndex=(addr >> 16) & 0xffff,
data_or_wLength=bytes([(value >> 0) & 0xff, data_or_wLength=bytes([(value >> 0) & 0xff,