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

[rtl872x] fix usb high speed #2744

Merged
merged 3 commits into from
Mar 1, 2024
Merged

[rtl872x] fix usb high speed #2744

merged 3 commits into from
Mar 1, 2024

Conversation

avtolstoy
Copy link
Member

@avtolstoy avtolstoy commented Feb 22, 2024

Description

Spend too much time on this, but surpisingly this particular mode makes re-enumeration work correctly.

Test with M SoM or P2 with battery: disconnect from USB/re-connect.

@avtolstoy avtolstoy added this to the 5.8.0 milestone Feb 22, 2024
Copy link
Member

@XuGuohui XuGuohui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround doesn't fix the USB re-enumeration issue on my MSoM.
Platform: Mac
Steps to replicate:

  1. Connect both battery and USB, USB enumerates successfully
  2. Unlug USB cable while leaving the battery attached
  3. Re-connect USB, USB failed to re-enumerate

If I disconnected the USB connection from the terminal first, followed by going through step2 and step3, then it can re-enumerate successfully. It seams that the USB stack has some stale data after physical removal without interacting with host.

@avtolstoy
Copy link
Member Author

@XuGuohui Can you try now?

@XuGuohui
Copy link
Member

Sorry. No luck 😢

@avtolstoy
Copy link
Member Author

Okay, time to try on a couple of different computers then.

@eberseth
Copy link
Contributor

This is what Linux is reporting in lsusb:

---------------------------------------------------------------------------------------------------------------------
Bus 001 Device 006: ID 2b04:c023                         <> Bus 001 Device 016: ID 2b04:c023
Couldn't open device, some information will be missing
---------------------------------------------------------------------------------------------------------------------
Device Descriptor:                                       =  Device Descriptor:
  bLength                18                                   bLength                18
  bDescriptorType         1                                   bDescriptorType         1
  bcdUSB               2.00                                   bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device              bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?                                 bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association             bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64                                   bMaxPacketSize0        64
  idVendor           0x2b04                                   idVendor           0x2b04
  idProduct          0xc023                                   idProduct          0xc023
  bcdDevice            2.51                                   bcdDevice            2.51
---------------------------------------------------------------------------------------------------------------------
  iManufacturer           1                              <>   iManufacturer           1 Particle
  iProduct                2                                   iProduct                2 Mseries
  iSerial                 3                                   iSerial                 3 xxxxxxxxxxxxxxxxxxxx
---------------------------------------------------------------------------------------------------------------------
  bNumConfigurations      1                              =    bNumConfigurations      1
  Configuration Descriptor:                                   Configuration Descriptor:
    bLength                 9                                   bLength                 9
    bDescriptorType         2                                   bDescriptorType         2
    wTotalLength           84                                   wTotalLength           84
    bNumInterfaces          3                                   bNumInterfaces          3
    bConfigurationValue     1                                   bConfigurationValue     1
---------------------------------------------------------------------------------------------------------------------
    iConfiguration          4                            <>     iConfiguration          4 Mseries
---------------------------------------------------------------------------------------------------------------------
    bmAttributes         0x80                            =      bmAttributes         0x80
      (Bus Powered)                                               (Bus Powered)
    MaxPower              500mA                                 MaxPower              500mA
    Interface Descriptor:                                       Interface Descriptor:
      bLength                 9                                   bLength                 9
      bDescriptorType         4                                   bDescriptorType         4
      bInterfaceNumber        0                                   bInterfaceNumber        0
      bAlternateSetting       0                                   bAlternateSetting       0
      bNumEndpoints           0                                   bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class             bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass          bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol          bInterfaceProtocol    255 Vendor Specific Protocol
---------------------------------------------------------------------------------------------------------------------
      iInterface              5                          <>       iInterface              5 Mseries Control Interface
---------------------------------------------------------------------------------------------------------------------
    Interface Association:                               =      Interface Association:
      bLength                 8                                   bLength                 8
      bDescriptorType        11                                   bDescriptorType        11
      bFirstInterface         1                                   bFirstInterface         1
      bInterfaceCount         2                                   bInterfaceCount         2
      bFunctionClass          2 Communications                    bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)                  bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)             bFunctionProtocol       1 AT-commands (v.25ter)
---------------------------------------------------------------------------------------------------------------------
      iFunction               6                          <>       iFunction               6 Mseries USB Serial
---------------------------------------------------------------------------------------------------------------------
    Interface Descriptor:                                =      Interface Descriptor:
      bLength                 9                                   bLength                 9
      bDescriptorType         4                                   bDescriptorType         4
      bInterfaceNumber        1                                   bInterfaceNumber        1
      bAlternateSetting       0                                   bAlternateSetting       0
      bNumEndpoints           1                                   bNumEndpoints           1
      bInterfaceClass         2 Communications                    bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)                  bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)             bInterfaceProtocol      1 AT-commands (v.25ter)
---------------------------------------------------------------------------------------------------------------------
      iInterface              6                          <>       iInterface              6 Mseries USB Serial
---------------------------------------------------------------------------------------------------------------------
      CDC Header:                                        =        CDC Header:
        bcdCDC               1.10                                   bcdCDC               1.10
      CDC Call Management:                                        CDC Call Management:
        bmCapabilities       0x00                                   bmCapabilities       0x00
        bDataInterface          2                                   bDataInterface          2
      CDC ACM:                                                    CDC ACM:
        bmCapabilities       0x02                                   bmCapabilities       0x02
          line coding and serial state                                line coding and serial state
      CDC Union:                                                  CDC Union:
        bMasterInterface        1                                   bMasterInterface        1
        bSlaveInterface         2                                   bSlaveInterface         2
      Endpoint Descriptor:                                        Endpoint Descriptor:
        bLength                 7                                   bLength                 7
        bDescriptorType         5                                   bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN                          bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3                                   bmAttributes            3
          Transfer Type            Interrupt                          Transfer Type            Interrupt
          Synch Type               None                               Synch Type               None
          Usage Type               Data                               Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes                       wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              16                                   bInterval              16
    Interface Descriptor:                                       Interface Descriptor:
      bLength                 9                                   bLength                 9
      bDescriptorType         4                                   bDescriptorType         4
      bInterfaceNumber        2                                   bInterfaceNumber        2
      bAlternateSetting       0                                   bAlternateSetting       0
      bNumEndpoints           2                                   bNumEndpoints           2
      bInterfaceClass        10 CDC Data                          bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused                            bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0                                   bInterfaceProtocol      0
---------------------------------------------------------------------------------------------------------------------
      iInterface              6                          <>       iInterface              6 Mseries USB Serial
---------------------------------------------------------------------------------------------------------------------
      Endpoint Descriptor:                               =        Endpoint Descriptor:
        bLength                 7                                   bLength                 7
        bDescriptorType         5                                   bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT                         bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2                                   bmAttributes            2
          Transfer Type            Bulk                               Transfer Type            Bulk
          Synch Type               None                               Synch Type               None
          Usage Type               Data                               Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes                      wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              16                                   bInterval              16
      Endpoint Descriptor:                                        Endpoint Descriptor:
        bLength                 7                                   bLength                 7
        bDescriptorType         5                                   bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN                          bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2                                   bmAttributes            2
          Transfer Type            Bulk                               Transfer Type            Bulk
          Synch Type               None                               Synch Type               None
          Usage Type               Data                               Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes                      wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              16                                   bInterval              16
---------------------------------------------------------------------------------------------------------------------
                                                         -+ Device Status:     0x0001
                                                              Self Powered
---------------------------------------------------------------------------------------------------------------------

Copy link
Contributor

@eberseth eberseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working well for me

@avtolstoy avtolstoy force-pushed the fix/rtl872x-usb-high-speed branch 2 times, most recently from b9a101e to 20d5430 Compare March 1, 2024 02:57
@avtolstoy avtolstoy requested a review from XuGuohui March 1, 2024 02:57
@avtolstoy
Copy link
Member Author

Updated the PR with a bunch more workarounds.

@XuGuohui
Copy link
Member

XuGuohui commented Mar 1, 2024

Finally I cannot reproduce the issue 🎉

@avtolstoy avtolstoy merged commit d1267b8 into develop Mar 1, 2024
13 checks passed
@avtolstoy avtolstoy deleted the fix/rtl872x-usb-high-speed branch March 1, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants