2022-05-16 20:05:13

by Carl Yin(殷张成)

[permalink] [raw]
Subject: [PATCH] USB: serial: option: add Quectel BG95 modem

The BG95 modem has 2 USB configurations that are configurable via the AT
command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the modem enumerate
with the following interfaces, respectively:

"modem": Diag + GNSS + Modem + Modem
"ecm" : DIAG + GNSS + Modem + ECM

A detailed description of the USB configuration for each mode follows:

+QCFGEXT: "usbnet","modem"
-------------------------
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=0700 Rev= 0.00
S: Manufacturer=Quectel, Incorporated
S: Product=Quectel LPWA Module
S: SerialNumber=884328a2
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

+QCFGEXT: "usbnet","ecm"
-----------------------
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=0700 Rev= 0.00
S: Manufacturer=Quectel, Incorporated
S: Product=Quectel LPWA Module
S: SerialNumber=884328a2
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Signed-off-by: Carl Yin <[email protected]>
---
drivers/usb/serial/option.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 152ad8826..f91b2a67d 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
#define QUECTEL_PRODUCT_RM500Q 0x0800
#define QUECTEL_PRODUCT_EC200S_CN 0x6002
#define QUECTEL_PRODUCT_EC200T 0x6026
+#define QUECTEL_PRODUCT_BG95 0x0700

#define CMOTECH_VENDOR_ID 0x16d8
#define CMOTECH_PRODUCT_6001 0x6001
@@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
.driver_info = ZLP },
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
+ .driver_info = ZLP },
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
+ .driver_info = ZLP },

{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
--
2.17.1


Attachments:
winmail.dat (14.00 kB)

2022-05-17 07:03:03

by Reinhard Speyerer

[permalink] [raw]
Subject: Re: [PATCH] USB: serial: option: add Quectel BG95 modem

On Mon, May 16, 2022 at 06:10:17AM +0000, Carl Yin(殷张成) wrote:
> The BG95 modem has 2 USB configurations that are configurable via the AT
> command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the modem enumerate
> with the following interfaces, respectively:
>
> "modem": Diag + GNSS + Modem + Modem
> "ecm" : DIAG + GNSS + Modem + ECM

Hi Carl,

what about the AT+QCFGEXT="usbnet","rmnet" configuration available on
several firmware versions which makes the BG95 enumerate as
Diag + GNSS + Modem + QMI:

T: Bus=02 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 8 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=0700 Rev= 0.00
S: Manufacturer=Quectel, Incorporated
S: Product=Quectel LPWA Module
S: SerialNumber=xxxxxxxx
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

>
> A detailed description of the USB configuration for each mode follows:
>
> +QCFGEXT: "usbnet","modem"
> -------------------------
> T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
> D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> P: Vendor=2c7c ProdID=0700 Rev= 0.00
> S: Manufacturer=Quectel, Incorporated
> S: Product=Quectel LPWA Module
> S: SerialNumber=884328a2
> C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
> E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
>
> +QCFGEXT: "usbnet","ecm"
> -----------------------
> T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
> D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
> P: Vendor=2c7c ProdID=0700 Rev= 0.00
> S: Manufacturer=Quectel, Incorporated
> S: Product=Quectel LPWA Module
> S: SerialNumber=884328a2
> C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
> A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
> E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
> I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
> E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
>
> Signed-off-by: Carl Yin <[email protected]>
> ---
> drivers/usb/serial/option.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index 152ad8826..f91b2a67d 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
> #define QUECTEL_PRODUCT_RM500Q 0x0800
> #define QUECTEL_PRODUCT_EC200S_CN 0x6002
> #define QUECTEL_PRODUCT_EC200T 0x6026
> +#define QUECTEL_PRODUCT_BG95 0x0700
>
> #define CMOTECH_VENDOR_ID 0x16d8
> #define CMOTECH_PRODUCT_6001 0x6001
> @@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
> .driver_info = ZLP },
> { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
> { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
> + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
> + .driver_info = ZLP },

Could you please add a RSVD(3) flag to the driver_info here to avoid
that the option driver incorrectly binds to the QMI interface?

Regards,
Reinhard

> + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
> + .driver_info = ZLP },
>
> { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
> { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
> --
> 2.17.1
>

2022-05-17 08:03:12

by Carl Yin(殷张成)

[permalink] [raw]
Subject: Re: [PATCH] USB: serial: option: add Quectel BG95 modem

Hi Reinhard:
Although BG95 supports at+qcfgext="usbnet", "rmnet", but lots of QMI message do not support,
E.g WDS_START_NETWORK_INTERFACE, so "rmnet" is basically useless.

On Tuesday, May 17, 2022 at 05:13 AM +0000, Reinhard Speyerer wrote:

> On Mon, May 16, 2022 at 06:10:17AM +0000, Carl Yin(殷张成) wrote:
> > The BG95 modem has 2 USB configurations that are configurable via the
> > AT command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the
> modem
> > enumerate with the following interfaces, respectively:
> >
> > "modem": Diag + GNSS + Modem + Modem
> > "ecm" : DIAG + GNSS + Modem + ECM
>
> Hi Carl,
>
> what about the AT+QCFGEXT="usbnet","rmnet" configuration available on
> several firmware versions which makes the BG95 enumerate as Diag + GNSS +
> Modem + QMI:
>
> T: Bus=02 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 8 Spd=480 MxCh= 0
> D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> P: Vendor=2c7c ProdID=0700 Rev= 0.00
> S: Manufacturer=Quectel, Incorporated
> S: Product=Quectel LPWA Module
> S: SerialNumber=xxxxxxxx
> C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
> E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
>
> >
> > A detailed description of the USB configuration for each mode follows:
> >
> > +QCFGEXT: "usbnet","modem"
> > -------------------------
> > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
> > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > S: Manufacturer=Quectel, Incorporated
> > S: Product=Quectel LPWA Module
> > S: SerialNumber=884328a2
> > C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
> > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> >
> > +QCFGEXT: "usbnet","ecm"
> > -----------------------
> > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
> > D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
> > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > S: Manufacturer=Quectel, Incorporated
> > S: Product=Quectel LPWA Module
> > S: SerialNumber=884328a2
> > C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
> > A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00
> > Driver=cdc_ether
> > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00
> > Driver=cdc_ether
> > I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00
> > Driver=cdc_ether
> > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> >
> > Signed-off-by: Carl Yin <[email protected]>
> > ---
> > drivers/usb/serial/option.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > index 152ad8826..f91b2a67d 100644
> > --- a/drivers/usb/serial/option.c
> > +++ b/drivers/usb/serial/option.c
> > @@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
> > #define QUECTEL_PRODUCT_RM500Q 0x0800
> > #define QUECTEL_PRODUCT_EC200S_CN 0x6002
> > #define QUECTEL_PRODUCT_EC200T 0x6026
> > +#define QUECTEL_PRODUCT_BG95 0x0700
> >
> > #define CMOTECH_VENDOR_ID 0x16d8
> > #define CMOTECH_PRODUCT_6001 0x6001
> > @@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
> > .driver_info = ZLP },
> > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
> > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
> > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
> > + .driver_info = ZLP },
>
> Could you please add a RSVD(3) flag to the driver_info here to avoid that the
> option driver incorrectly binds to the QMI interface?
>
> Regards,
> Reinhard
>
> > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
> > + .driver_info = ZLP },
> >
> > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
> > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
> > --
> > 2.17.1
> >

2022-05-18 04:00:36

by Reinhard Speyerer

[permalink] [raw]
Subject: Re: [PATCH] USB: serial: option: add Quectel BG95 modem

On Tue, May 17, 2022 at 01:14:34AM +0000, Carl Yin(殷张成) wrote:
> Hi Reinhard:
> Although BG95 supports at+qcfgext="usbnet", "rmnet", but lots of QMI message do not support,
> E.g WDS_START_NETWORK_INTERFACE, so "rmnet" is basically useless.
>

Hi Carl,

I am aware of the limitations of the QMI interface on Qualcomm MDM9205-based
devices. There are however cases where a certain functionality is not
available on the AT interface. For example AT+COPS=? does not return LTE
Cat-NB1 networks while QMI NAS_SCAN_NETS returns them.

Having the option driver bind to the QMI interface although it is not
a serial port might also slow down the port probing of ModemManager.

Therefore I suggested to add the RSVD(3) flag.

Regards,
Reinhard

> On Tuesday, May 17, 2022 at 05:13 AM +0000, Reinhard Speyerer wrote:
>
> > On Mon, May 16, 2022 at 06:10:17AM +0000, Carl Yin(殷张成) wrote:
> > > The BG95 modem has 2 USB configurations that are configurable via the
> > > AT command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the
> > modem
> > > enumerate with the following interfaces, respectively:
> > >
> > > "modem": Diag + GNSS + Modem + Modem
> > > "ecm" : DIAG + GNSS + Modem + ECM
> >
> > Hi Carl,
> >
> > what about the AT+QCFGEXT="usbnet","rmnet" configuration available on
> > several firmware versions which makes the BG95 enumerate as Diag + GNSS +
> > Modem + QMI:
> >
> > T: Bus=02 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 8 Spd=480 MxCh= 0
> > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > S: Manufacturer=Quectel, Incorporated
> > S: Product=Quectel LPWA Module
> > S: SerialNumber=xxxxxxxx
> > C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
> > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> >
> > >
> > > A detailed description of the USB configuration for each mode follows:
> > >
> > > +QCFGEXT: "usbnet","modem"
> > > -------------------------
> > > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
> > > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> > > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S: Manufacturer=Quectel, Incorporated
> > > S: Product=Quectel LPWA Module
> > > S: SerialNumber=884328a2
> > > C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
> > > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > +QCFGEXT: "usbnet","ecm"
> > > -----------------------
> > > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
> > > D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
> > > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S: Manufacturer=Quectel, Incorporated
> > > S: Product=Quectel LPWA Module
> > > S: SerialNumber=884328a2
> > > C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
> > > A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00
> > > Driver=cdc_ether
> > > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > Signed-off-by: Carl Yin <[email protected]>
> > > ---
> > > drivers/usb/serial/option.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > index 152ad8826..f91b2a67d 100644
> > > --- a/drivers/usb/serial/option.c
> > > +++ b/drivers/usb/serial/option.c
> > > @@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
> > > #define QUECTEL_PRODUCT_RM500Q 0x0800
> > > #define QUECTEL_PRODUCT_EC200S_CN 0x6002
> > > #define QUECTEL_PRODUCT_EC200T 0x6026
> > > +#define QUECTEL_PRODUCT_BG95 0x0700
> > >
> > > #define CMOTECH_VENDOR_ID 0x16d8
> > > #define CMOTECH_PRODUCT_6001 0x6001
> > > @@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
> > > .driver_info = ZLP },
> > > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
> > > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > > QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
> > > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
> > > + .driver_info = ZLP },
> >
> > Could you please add a RSVD(3) flag to the driver_info here to avoid that the
> > option driver incorrectly binds to the QMI interface?
> >
> > Regards,
> > Reinhard
> >
> > > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
> > > + .driver_info = ZLP },
> > >
> > > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
> > > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
> > > --
> > > 2.17.1
> > >

2022-05-18 04:21:34

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH] USB: serial: option: add Quectel BG95 modem

On Tue, May 17, 2022 at 01:14:34AM +0000, Carl Yin(殷张成) wrote:
> Hi Reinhard:
> Although BG95 supports at+qcfgext="usbnet", "rmnet", but lots of QMI message do not support,
> E.g WDS_START_NETWORK_INTERFACE, so "rmnet" is basically useless.

Sounds like a good idea to reserve interface 3 as Reinhard suggested
anyway for completeness.

You can mention that the configuration is incomplete, but please include
usb-devices output for also for rmnet so we have all the configurations
in the commit message.

> On Tuesday, May 17, 2022 at 05:13 AM +0000, Reinhard Speyerer wrote:
>
> > On Mon, May 16, 2022 at 06:10:17AM +0000, Carl Yin(殷张成) wrote:
> > > The BG95 modem has 2 USB configurations that are configurable via the
> > > AT command AT+QCFGEXT="usbnet",["ecm"|"modem"] which make the
> > modem
> > > enumerate with the following interfaces, respectively:
> > >
> > > "modem": Diag + GNSS + Modem + Modem
> > > "ecm" : DIAG + GNSS + Modem + ECM
> >
> > Hi Carl,
> >
> > what about the AT+QCFGEXT="usbnet","rmnet" configuration available on
> > several firmware versions which makes the BG95 enumerate as Diag + GNSS +
> > Modem + QMI:
> >
> > T: Bus=02 Lev=02 Prnt=06 Port=01 Cnt=02 Dev#= 8 Spd=480 MxCh= 0
> > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > S: Manufacturer=Quectel, Incorporated
> > S: Product=Quectel LPWA Module
> > S: SerialNumber=xxxxxxxx
> > C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
> > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> >
> > >
> > > A detailed description of the USB configuration for each mode follows:
> > >
> > > +QCFGEXT: "usbnet","modem"
> > > -------------------------
> > > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
> > > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
> > > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S: Manufacturer=Quectel, Incorporated
> > > S: Product=Quectel LPWA Module
> > > S: SerialNumber=884328a2
> > > C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
> > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option
> > > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > +QCFGEXT: "usbnet","ecm"
> > > -----------------------
> > > T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
> > > D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
> > > P: Vendor=2c7c ProdID=0700 Rev= 0.00
> > > S: Manufacturer=Quectel, Incorporated
> > > S: Product=Quectel LPWA Module
> > > S: SerialNumber=884328a2
> > > C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
> > > A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00
> > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
> > > E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00
> > > Driver=cdc_ether
> > > E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
> > > I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00
> > > Driver=cdc_ether
> > > E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > > E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> > >
> > > Signed-off-by: Carl Yin <[email protected]>
> > > ---
> > > drivers/usb/serial/option.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > index 152ad8826..f91b2a67d 100644
> > > --- a/drivers/usb/serial/option.c
> > > +++ b/drivers/usb/serial/option.c
> > > @@ -256,6 +256,7 @@ static void option_instat_callback(struct urb *urb);
> > > #define QUECTEL_PRODUCT_RM500Q 0x0800
> > > #define QUECTEL_PRODUCT_EC200S_CN 0x6002
> > > #define QUECTEL_PRODUCT_EC200T 0x6026
> > > +#define QUECTEL_PRODUCT_BG95 0x0700

Please keep the defines sorted by PID.

> > > #define CMOTECH_VENDOR_ID 0x16d8
> > > #define CMOTECH_PRODUCT_6001 0x6001
> > > @@ -1143,6 +1144,10 @@ static const struct usb_device_id option_ids[] = {
> > > .driver_info = ZLP },
> > > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
> > > { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > > QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
> > > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xff, 0xff),
> > > + .driver_info = ZLP },
> >
> > Could you please add a RSVD(3) flag to the driver_info here to avoid that the
> > option driver incorrectly binds to the QMI interface?

> > > + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID,
> > QUECTEL_PRODUCT_BG95, 0xff, 0xfe, 0xff),
> > > + .driver_info = ZLP },

Wouldn't a single entry using USB_DEVICE_INTERFACE_CLASS() be enough to
cover all three configurations?

> > >
> > > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
> > > { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
> > > --
> > > 2.17.1
> > >

Johan