AG35 drivers in linux (raspberry pi) kernel 6.1.21

Hello support & community:
I am trying to install drivers for modem AG35 to work with raspberry pi (model 3 or 4) but failing on both cases.
My target is to be able to send AT commands through /dev/ttyUSB2 that should appear (I expect) after correctly installing any of those 2 drivers for my AG35 modem into linux (raspberry pi 3/4 kernel 6.1.21).

I have followed Quectel_LTE&5G_Linux_USB_Driver_User_Guide_V2.0.
In my understanding, AG35 works with either:

  • Gobinet
  • QMI_WWAN

The drivers in that package are apparently outdated, since when I tried to compile with my kernel 6.1.21, both of them had errors.
For Gobinet, I got the following error:
Quectel_GobiNet_Driver_V1.6 $ sudo make install ARCH=arm
ln -sf makefile Makefile
make ARCH=arm CROSS_COMPILE= -C /lib/modules/6.1.21-v7+/build M=/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6 modules
make[1]: Entering directory ‘/usr/src/linux-headers-6.1.21-v7+’
CC [M] /home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.o
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c: In function ‘qmap_register_device’:
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:358:21: warning: passing argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
358 | memcpy (qmap_net->dev_addr, real_dev->dev_addr, ETH_ALEN);
| ^~
In file included from ./include/linux/string.h:20,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./include/linux/mm_types_task.h:14,
from ./include/linux/mm_types.h:5,
from ./include/linux/buildid.h:5,
from ./include/linux/module.h:14,
from /home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:55:
./arch/arm/include/asm/string.h:20:22: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
20 | extern void * memcpy(void *, const void *, __kernel_size_t);
| ^~~~~~
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c: In function ‘GobiNetDriverBind’:
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:854:32: error: assignment of read-only location ‘e’
854 | pDev->net->dev_addr[0] |= 0x02; /
set local assignment bit */
| ^~
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:855:32: error: assignment of read-only location ‘pDev->net->dev_addr’
855 | pDev->net->dev_addr[0] &= 0xbf; /
clear “IP” bit */
| ^~
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c: In function ‘GobiUSBNetProbe’:
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:2147:14: warning: passing argument 1 of ‘QuecPrintHex’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
2147 | PrintHex( &pGobiDev->mpNetDev->net->dev_addr[0], 6 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.c:66:
/home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/QMIDevice.h:325:19: note: expected ‘void *’ but arErrorgument is of type ‘const unsigned char *’
325 | void * pBuffer,
| ~~~~~~~~~^
make[2]: *** [scripts/Makefile.build:250: /home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6/GobiUSBNet.o] 1
make[1]: *** [Makefile:2012: /home/svic/raspi-modules/Quectel_GobiNet_Driver_V1.6] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-6.1.21-v7+’
make: *** [makefile:32: default] Error 2

I was able to bypass if I comment the code into GobiUSBNet.c by modifying commenting following part, since error claims that pDev->net->dev_addr is at read-only location:

//#if 1 //def DATA_MODE_RP
// /* make MAC addr easily distinguishable from an IP header /
// if ((pDev->net->dev_addr[0] & 0xd0) == 0x40) {
// /clear this bit wil make usbnet apdater named as usbX(instead if ethX)/
// pDev->net->dev_addr[0] |= 0x02; /
set local assignment bit /
// pDev->net->dev_addr[0] &= 0xbf; /
clear “IP” bit */
// }
//#endif

Even when I was able to load the driver, I don’t see created the /dev/ttyUSB2 expected (not sure if even with correct compilation I will be able to get it.
I see device is recognized with dmesg:
dmesg
[ 1420.480818] usb 1-1.2.1: new low-speed USB device number 8 using dwc2
[ 1420.725257] usb 1-1.2.1: New USB device found, idVendor=0603, idProduct=0002, bcdDevice= 0.01
[ 1420.725313] usb 1-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1420.725330] usb 1-1.2.1: Product: USB Composite Device
[ 1420.725344] usb 1-1.2.1: Manufacturer: SIPODEV
[ 1420.734790] input: SIPODEV USB Composite Device as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.0/0003:0603:0002.0005/input/input8
[ 1420.802291] hid-generic 0003:0603:0002.0005: input,hidraw0: USB HID v1.10 Keyboard [SIPODEV USB Composite Device] on usb-3f980000.usb-1.2.1/input0
[ 1420.818216] input: SIPODEV USB Composite Device Mouse as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/0003:0603:0002.0006/input/input9
[ 1420.819115] input: SIPODEV USB Composite Device Wireless Radio Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/0003:0603:0002.0006/input/input10
[ 1420.883109] input: SIPODEV USB Composite Device System Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/0003:0603:0002.0006/input/input11
[ 1420.888528] input: SIPODEV USB Composite Device Consumer Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.1/1-1.2.1:1.1/0003:0603:0002.0006/input/input12
[ 1420.894187] hid-generic 0003:0603:0002.0006: input,hiddev96,hidraw1: USB HID v1.10 Mouse [SIPODEV USB Composite Device] on usb-3f980000.usb-1.2.1/input1
[ 1421.090831] usb 1-1.2.2: new full-speed USB device number 9 using dwc2
[ 1421.331118] usb 1-1.2.2: New USB device found, idVendor=27c0, idProduct=0819, bcdDevice= 1.13
[ 1421.331150] usb 1-1.2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1421.331166] usb 1-1.2.2: Product: WingCoolTouch
[ 1421.331174] usb 1-1.2.2: Manufacturer: WingCoolTouch
[ 1421.331180] usb 1-1.2.2: SerialNumber: 9LQ0172005164
[ 1421.339803] input: WingCoolTouch WingCoolTouch as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:27C0:0819.0007/input/input13
[ 1421.342942] hid-multitouch 0003:27C0:0819.0007: input,hiddev97,hidraw2: USB HID v1.10 Device [WingCoolTouch WingCoolTouch] on usb-3f980000.usb-1.2.2/input0
[ 1421.348135] hid-generic 0003:27C0:0819.0008: hiddev98,hidraw3: USB HID v1.10 Device [WingCoolTouch WingCoolTouch] on usb-3f980000.usb-1.2.2/input1
[ 1424.320917] hwmon hwmon1: Voltage normalised
[ 1427.821007] usb 1-1.5: new high-speed USB device number 10 using dwc2
[ 1427.963090] usb 1-1.5: New USB device found, idVendor=2c7c, idProduct=0435, bcdDevice= 3.18
[ 1427.963122] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1427.963133] usb 1-1.5: Product: LTE Module
[ 1427.963141] usb 1-1.5: Manufacturer: Quectel, Incorporated
[ 1427.963148] usb 1-1.5: SerialNumber: 9d1f3226
[ 1428.087675] GobiNet: loading out-of-tree module taints kernel.
[ 1428.087677] GobiNet: loading out-of-tree module taints kernel.
[ 1428.092300] GobiNet: Quectel_Linux&Android_GobiNet_Driver_V1.6
[ 1428.098984] GobiNet 1-1.5:1.4 eth1: register ‘GobiNet’ at usb-3f980000.usb-1.5, GobiNet Ethernet Device, aa:6b:f3:b0:1f:b9
[ 1428.102808] creating qcqmi1
[ 1428.104387] usbcore: registered new interface driver GobiNet
[ 1429.121100] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready

@raspberrypi:~ $ lsusb
Bus 001 Device 010: ID 2c7c:0435 Quectel Wireless Solutions Co., Ltd. AG35 LTE modem
Bus 001 Device 009: ID 27c0:0819 Cadwell Laboratories, Inc. WingCoolTouch
Bus 001 Device 008: ID 0603:0002 Novatek Microelectronics Corp. Sino Wealth keyboard/mouse 2.4 GHz receiver
Bus 001 Device 007: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Even when I can see eth1 & qcqmi1, I am not sure if I should get /dev/ttyUSB2 to send AT commands through it.

Could any of you could guide me if I am in the correct way to get /dev/ttyUSB2 when connecting my modem? Is my understanding correct that I could use Gobinet or QMI_WWAN?
Could you please send me the updated drivers for any of those?
I have read that is is preferable to use QMI_WWAN, however any of those that give me the possibility to send AT commands using /dev/ttyUSB2 would be good for me.

Thanks in advance.

Hi,

You are on the correct guide document, please follow the instruction of configuring kernel to make the driver for 6.1.21. Currently we don’t have it for 6.1.21, so manually configure kernel is the only way to do it.

BR,
Louis

You can also try the following command in command line.
echo 2C7C 0435 > /sys/bus/usb-serial/drivers/option1/new_id