Strange Resume behaviour of N5321 since 4.19

Bjørn Mork bjorn at mork.no
Thu Nov 7 15:31:59 UTC 2019


Torsten Hilbrich <torsten.hilbrich at secunet.com> writes:

> Versions:
>
> ModemManager: 1.10.4
> libmbim: 1.18.2
> libqmi: 1.22.4
>
> After updating our kernel from kernel v4.14.65 to v4.19.65 we got strange behaviour when performing S3.
>
> The WWAN modem often disappears from the USB bus and reappears with a different ID.
>
> Normal ID:    0bdb:193e
> Different ID: 0bdb:193f
>
> When this happens the following can be seen in the kernel logs:
>
> [  224.086896] usb 3-10: new high-speed USB device number 7 using xhci_hcd
> [  224.213587] usb 3-10: New USB device found, idVendor=0bdb, idProduct=193f
> [  224.213591] usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=5
> [  224.213594] usb 3-10: Product: N5321 gw
> [  224.213597] usb 3-10: Manufacturer: Lenovo
> [  224.213599] usb 3-10: SerialNumber: 837BA41ADA15F060
> [  239.585248] usb 3-10: USB disconnect, device number 7
> [  239.807960] usb 3-10: new high-speed USB device number 8 using xhci_hcd
> [  239.937575] usb 3-10: New USB device found, idVendor=0bdb, idProduct=193e
> [  239.937582] usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [  239.937587] usb 3-10: Product: N5321 gw
> [  239.937591] usb 3-10: Manufacturer: Lenovo
> [  239.937594] usb 3-10: SerialNumber: 837BA41ADA15F0M0


I believe this cycling from one initial ID (bootloader) to another ID
(application) might be normal for these modems.  I only have cached info
for a H5321gw, which has shown a similar behaviour with:

P:  Vendor=0bdb ProdID=1927 Rev= 1.00
S:  Manufacturer=Lenovo
S:  Product=H5321 gw
S:  SerialNumber=D28456C2E3EDA690
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=86(I) Atr=03(Int.) MxPS= 512 Ivl=64ms

followed by

P:  Vendor=0bdb ProdID=1926 Rev= 0.00
S:  Manufacturer=Lenovo
S:  Product=H5321 gw
S:  SerialNumber=D28456C2E3EDA6M0
C:* #Ifs=11 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 0 Cls=02(comm.) Sub=08 Prot=00 Driver=(none)
I:* If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=(none)
E:  Ad=8a(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=(none)
E:  Ad=89(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=09 Prot=01 Driver=cdc_wdm
E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:  If#= 6 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=cdc_mbim
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:* If#= 6 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 7 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_mbim
I:  If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_mbim
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 2 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 8 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=09 Prot=01 Driver=cdc_wdm
E:  Ad=87(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:* If#= 9 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=(none)
E:  Ad=84(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:* If#=10 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
C:  #Ifs= 9 Cfg#= 2 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=02(comm.) Sub=08 Prot=00 Driver=
I:  If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=
E:  Ad=8a(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=
E:  Ad=89(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:  If#= 4 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 5 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=09 Prot=01 Driver=
E:  Ad=88(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:  If#= 6 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 6 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 7 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
I:  If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 7 Alt= 2 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 8 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=09 Prot=01 Driver=
E:  Ad=87(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
C:  #Ifs= 5 Cfg#= 3 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=02(comm.) Sub=08 Prot=00 Driver=
I:  If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 1 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
I:  If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 2 Alt= 2 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=
E:  Ad=84(I) Atr=03(Int.) MxPS=  32 Ivl=16ms
I:  If#= 4 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
C:  #Ifs= 3 Cfg#= 4 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=02(comm.) Sub=08 Prot=00 Driver=
I:  If#= 1 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 1 Alt= 1 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  32 Ivl=8ms
I:  If#= 2 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
I:  If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 2 Alt= 2 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms




> In this time window between 224 and 239 the usb_probe_device routine is running the generic_probe. There the usb_choose_configuration and usb_set_configuration are running.
>
> Sometimes I also see delays and error messages when the usbhid driver tries to bind to this 193f device.

If I'm guessing correct, then the new problem is this long delay.  Could
there be something new in the usbhid driver causing this?


Googling a bit around, it seems that usbhid causing delays with
different devices is a well known problem.  See for example:

https://jackson-brain.com/boot-input-delay-with-corsair-k70-rgb-in-linux-ubuntu-fedora/

> After the delay the device is disconnect and reappears on the bus and is working correctly, detected by the cdc_mbim driver.
>
> I had to work around this problem by avoiding the USB access to this device completely, using a patch like:
>
> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index a1f225f077cd..9ee031e6b57c 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -254,6 +254,13 @@ static int usb_probe_device(struct device *dev)
>  
>         dev_dbg(dev, "%s\n", __func__);
>  
> +       if (udev->descriptor.idVendor == 0x0bdb &&
> +           udev->descriptor.idProduct == 0x193f)
> +       {
> +               dev_info(dev, "ignoring known problematic USB ID 0bdb:193f for N5321 WWAN modem\n");
> +               return -ENODEV;
> +       }
> +
>         /* TODO: Add real matching code */
>  
>         /* The device should always appear to be in use
>


I believe you should be able to work around the problem using the
'usbhid.quirks' parameter, although I am not sure about the exact
quirk to set.  It's documented as

  parm:           quirks:Add/modify USB HID quirks by specifying  quirks=vendorID:productID:quirks where vendorID, productID, and quirks are all in 0x-prefixed hex (array of charp)

And the quirks are defined in include/linux/hid.h:

/*
 * HID device quirks.
 */

/* 
 * Increase this if you need to configure more HID quirks at module load time
 */
#define MAX_USBHID_BOOT_QUIRKS 4

#define HID_QUIRK_INVERT                        BIT(0)
#define HID_QUIRK_NOTOUCH                       BIT(1)
#define HID_QUIRK_IGNORE                        BIT(2)
#define HID_QUIRK_NOGET                         BIT(3)
#define HID_QUIRK_HIDDEV_FORCE                  BIT(4)
#define HID_QUIRK_BADPAD                        BIT(5)
#define HID_QUIRK_MULTI_INPUT                   BIT(6)
#define HID_QUIRK_HIDINPUT_FORCE                BIT(7)
/* BIT(8) reserved for backward compatibility, was HID_QUIRK_NO_EMPTY_INPUT */
/* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */
#define HID_QUIRK_ALWAYS_POLL                   BIT(10)
#define HID_QUIRK_INPUT_PER_APP                 BIT(11)
#define HID_QUIRK_SKIP_OUTPUT_REPORTS           BIT(16)
#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID         BIT(17)
#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP  BIT(18)
#define HID_QUIRK_HAVE_SPECIAL_DRIVER           BIT(19)
#define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE  BIT(20)
#define HID_QUIRK_FULLSPEED_INTERVAL            BIT(28)
#define HID_QUIRK_NO_INIT_REPORTS               BIT(29)
#define HID_QUIRK_NO_IGNORE                     BIT(30)
#define HID_QUIRK_NO_INPUT_SYNC                 BIT(31)


So probably something like

 quirks=0x0bdb:0x193f:0x4

to ignore the device.  If you get this working, then you should probably
provide a patch for drivers/hid/hid-quirks.c.




Bjørn


More information about the ModemManager-devel mailing list