Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors occur when proxying a USB 3.0 device. #27

Open
zqsong opened this issue Nov 25, 2024 · 0 comments
Open

Errors occur when proxying a USB 3.0 device. #27

zqsong opened this issue Nov 25, 2024 · 0 comments

Comments

@zqsong
Copy link

zqsong commented Nov 25, 2024

When acting as a USB drive, errors occur when using a USB 3.0 port, but it works fine with a USB 2.0 port.

The erroneous program log is as follows:

./usb-proxy --device=fc000000.usb --driver=dwc3-gadget --vendor_id=346d --product_id=5678 --verbose
Device is: fc000000.usb
Driver is: dwc3-gadget
vendor_id is: 13421
product_id is: 22136
cnt: 7
7 Devices in list
Target device not found
Device opened successfully
Start hotplug_monitor thread, thread id(27446)
Setup USB config successfully
Start for EP0, thread id(27414)
ep #0:
  name: ep1out
  addr: 1
  type: iso blk int
  dir : ___ out
  maxpacket_limit: 2397
  max_streams: 16
ep #1:
  name: ep1in
  addr: 1
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 1024
  max_streams: 16
ep #2:
  name: ep2out
  addr: 2
  type: iso blk int
  dir : ___ out
  maxpacket_limit: 2397
  max_streams: 16
ep #3:
  name: ep2in
  addr: 2
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 1024
  max_streams: 16
ep #4:
  name: ep3out
  addr: 3
  type: iso blk int
  dir : ___ out
  maxpacket_limit: 2397
  max_streams: 16
ep #5:
  name: ep3in
  addr: 3
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 1024
  max_streams: 16
ep #6:
  name: ep4out
  addr: 4
  type: iso blk int
  dir : ___ out
  maxpacket_limit: 2397
  max_streams: 16
ep #7:
  name: ep4in
  addr: 4
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 1024
  max_streams: 16
ep #8:
  name: ep5out
  addr: 5
  type: iso blk int
  dir : ___ out
  maxpacket_limit: 2397
  max_streams: 16
ep #9:
  name: ep5in
  addr: 5
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 1024
  max_streams: 16
ep #10:
  name: ep6in
  addr: 6
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 156
  max_streams: 16
ep #11:
  name: ep7in
  addr: 7
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 65524
  max_streams: 16
ep #12:
  name: ep8in
  addr: 8
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 65524
  max_streams: 16
ep #13:
  name: ep9in
  addr: 9
  type: iso blk int
  dir : in  ___
  maxpacket_limit: 65524
  max_streams: 16
event: connect, length: 0
event: suspend
libusb: error [usbi_get_context] API misuse! Using non-default context as implicit default.
event: reset
Resetting device
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0100, wIndex: 0x0000, wLength: 64
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_DEVICE
Control transfer succeed
Sending data to EP0(control_in): 12 01 20 03 00 00 00 40 6d 34 78 56 00 02 01 02 03 01
ep0: transferred 18 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0100, wIndex: 0x0000, wLength: 18
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_DEVICE
Control transfer succeed
Sending data to EP0(control_in): 12 01 20 03 00 00 00 40 6d 34 78 56 00 02 01 02 03 01
ep0: transferred 18 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0200, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_CONFIG
Control transfer succeed
Sending data to EP0(control_in): 09 02 2c 00 01 01 00 80 12 09 04 00 00 02 08 06 50 00 07 05 01 02 00 04 00 06 30 00 00 00 00 07 05 81 02 00 04 00 06 30 00 00 00 00
ep0: transferred 44 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0f00, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_BOS
Control transfer succeed
Sending data to EP0(control_in): 05 0f 16 00 02 07 10 02 06 00 00 00 0a 10 03 00 0e 00 03 00 00 00
ep0: transferred 22 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0303, wIndex: 0x0409, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 1c 03 46 00 43 00 31 00 33 00 32 00 37 00 46 00 36 00 36 00 41 00 35 00 30 00 43 00
ep0: transferred 28 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0300, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 09 04
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0302, wIndex: 0x0409, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 20 00
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0300, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 09 04
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0303, wIndex: 0x0409, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 1c 03 46 00 43 00 31 00 33 00 32 00 37 00 46 00 36 00 36 00 41 00 35 00 30 00 43 00
ep0: transferred 28 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0300, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 09 04
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0301, wIndex: 0x0409, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 12 03 20 00 48 00 49 00 4b 00 53 00 45 00 4d 00 49 00
ep0: transferred 18 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0302, wIndex: 0x0409, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 20 00
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0300, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 09 04
ep0: transferred 4 bytes (in)
event: control, length: 8
  bRequestType: 0x80  (IN), bRequest: 0x06, wValue: 0x0300, wIndex: 0x0000, wLength: 255
  type = USB_TYPE_STANDARD
  req = USB_REQ_GET_DESCRIPTOR
  desc = USB_DT_STRING
Control transfer succeed
Sending data to EP0(control_in): 04 03 09 04
ioctl(USB_RAW_IOCTL_EP0_WRITE): Connection reset by peer

The kernel output is as follows:

6,345069,254411304472,-;usb 6-1: SetAddress Request (7) to port 0
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345070,254411304516,-;usb 6-1: reset SuperSpeed Gen 1 USB device number 7 using vhci_hcd
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345071,254411323829,-;usb 6-1: LPM exit latency is zeroed, disabling LPM.
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345072,254411432862,-;dwc3 fc000000.usb: device reset
 SUBSYSTEM=platform
 DEVICE=+platform:fc000000.usb
6,345073,254411554518,-;usb 6-1: SetAddress Request (7) to port 0
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345074,254411554604,-;usb 6-1: reset SuperSpeed Gen 1 USB device number 7 using vhci_hcd
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345075,254411573530,-;usb 6-1: LPM exit latency is zeroed, disabling LPM.
 SUBSYSTEM=usb
 DEVICE=c189:646
6,345076,254416663920,-;dwc3 fc000000.usb: device reset
 SUBSYSTEM=platform
 DEVICE=+platform:fc000000.usb
3,345077,254416670423,-;dwc3 fc000000.usb: failed to send remote wakeup
 SUBSYSTEM=platform
 DEVICE=+platform:fc000000.usb

How should this situation be handled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant