Why Linux Box Can't Connect To Quectel IoT Modems via ADB Interface ? Troubleshooting with Quectel Modules EC2x QuecOpen

Why Linux Box Can't Connect To Quectel IoT Modems via ADB Interface ? Troubleshooting with Quectel Modules EC2x QuecOpen

ADB (Android Debug Bridge) is a development tool that facilitates communication between your Linux box and Android device. ADB USB interface is found in Qualcomm based IoT Modules like EC21, EC25, AG35, SC20, ... with big memory size running Linux OS.

When supporting major customers using QuecOpen, Standard modules from Quectel, general questions are:

  • Why my Ubuntu can't see module using adb devices ?
  • Why after installed drivers, I can see all other USB interface, but adb interface is missing ?

This post is meant for Linux users only. For Mac users, you can connect to modules via adb without any issue as long as adb interface is enabled in the FW.

Before doing deeply into this analysis, you may need to look at how to bring up USB driver for Quectel IoT modules and understand Standard and QuecOpen modules.

Standard and QuecOpen Modules

Standard Modules - are running the standard firmware. Your Linux box can only see 4 USB interfaces: DM, NMEA, AT, PPP as I described here.

Successful loaded driver looks like this:

# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#= 11 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0125 Rev= 3.18
S:  Manufacturer=Android
S:  Product=Android
C:* #Ifs= 5 Cfg#= 1 Atr=80 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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
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=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
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=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

By default adb interface is disabled and root login is protected with standard firmware, pls contact local FAE presentative to get instruction how to activate ADB and root password if you want to go further.

2) QuecOpen Modules - where you got base QuecOpen SDK and base FW from local Quectel FAE. You can refer to my post how to develop with QuecOpen.

After module is flashed with QuecOpen FW, ADB interface is enabled, however wrong driver is loaded at interface 5.

# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0125 Rev= 3.18
S:  Manufacturer=Android
S:  Product=Android
C:* #Ifs= 6 Cfg#= 1 Atr=80 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= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
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=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
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=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=option
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

More details at option driver:

# ls -la /sys/bus/usb/drivers/option/
total 0
drwxr-xr-x  2 root root    0 May 10 10:49 .
drwxr-xr-x 11 root root    0 May 10 10:46 ..
lrwxrwxrwx  1 root root    0 May 10 10:49 1-2:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0
lrwxrwxrwx  1 root root    0 May 10 10:49 1-2:1.1 -> ../../../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.1
lrwxrwxrwx  1 root root    0 May 10 10:49 1-2:1.2 -> ../../../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.2
lrwxrwxrwx  1 root root    0 May 10 10:49 1-2:1.3 -> ../../../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.3
lrwxrwxrwx  1 root root    0 May 10 10:49 1-2:1.5 -> ../../../../devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.5
--w-------  1 root root 4096 May 10 10:49 bind
lrwxrwxrwx  1 root root    0 May 10 10:49 module -> ../../../../module/usbserial
--w-------  1 root root 4096 May 10 10:46 uevent
--w-------  1 root root 4096 May 10 10:49 unbind

Action: You need to unbind ADB interface 1-2:1.5 so option driver will not load it. (Replace 1-2:1.5 with correct interface in your system)

# echo "1-2:1.5" > /sys/bus/usb/drivers/option/unbind

From this point, your Linux box is able to communicate with IoT modules via adb already.

Your Linux box should have android-tools-adb and android-tools-fastboot installed. With Ubuntu:

sudo apt-get update
sudo apt-get install git android-tools-adb android-tools-fastboot

Then, you can see module:

$ sudo adb devices
List of devices attached
(no serial number)	device

For any reason, you can restart adb server: sudo adb kill-server

How To Use ADB Under Normal User

It is not my habit to run ADB under sudo, thus more works to do. When execute from user space, there is no device:

$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached

Reason: you have no permission to access that USB interface, thus let's create udev rule to permit read/write access to others (where 0x2c7c is Quectel USB VID).

## Add rule to permit rw access
cat <<EOF > /etc/udev/rules.d/51-android.rules

# Quectel modules
SUBSYSTEM=="usb", ATTR{idVendor}=="2c7c", MODE="0666", GROUP="wheel", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF

## Restart udev service
sudo service udev restart

In addition, you also need to tell ADB server to load correct VID by adding adb_usb.ini in .android folder at home. (Remember: .android folder is created after adb devices command is executed.

# Add adb_usb.ini to .android folder
cat <<EOF > ~/.android/adb_usb.ini
0x2c7c
EOF

Now, let's enjoy our work:

# Kill existing adb server
adb kill-server
# List device again
adb devices

Good luck!