5G modem RG255C-GL support

Hi! I’m using 5G modem RG255C-GL. I have added the changes in Linux drivers and the modem is visible as a USB device. However, I have trouble in finding the 5G or 4G networks.

  • 5G modem detected as USB device after plugging in to M.2 slot :white_check_mark:
  • patched USB option Linux kernel driver so the virtual serial ports are exposed over USB :white_check_mark:
  • added qmi_wwan_q driver net Linux kernel driver :white_check_mark:
  • ModemManager picking up the modem :white_check_mark:
  • able to reach SIM using modem’s interface :white_check_mark:
  • SIM activated :white_check_mark:
  • can’t register to any cellular network :x:
mmcli -m a
  --------------------------------
  General  |                 path: /org/freedesktop/ModemManager1/Modem/0
           |            device id: 7e62xxxx
  --------------------------------
  Hardware |         manufacturer: Quectel
           |                model: RG255C-GL
           |    firmware revision: RG255CGLABR01A04M4G
           |            supported: gsm-umts
           |              current: gsm-umts
           |         equipment id: 86462406004XXXX
  --------------------------------
  System   |               device: /sys/devices/platform/3610000.xhci/usb1/1-2
           |              drivers: option
           |               plugin: quectel
           |         primary port: ttyUSB2
           |                ports: ttyUSB2 (at)
  --------------------------------
  Status   |       unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           |                state: disabled
           |          power state: on
           |       signal quality: 0% (cached)
  --------------------------------
  Modes    |            supported: allowed: any; preferred: none
           |              current: allowed: any; preferred: none
  --------------------------------
  IP       |            supported: ipv4, ipv6, ipv4v6
  --------------------------------
  3GPP     |                 imei: 86462406004XXXX
  --------------------------------
  3GPP EPS | ue mode of operation: ps-2
  --------------------------------
  SIM      |     primary sim path: /org/freedesktop/ModemManager1/SIM/0


mmcli -m 0 --command='AT+C5GREG=1'
response: ''

mmcli -m 0 --command='AT+CEREG=1'
response: ''

mmcli -m 0 --command='AT+CGDCONT=?'
response: '+CGDCONT: (1-16),"IP",,,(0-3),(0-4),(0-1),(0-1),,,,,,,,,(0-1),,(0-1),,,(0-1)
+CGDCONT: (1-16),"IPV6",,,(0-3),(0-4),(0-1),(0-1),,,,,,,,,(0-1),,(0-1),,,(0-1)
+CGDCONT: (1-16),"IPV4V6",,,(0-3),(0-4),(0-1),(0-1),,,,,,,,,(0-1),,(0-1),,,(0-1)'

mmcli -m 0 --command='AT+COPS=?'
error: command failed: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Serial.ResponseTimeout: Serial command timed out'

How to register to 5G network and connect?

Dear @Kubicz

RG255C is reacap module, it only can register on 5G with 20M bandwidth.

Please check your configuration via AT command below:
AT+CFUN?
AT+CPIN?
AT+QCSQ
AT+COPS?
AT+QNWPREFCFG=“mode_pref”

Hi @silvia, thank you for reply.
My output:

sudo mmcli -m 0 --command='AT+CFUN?'
response: '+CFUN: 1'
sudo mmcli -m 0 --command='AT+CPIN?'
response: '+CPIN: READY'
sudo mmcli -m 0 --command='AT+QCSQ'
response: '+QCSQ: "LTE",-76,-114,-3,-18'
sudo mmcli -m 0 --command='AT+COPS?'
response: '+COPS: 0,0,"Plus",7'
sudo mmcli -m 0 --command='AT+QNWPREFCFG="mode_pref"'
response: '+QNWPREFCFG: "mode_pref",AUTO'

Which means for the first time it was able to show any network in the AT+COPS? command.

However with ModemManager, I still get Network timeout. I’m going to try with QConnectManager now.

sudo mmcli -m 0 --simple-connect='apn=iot.truphone.com'
error: couldn't connect the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.NetworkTimeout: Network timeout'

I just cross-compiled and run QConnectManager v1.6.7 and I see this output:

./quectel-CM -s iot.truphone.com &
[11-07_12:07:05:714] QConnectManager_Linux_V1.6.7
[11-07_12:07:05:716] Find /sys/bus/usb/devices/1-2 idVendor=0x2c7c idProduct=0x316, bus=0x001, dev=0x004
[11-07_12:07:05:716] network interface '' or qmidev '' is not exist
[11-07_12:07:05:717] atdevice_detect failed
[11-07_12:07:05:717] qmidevice_detect failed

I don’t see /dev/cdc-wdm0 device in Linux. I have

sudo dmesg | grep qmi
[   13.941259] usbcore: registered new interface driver qmi_wwan_q

Probably need to make QMI over /dev/cdc-wdm0 work first.
In qmi_wwan_q, I have

{ QMI_FIXED_RAWIP_INTF(0x2C7C, 0x0316, 3, mdm9x40) }, /* Quectel RG255 */

so I expect this module to be recognized, however I don’t see a message that should appear from qmi_wwan_q, soething like “qmi_wwan_q 1-1.3:1.4 wwan0: register ‘qmi_wwan_q’ at usb-101c0000.ehci-1.3, WWAN/QMI device, da:0b:ce:b2:db:21”

How to make the qmi_wwan_q recognize my modem as QMI/cdc-wdm device?

I strictly followed
and I have these drivers present:

ls /sys/bus/usb/drivers
**cdc_wdm**  hub  **option**  **qmi_wwan_q**  snd-usb-audio  uas  usb  usb-storage	usbfs  usbhid

But the /dev/cdc-wdm0 is not present.

Dear @Kubicz
Your device had register on 4G network.
‘+COPS: 0,0,“Plus”,7’

If use QConnectManager, please uninstall ModemManager.

You can try to insmod cdc-wdm driver.

Hi @silvia

ModemManager is not running, it was stopped before running QConnectManager.

I think cdc-wdm is not available as a module

find /lib/modules/$(uname -r) -type f -name '*.ko' | grep cdc
/lib/modules/5.10.104+/kernel/drivers/net/usb/cdc_eem.ko
/lib/modules/5.10.104+/kernel/drivers/net/usb/cdc_ether.ko
/lib/modules/5.10.104+/kernel/drivers/net/usb/cdc_mbim.ko
/lib/modules/5.10.104+/kernel/drivers/net/usb/cdc_ncm.ko
/lib/modules/5.10.104+/kernel/drivers/net/usb/cdc_subset.ko

I’m trying to set up the drivers again using 5G USB Driver Guide.

Hi @silvia
Can you share the latest USB Driver guide? I have Quectel_UMTS_LTE_5G_Linux_USB_Driver_User_Guide_V3.1.pdf but it doesn’t mention RG255C. Maybe there’s a newer release?

Please check the Quectel_UMTS_LTE_5G_Linux_USB_Driver_User_Guide_V3.2.
Please check
lsusb -t on your device.

Thank you @Bean.Wang-Q , I received your message with pdf file.

I reviewed again all the changes that I have made to Linux drivers, including USB option.c and qmi_wwan_q.c, however the /dev/cdc-wdm0 interface does not appear.

At which point should I run AT+QCFG="usbnet",0 to configure the type of USBnet interface as RmNet? Is it ok to run it after the modem was already detected by USB option driver? (I guess it’s not possible to send AT command before having USB option initilalized).

About your suggestion to check lsusb -t, I see USB option but no cdc-wdm / qmi interface.

$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 10000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 480M
    |__ Port 2: Dev 2, If 2, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 2: Dev 2, If 3, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 2: Dev 2, If 1, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 4: Dev 4, If 0, Class=Wireless, Driver=, 12M
        |__ Port 4: Dev 4, If 1, Class=Wireless, Driver=, 12M

Modify the kernel’s built-in driver qmi_wwan.c

{QMI_QUIRK_SET_DTR(0x2c7c, 0x0316, 3)}, /* Quectel X35 */

Modify the kernel’s built-in driver option.c

{ USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0316, 0xff),
.driver_info = RSVD(3) },

Thank you @Bean.Wang-Q , I already have applied these changes previously, and the gives the result as the logs shared above

I don’t understand what you mean

Where is it from?
If it works, you can see it rmnet network interface and you can see the qmi_wwan in the lsusb -t.

Sorry, it’s not possible to edit the post. Disregard the G=“usbnet” part, it was in the post by mistake.

{QMI_QUIRK_SET_DTR(0x2c7c, 0x0316, 3)}, /* Quectel X35 */

{ USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0316, 0xff),
.driver_info = RSVD(3) },

I wanted to say that I already have applied these changes previously, and the gives the result as the logs shared above.

The usb interface 3 should match the qmi_wwan. And you should modify the option.c.

Hi Bean, can you provide the patch? Or say which version of the driver you used / which line numbers need to be modified?

In the option.c that I have (kernel 5.10) there is no USB_DEVICE_INTERFACE_CLASS for Quectel, instead there is e.g.

	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
	{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
	  .driver_info = RSVD(4) },
	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
	  .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },

I added the RSVD(3) bitmask this way:

	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C_GL, 0xff, 0xff, 0xff),
	  .driver_info = RSVD(3) | NUMEP2 },

Is it correct?

I also have this patch:

+#if 1 // Added by Quectel (5G Linux USB driver User Guide)
+	if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+		__u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
+
+		struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
+		if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
+			// ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
+			return -ENODEV;
+		}
+		if ((idProduct & 0xF000) == 0x0000) {
+			// MDM interface 4 is QMI
+				&& intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
+			if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
+			return -ENODEV;
+		}
+	}
+#endif

should I adjust this part as well?

You can just check

lsusb -t

make sure that the interface 3 not match the option.

You can check

cat /sys/kernel/debug/usb/devices

Hi! I have made changes as in the attached patches. Now I have this situation: Interface 3 - qmi_wwan_q driver, Interface 1 - option driver, however interfaces 0 and 2 now don’t have any driver assigned.
0002-usb-option-Add-support-for-RG255C-5G-modem.patch (2.6 KB)

Any idea how to make it work? (I think we want to have 0,1,2 - option tty, 3 - qmi)

lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 480M
    |__ Port 2: Dev 2, If 2, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 2: Dev 2, If 3, Class=Vendor Specific Class, Driver=qmi_wwan_q, 480M
    |__ Port 2: Dev 2, If 1, Class=Vendor Specific Class, Driver=option, 480M


$ sudo cat /sys/kernel/debug/usb/devices
T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0316 Rev= 5.15
S:  Manufacturer=Quectel
S:  Product=RG255C-GL
S:  SerialNumber=53856300
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 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#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 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=40 Driver=(none)
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=83(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=50 Driver=qmi_wwan_q
E:  Ad=86(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms