Enabling wlan0 and rmnet on Android

Hi,

Regret for the long post.

On the MangoH red board, have connected sim and able to make a call and use data connection. Also to the same board, connected talon Wifi module and able to get the wlan0 up.
This whole setup is connected to Android based hardware which will be accessing sim and well as wifi. The Android is the master which will initiate all the commands for enabling and disabling cellular nw as well as wifi.

For the Cellular network, Android Ril Integration Guide 4117325 was followed. And able to successfully get cellular connectivity. So all the mangoh usb ports enumerate as USB modem ports.

For the Wifi, wrote a atServer app at the MangoH board side which will receive at cmds from Android and perform Wifi operations. For this used raw port, enabled using USBcomp=9014D. Able to get this port up on PC and run custom at commands.
Used GobiSerial.c on Android platform and able to get this port working

Below are the issues currently facing.

  1. When GobiSerial.c file is used for the raw Port, the USB modem ports for cellular communication is broken. For cellular communication sierra.c file is used. How to enable both serial and usb modem ports on Android like it happens on PC(Ubuntu PC).

  2. Both rmnet and wlan0 are accessed using usb0 interface from Android. Will there be any dhcpc issues ? How to resolve this? If dhcpcd_usb0 is up and running then, the cellular network data is not comming up.

Any inputs will really help.

  1. the RIL is hardcoded to use particular /dev/ttyUSB port, if you enable raw port, of course the RIL will not work. You need to shut down NMEA port in this case.
  2. "Both rmnet and wlan0 are accessed using usb0 interface from Android. " -> don’t quite understand this one.
    If you use RIL driver, only one interface will be used to be data connection. From \AndroidFS\system\vendor\bin\init.dhcpcd, I believe this interface should be wwan0.
    Is the usb0 here meaning ECM interface?

For

  1. If i disable NMEA port, enable raw Port, without any driver changes, RIL and raw port will work ? Will check, bcoz if i disabled NMEA the ril libs had issues. Will recheck once.

  2. With RIL driver which interface is used for data connection ? in the init.dhcpcd the interface is wwan0.
    usb0 on Android is the ecm interface of MangoH red board.

1.Ril lib should not know about nmea
2.then what is the problem? Wwan0 and usb0 are two different interface

  1. Currently, usbcomp=9014D. What is the value for disabling NMEA. I gave 90149. It gve error

  2. when the usb0 has dhcpcd running on the android, the wwan0 inteface is facing issues and not enabling data connection.

  1. You can check by
    at!entercnd=“A710”
    At!usbcomp=?

  2. Maybe you use static ip for usb0

is the value 90109 correct ?
Disabling the NMEA, the Android board is not able to get the radio signals.
I get only interface #0 and #3. Can you let me know what these interfaces are ?

Logs :
4>[ 25.925945] usb 1-1.3: config 1 has no interface number 7
<6>[ 25.938591] usb 1-1.3: New USB device found, idVendor=1199, idProduct=68c0
<6>[ 25.938602] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 25.938609] usb 1-1.3: Product: Sierra Wireless WP7608
<6>[ 25.938615] usb 1-1.3: Manufacturer: Sierra Wireless, Incorporated
<6>[ 25.938622] usb 1-1.3: SerialNumber: XG81428546071017
<7>[ 25.953582] usb 1-1.3: sierra_probe
<7>[ 25.953592] usb 1-1.3: Ignoring blacklisted interface #16
<7>[ 25.983012] usb 1-1.3: sierra_probe
<7>[ 25.983024] usb 1-1.3: sierra_calc_num_ports
<6>[ 25.983032] sierra 1-1.3:1.0: Sierra USB modem converter detected
<7>[ 25.983047] usb 1-1.3: sierra_startup
<7>[ 25.983056] usb 1-1.3: Memory usage (urbs) interface #0, in=4, out=4
<6>[ 25.983063] usb 1-1.3: APM supported, enabling autosuspend.
<6>[ 25.984037] usb 1-1.3: Sierra USB modem converter now attached to ttyUSB0
<7>[ 25.984618] usb 1-1.3: sierra_probe
<7>[ 25.984627] usb 1-1.3: sierra_calc_num_ports
<6>[ 25.984634] sierra 1-1.3:1.3: Sierra USB modem converter detected
<7>[ 25.984650] usb 1-1.3: sierra_startup
<7>[ 25.984659] usb 1-1.3: Memory usage (urbs) interface #3, in=8, out=64
<6>[ 25.984685] usb 1-1.3: APM supported, enabling autosuspend.
<6>[ 25.985618] usb 1-1.3: Sierra USB modem converter now attached to ttyUSB1
<6>[ 25.998543] GobiNet 1-1.3:1.8 wwan0: register ‘GobiNet’ at usb-msm_hsusb_host-1.3, GobiNet Ethernet Device, a6:95:cb:09:10:1b
<6>[ 25.998860] USB Speed : USB 2.0
<6>[ 26.006245] cdc_ether 1-1.3:1.19 usb0: register

How about at!usbcomp=1,1,90149

Interface 16 and 5 are ignored. 16 is audio while 5 is raw port. Which are blacklisted in the driver.

the Android board is not able to get the radio signals still.

Logs :
<6>[ 32.247959] usb 1-1.4: New USB device found, idVendor=1199, idProduct=68c0
<6>[ 32.247971] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 32.247978] usb 1-1.4: Product: Sierra Wireless WP7608
<6>[ 32.247985] usb 1-1.4: Manufacturer: Sierra Wireless, Incorporated
<6>[ 32.247992] usb 1-1.4: SerialNumber: XG81428546071017
<7>[ 32.261608] usb 1-1.4: sierra_probe
<7>[ 32.261619] usb 1-1.4: Ignoring blacklisted interface #16
<7>[ 32.286864] usb 1-1.4: sierra_probe
<7>[ 32.286877] usb 1-1.4: sierra_calc_num_ports
<6>[ 32.286885] sierra 1-1.4:1.0: Sierra USB modem converter detected
<7>[ 32.286904] usb 1-1.4: sierra_startup
<7>[ 32.286914] usb 1-1.4: Memory usage (urbs) interface #0, in=4, out=4
<6>[ 32.286921] usb 1-1.4: APM supported, enabling autosuspend.
<6>[ 32.287318] usb 1-1.4: Sierra USB modem converter now attached to ttyUSB0
<7>[ 32.287704] usb 1-1.4: sierra_probe
<7>[ 32.287712] usb 1-1.4: sierra_calc_num_ports
<6>[ 32.287719] sierra 1-1.4:1.3: Sierra USB modem converter detected
<7>[ 32.287734] usb 1-1.4: sierra_startup
<7>[ 32.287744] usb 1-1.4: Memory usage (urbs) interface #3, in=8, out=64
<6>[ 32.287751] usb 1-1.4: APM supported, enabling autosuspend.
<6>[ 32.288093] usb 1-1.4: Sierra USB modem converter now attached to ttyUSB1
<7>[ 32.288484] usb 1-1.4: sierra_probe
<7>[ 32.288492] usb 1-1.4: Ignoring blacklisted interface #5
<6>[ 32.292616] GobiNet 1-1.4:1.8 wwan0: register ‘GobiNet’ at usb-msm_hsusb_host-1.4, GobiNet Ethernet Device, 2a:9c:00:7c:3a:2a
<6>[ 32.296366] USB Speed : USB 2.0
<6>[ 32.308404] cdc_ether 1-1.4:1.19 usb0: register ‘cdc_ether’ at usb-msm_hsusb_host-1.4, CDC Ethernet Device, 52:2b:f7:f5:1c:91
<6>[ 33.906180] u8Type:0x02, TID:0x00 ,MSGID:0x27

Why raw port is ignored?
If you cannot make raw port replace nmea port, then ril will not work

If i m not wrong, the driver code, has interface numbers which are blacklisted.
I am not sure what are the interface numbers. Raw port is ignored.

Can you let me know what interface number is what ? Are the below correct ?
16 - audio,
5 - raw port.
0 - Diag
3 - Modem
2 - NMEA

Attaching the driver file. Please see line 445.
sierra.c (53.2 KB)
static const signed char qmi_9x15_non_serial_ifaces = {1,4,5,8,10,11,16,19,20};
static const struct sierra_iface_info qmi_9x15_interface_blacklist = {
.infolen = ARRAY_SIZE( qmi_9x15_non_serial_ifaces ),
.ifaceinfo = qmi_9x15_non_serial_ifaces,
};

Never tried this before, you can enable those two interfaces and give a try

FYI, I remember I tried on Android 8 with
at!usbcomp=1,1,80149

I can start the RIL driver.

But the RawIP port is up in the Android device ? the sierra.c file has blacklisted it.

If i remove the #5 from the list, then the ril driver is not up.

Can you pls confirm so that i can know where i am going wrong

can you try this setting first?
at!usbcomp=1,1,80149

At that time I don’t enable the audio port.

what /dev/ttyUSB port can you see?

There are 3 ports, /dev/ttyUSB0, 1 and 2. NMEA is disabled.

Alternatively, i also tried to disable rawIP port and use sockets for communicating with atServer app on the MangoH red board side.
Was able to successfuly communicate with sockets from the Android side with usb0(whcih is ecm0 on MangoH Red board) enabled on boot up.

in the init.qcom.rc file,
service dhcpcd_usb0 /system/bin/dhcpcd -ABKLG
class late_start
disabled
oneshot

enables the usb0 at bootup. So the sockets work.

This disables the wwan0 enabling.

Is there some settings on Android for using the wwan0 first and then when enable usb0 when required ?

In the init.dhcpcd the interface is wwan0. Should i do something there ?

Basically, the question, “Is there some setting similar to ril integration on Android with MangoH Red +Wifi”

as said before, you can use static IP for usb0:
ifconfig usb0 192.168.2.3

Yes, as per suggestion, did assign usb0, but the dhcpc is still on the wwan0 and hence, when i try sockets from my Anroid application(apk), the default routing is through wwan0 and not the usb0.

Tried setting the ip tables defualt to usb0, but that also did not work.

So wanted to know if there are settings for usb0 routing ? (I know its a general Android stuff, but that did not work, so wanted to check if this was done)

seems need to use some “ndc” command.
In the past, I have tried not using the RIL but using AT!SCACT command to establish data connection.
I need to type the following in the Android console in order to make the browser in android to connect to network, you might give a try to change the wwan0 to usb0 and see what happens:

ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1184 TX bytes:1184

wwan0     Link encap:Ethernet  HWaddr ce:6a:d4:fb:9b:08  Driver GobiNet
          inet addr:10.105.171.186  Bcast:10.105.171.187  Mask:255.255.255.252
          inet6 addr: fe80::cc6a:d4ff:fefb:9b08/64 Scope: Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:41 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10511 TX bytes:7216


ndc network create 10
ndc network interface add 10 wwan0
ndc network route add 10 wwan0 0.0.0.0/0 10.105.171.186
ndc network default set 10

Thanks jyijyi.

I did that setting, while i was able to communicate with the atServer Socket app on the WP from Android, i was not able to ping or browse.

Android :
shell@:confused: # ndc network create 10
200 0 success
shell@:confused: # ndc network interface add 10 usb0
200 0 success
shell@:confused: # ndc network route add 10 usb0 0.0.0.0/0 192.168.2.3
200 0 success
shell@:confused: # ndc network default set 10
200 0 success
shell@:confused: # ifconfig usb0
usb0: ip 192.168.2.3 mask 255.255.255.0 flags [up broadcast running multicast]
shell@:confused: # ifconfig wwan0
wwan0: Cannot assign requested address
255|shell@:confused: # ping www.google.com
ping: unknown host www.google.com

WP:

wlan0 Link encap:Ethernet HWaddr F4:E1:1E:37:81:2E
inet addr:192.168.43.217 Bcast:192.168.43.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:986 (986.0 B) TX bytes:1330 (1.2 KiB)

root@swi-mdm9x28-wp:~# ping www.google.com
PING www.google.com (142.250.76.36): 56 data bytes
64 bytes from 142.250.76.36: seq=0 ttl=115 time=91.126 ms
64 bytes from 142.250.76.36: seq=1 ttl=115 time=18.203 ms
^C
www.google.com ping statistics —
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 18.203/54.664/91.126 ms
root@swi-mdm9x28-wp:~#