RG255C-GL GPS with ModemManager/libqmi

Hello,
I am using the modem with firmware RG255CGLABR01A02M4G on ModemManager 1.22.0 with libqmi 1.34.0. When I attempt to enable gps-nmea I get this

~# mmcli -m 0 --location-enable-gps-nmea
error: couldn't setup location gathering: 'GDBus.Error:org.freedesktop.libqmi.Error.Protocol.InvalidArgument: Couldn't enable location 'gps-nmea' gathering: Couldn't not register tracking events: QMI protocol error (48): 'InvalidArgument''

Debug log of the modem manager gets me then this

ModemManager[7141]: <dbg> [1738179950.631450] [modem0] setting up location sources: '3gpp-lac-ci, gps-nmea'
ModemManager[7141]: <dbg> [1738179950.632967] [modem0] location '3gpp-lac-ci' gathering is already enabled...
ModemManager[7141]: <dbg> [1738179950.633084] [modem0] location 'gps-raw' gathering is already disabled...
ModemManager[7141]: <dbg> [1738179950.633158] [modem0] location 'gps-unmanaged' gathering is already disabled...
ModemManager[7141]: <dbg> [1738179950.633237] [modem0] location 'agps-msa' gathering is already disabled...
ModemManager[7141]: <dbg> [1738179950.633302] [modem0] location 'agps-msb' gathering is already disabled...
ModemManager[7141]: <dbg> [1738179950.633359] [modem0] need to enable the following location sources: 'gps-nmea'
ModemManager[7141]: <dbg> [1738179950.636773] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<<   length = 13
<<<<<<   data   = 01:0C:00:00:10:02:00:03:00:3F:00:00...

ModemManager[7141]: <dbg> [1738179950.636939] [/dev/cdc-wdm0] sent generic request (translated)...
<<<<<< QMUX:
<<<<<<   length  = 12
<<<<<<   flags   = 0x00
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "none"
<<<<<<   transaction = 3
<<<<<<   tlv_length  = 0
<<<<<<   message     = "Get NMEA Types" (0x003F)

ModemManager[7141]: <dbg> [1738179950.660397] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<<   length = 20
<<<<<<   data   = 01:13:00:80:10:02:02:03:00:3F:00:07...

ModemManager[7141]: <dbg> [1738179950.660756] [/dev/cdc-wdm0] received generic response (translated)...
<<<<<< QMUX:
<<<<<<   length  = 19
<<<<<<   flags   = 0x80
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "response"
<<<<<<   transaction = 3
<<<<<<   tlv_length  = 7
<<<<<<   message     = "Get NMEA Types" (0x003F)
<<<<<< TLV:
<<<<<<   type       = "Result" (0x02)
<<<<<<   length     = 4
<<<<<<   value      = 01:00:5E:00
<<<<<<   translated = FAILURE: NotSupported

ModemManager[7141]: <wrn> [1738179950.661085] [modem0] couldn't setup required NMEA traces: QMI protocol error (94): 'NotSupported'
ModemManager[7141]: <dbg> [1738179950.661583] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<<   length = 38
<<<<<<   data   = 01:25:00:00:10:02:00:04:00:22:00:19...

ModemManager[7141]: <dbg> [1738179950.662016] [/dev/cdc-wdm0] sent generic request (translated)...
<<<<<< QMUX:
<<<<<<   length  = 37
<<<<<<   flags   = 0x00
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "none"
<<<<<<   transaction = 4
<<<<<<   tlv_length  = 25
<<<<<<   message     = "Start" (0x0022)
<<<<<< TLV:
<<<<<<   type       = "Minimum Interval between Position Reports" (0x13)
<<<<<<   length     = 4
<<<<<<   value      = E8:03:00:00
<<<<<<   translated = 1000
<<<<<< TLV:
<<<<<<   type       = "Intermediate Report State" (0x12)
<<<<<<   length     = 4
<<<<<<   value      = 02:00:00:00
<<<<<<   translated = disable
<<<<<< TLV:
<<<<<<   type       = "Fix Recurrence Type" (0x10)
<<<<<<   length     = 4
<<<<<<   value      = 01:00:00:00
<<<<<<   translated = periodic-fixes
<<<<<< TLV:
<<<<<<   type       = "Session ID" (0x01)
<<<<<<   length     = 1
<<<<<<   value      = 10
<<<<<<   translated = 16

ModemManager[7141]: <dbg> [1738179950.692246] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<<   length = 20
<<<<<<   data   = 01:13:00:80:10:02:02:04:00:22:00:07...

ModemManager[7141]: <dbg> [1738179950.692577] [/dev/cdc-wdm0] received generic response (translated)...
<<<<<< QMUX:
<<<<<<   length  = 19
<<<<<<   flags   = 0x80
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "response"
<<<<<<   transaction = 4
<<<<<<   tlv_length  = 7
<<<<<<   message     = "Start" (0x0022)
<<<<<< TLV:
<<<<<<   type       = "Result" (0x02)
<<<<<<   length     = 4
<<<<<<   value      = 00:00:00:00
<<<<<<   translated = SUCCESS

ModemManager[7141]: <dbg> [1738179950.693044] [/dev/cdc-wdm0] sent message...
<<<<<< RAW:
<<<<<<   length = 24
<<<<<<   data   = 01:17:00:00:10:02:00:05:00:21:00:0B...

ModemManager[7141]: <dbg> [1738179950.693332] [/dev/cdc-wdm0] sent generic request (translated)...
<<<<<< QMUX:
<<<<<<   length  = 23
<<<<<<   flags   = 0x00
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "none"
<<<<<<   transaction = 5
<<<<<<   tlv_length  = 11
<<<<<<   message     = "Register Events" (0x0021)
<<<<<< TLV:
<<<<<<   type       = "Event Registration Mask" (0x01)
<<<<<<   length     = 8
<<<<<<   value      = 04:00:00:00:00:00:00:00
<<<<<<   translated = nmea

ModemManager[7141]: <dbg> [1738179950.723822] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<<   length = 20
<<<<<<   data   = 01:13:00:80:10:02:02:05:00:21:00:07...

ModemManager[7141]: <dbg> [1738179950.724155] [/dev/cdc-wdm0] received generic response (translated)...
<<<<<< QMUX:
<<<<<<   length  = 19
<<<<<<   flags   = 0x80
<<<<<<   service = "loc"
<<<<<<   client  = 2
<<<<<< QMI:
<<<<<<   flags       = "response"
<<<<<<   transaction = 5
<<<<<<   tlv_length  = 7
<<<<<<   message     = "Register Events" (0x0021)
<<<<<< TLV:
<<<<<<   type       = "Result" (0x02)
<<<<<<   length     = 4
<<<<<<   value      = 01:00:30:00
<<<<<<   translated = FAILURE: InvalidArgument

Is there a way to get it working?
Thanks
Viktor

Have you tried it?

Yes, I did. FTR I also run msc kernel 4.14.151 on an imx6q with this patch applied:

diff -ru a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
--- a/drivers/net/usb/qmi_wwan.c        2019-10-29 09:17:49.000000000 +0100
+++ b/drivers/net/usb/qmi_wwan.c        2024-05-29 20:46:03.633190640 +0200
@@ -1293,6 +1293,7 @@
        {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
        {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
        {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)},    /* Quectel BG96 */
+       {QMI_FIXED_INTF(0x2c7c, 0x0316, 3)},    /* Quectel RG255C */ 
        {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */
 
        /* 4. Gobi 1000 devices */
diff -ru a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
--- a/drivers/usb/serial/option.c       2019-10-29 09:17:49.000000000 +0100
+++ b/drivers/usb/serial/option.c       2024-05-29 20:13:20.302386551 +0200
@@ -250,6 +250,7 @@
 #define QUECTEL_PRODUCT_BG96                   0x0296
 #define QUECTEL_PRODUCT_EP06                   0x0306
 #define QUECTEL_PRODUCT_EM12                   0x0512
+#define QUECTEL_PRODUCT_RG255                  0x0316
 
 #define CMOTECH_VENDOR_ID                      0x16d8
 #define CMOTECH_PRODUCT_6001                   0x6001
@@ -1101,6 +1102,10 @@
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
          .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255, 0xff, 0xff, 0x30) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255, 0xff, 0xff, 0x40) },
+
        { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
        { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
        { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),

{QMI_FIXED_INTF(0x2c7c, 0x0316, 3)},
won’t work
You must try the
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0316, 3)},

I have recompiled the kernel with the QMI_QUIRK_SET_DTR change, but the situation is still the same:

“Get NMEA Types” (0x003F) request returns with FAILURE: NotSupported
and then

<<<<<<   message     = "Register Events" (0x0021)
<<<<<< TLV:
<<<<<<   type       = "Event Registration Mask" (0x01)
<<<<<<   length     = 8
<<<<<<   value      = 04:00:00:00:00:00:00:00
<<<<<<   translated = nmea

returns

<<<<<<   type       = "Result" (0x02)
<<<<<<   length     = 4
<<<<<<   value      = 01:00:30:00
<<<<<<   translated = FAILURE: InvalidArgument

RIght now I think you can try the libqmi/qmicli now.
For the NMEA QMI I will test it in next week.
Could you try

sudo mmcli -m 0 --location-get

~# sudo mmcli -m 0 --location-get
  --------------------------
  3GPP |       operator mcc: 230
       |       operator mnc: 02
       | location area code: 0000
       | tracking area code: 00047A
       |            cell id: 093885E0
~# sudo mmcli -m 0 --location-status
  ------------------------
  Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
           |      enabled: 3gpp-lac-ci
           |      signals: no
  ------------------------
  GPS      | refresh rate: 30 seconds

Hello Bean Wang,

did your tests reveal anything?

I cannot move out of the office to test the GPS.

It is the same with yours.
The location is not fixed.