# Usb\_modeswitch on air unit

**URL:** <https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446>\
**Category:** HereLink\
**Created:** [5 October 2021 10:20 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446 "2021-10-05T10:20:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [5 October 2021 10:20 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/1 "2021-10-05T10:20:10Z")

</div>

hello gods of herelink  
I’ve compiled libusb and usb\_modeswicth tools for arm air unit unfortunately /system is read-only and I dont find a way to install it correctly  
I try to switch a e3372 modem into eth lan interface mode  
I tryied to set all in the same folder but looks not working

```auto
# ls
libusb1.0.so usb_modeswitch usb_modeswitch.conf 
# ./usb_modeswitch -v 12d1 -p 1f01 -c ./usb_modeswitch.conf                                                                                                                                               
# 

```

thank’s for any info  
@Michael_Oborne any idea ?

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [6 October 2021 03:06 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/2 "2021-10-06T03:06:55Z")

</div>

we ship the air unit with SU capability’s.

so add it to the /data partition

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [6 October 2021 07:54 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/3 "2021-10-06T07:54:20Z")

</div>

Thank’s a lot ! I’ve seen air unit is SU capable but my main question is how to set `libusb1.0.so` correctly in lib folder (should be in `/system/lib64/`) is there any other folder where i can put shared lib ?? `/data/app_lib` or somewhere else ??

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [6 October 2021 08:46 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/4 "2021-10-06T08:46:55Z")

</div>

given when you run it above it didnt crash, are you sure you need to put in in there.

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [6 October 2021 13:39 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/5 "2021-10-06T13:39:47Z")

</div>

I’ tried 2 things :

- use the libusb1.0.so and usb\_modeswitch from remote unit on air unit and I have no output (even the standard one with “usage” when no param are given)
- recompile usb\_modeswitch and libusb :

```auto
# cd arm64-v8a/                                                                                         
# ls
libusb1.0.so usb_modeswitch 
# ./usb_modeswitch                                                                                      
WARNING: linker: /tmp/share/usbms/arm64-v8a/usb_modeswitch: unsupported flags DT_FLAGS_1=0x8000001
# cd ../armeabi-v7a/                                                                                       
# ./usb_modeswitch                                                                                      
WARNING: linker: /tmp/share/usbms/armeabi-v7a/usb_modeswitch: unsupported flags DT_FLAGS_1=0x8000001
# 

```

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [6 October 2021 20:41 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/6 "2021-10-06T20:41:23Z")

</div>

i think you might need to add more debug to the app, as the linker warning are just that, and not the app failing

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [7 October 2021 08:39 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/7 "2021-10-07T08:39:32Z")

</div>

in fact my compiled app is working ok on remote unit as soon as I push it on air unit I got this error I think it’s because It could not find libusb in the right folder

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [7 October 2021 09:19 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/8 "2021-10-07T09:19:45Z")

</div>

run it with strace

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [7 October 2021 10:06 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/9 "2021-10-07T10:06:09Z")

</div>

OK I finally get it to work by setting the libusb at right place (`/system/lib64/`)  
(still have the linker warning but it gets a bit more verbose )

as result I can get my HUAWEI 4G modem goes to Hlink mode and I well get the eth0 interface

```auto
# usb_modeswitch -v 12d1 -p 1f01 -c ./usb_modeswitch.conf   
WARNING: linker: /system/bin/usb_modeswitch: unsupported flags DT_FLAGS_1=0x8000001
test
Look for target devices ...
 No devices in target mode or class found
Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 002 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 8
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI_MOBILE
     Product: HUAWEI_MOBILE
  Serial No.: 0123456789ABCDEF
-------------------------
Using standard Huawei switching message
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response reading failed (error -1)
 Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!

# lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 12d1:14db
# ifconfig 
lmi40 Link encap:UNSPEC  
          inet addr:192.168.0.10 P-t-P:192.168.0.10 Mask:255.255.255.0 
          inet6 addr: fe80::44f5:e09e:6ca8:d124/64 Scope: Link
          UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1550 Metric:1
          RX packets:14971 errors:0 dropped:2 overruns:0 frame:0 
          TX packets:21528 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:500 
          RX bytes:834630 TX bytes:1237393 

eth0 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
          inet6 addr: fe80::21e:10ff:fe1f:0/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:1048 TX bytes:160 

vxlan1 Link encap:Ethernet HWaddr 46:18:60:e1:28:7e
          inet6 addr: fe80::4418:60ff:fee1:287e/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:46 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:0 TX bytes:2888 

br-vxlan Link encap:Ethernet HWaddr b8:8d:f1:ff:34:69
          inet addr:192.168.144.10 Bcast:192.168.144.255 Mask:255.255.255.0 
          inet6 addr: fe80::ba8d:f1ff:feff:3469/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:1048 TX bytes:760 

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:116380 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:116380 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1 
          RX bytes:8196912 TX bytes:8196912 

br-vxlan:0 Link encap:Ethernet HWaddr b8:8d:f1:ff:34:69
          inet addr:192.168.42.10 Bcast:192.168.42.255 Mask:255.255.255.0 
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

```

driver loading looks ok  
status led on modem goes to solid on 4G network every thing looks ok

unfortunately I should get a IPv4 address from CGNAT but I dont … and ping throug eth0 is obviously not working  
I think it’s due to default bridging of eth0 into br-vxlan interface config to work with usb to eth converter  
is it possible to get rid of that ??

```auto
# ping 8.8.8.8
connect: Network is unreachable
# ping -I eth0 8.8.8.8                                                                                        
ping: Warning: source address might be selected on device other than eth0.
PING 8.8.8.8 (8.8.8.8) from 192.168.42.10 eth0: 56(84) bytes of data.
From 192.168.42.10: icmp_seq=1 Destination Host Unreachable
From 192.168.42.10: icmp_seq=2 Destination Host Unreachable
From 192.168.42.10: icmp_seq=3 Destination Host Unreachable
From 192.168.42.10: icmp_seq=4 Destination Host Unreachable
From 192.168.42.10: icmp_seq=5 Destination Host Unreachable
From 192.168.42.10: icmp_seq=6 Destination Host Unreachable
From 192.168.42.10: icmp_seq=7 Destination Host Unreachable
From 192.168.42.10: icmp_seq=8 Destination Host Unreachable
From 192.168.42.10: icmp_seq=9 Destination Host Unreachable
^C
--- 8.8.8.8 ping statistics ---
10 packets transmitted, 0 received, +9 errors, 100% packet loss, time 9132ms
pipe 4

```

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [8 October 2021 06:12 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/10 "2021-10-08T06:12:56Z")

</div>

try  
su  
start dhcpcd

not sure if this will help or not

to stop the auto bridge add

su  
stop usbethx

---

<div class="post-metadata">

**Author:** ![frame](https://discuss.cubepilot.org/letter_avatar_proxy/v4/letter/f/d07c76/32.png) [@frame](https://discuss.cubepilot.org/u/frame)\
**Post date:** [10 October 2021 20:56 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/11 "2021-10-10T20:56:55Z")

</div>

@Olivier_Gasté can you share your compiled usb\_modeswitch binaries to experiment with?

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [11 October 2021 08:02 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/12 "2021-10-11T08:02:08Z")

</div>

yea with pleasure  
[https://drive.google.com/drive/folders/1gk2h9wt5nAFBQ663cQ1A9jF5k8tTnrle?usp=sharing](https://drive.google.com/drive/folders/1gk2h9wt5nAFBQ663cQ1A9jF5k8tTnrle?usp=sharing)  
you need to set .so file into /system/lib64  
and you can put bin in /system/bin

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [11 October 2021 16:48 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/13 "2021-10-11T16:48:37Z")

</div>

I can Have a eth0 not linked to br-vxlan but it start down and even iff I’m turning it up  
I get no IPV4  
and obviously I have no route passing by eth0  
I’m still searching  
thank’s for the help

```auto
eth0 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
          inet6 addr: fe80::21e:10ff:fe1f:0/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:416 TX bytes:834 

```

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [11 October 2021 22:26 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/14 "2021-10-11T22:26:17Z")

</div>

ok,thdhcpcd command i gave above if for dhcp on the bridge. you will need to start dhcp manualy to assign that interface an ip.

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [12 October 2021 08:09 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/15 "2021-10-12T08:09:49Z")

</div>

things I dont understand is that normaly it should get it IP from CGNAT router of LTE provider …

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [12 October 2021 09:44 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/16 "2021-10-12T09:44:49Z")

</div>

YES !!!

```auto
# ping -I eth0 8.8.8.8                                                                                                                                                                                            
PING 8.8.8.8 (8.8.8.8) from 192.168.8.102 eth0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=35.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=110 time=34.2 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=110 time=32.4 ms

```

thank’s a lot !!!  
I finaly get it to work !!  
so for those looking to do same

first : you need correctly libusb.so lib and usb-modswitch tool installed  
you can get source and compile it from here [https://github.com/joerg65/usb\_modeswitch\_Android](https://github.com/joerg65/usb_modeswitch_Android)  
or simply get it from my previous message

- connect your host directly to usb on air unit
- authorize write on system partition  
`adb shell "su 0 mount -o rw,remount /system"`
- autorise push on tmp folder  
`adb shell "su 0 chmod +w /tmp"`
- then copy libusb.so and usb-modswitch to tmp folder  
`adb push <path to your file on host>/libusb1.0.so /tmp/`  
`adb push <path to your file on host>/usb-modeswitch /tmp/`
- moves them to correct folder under a shell  
`adb shell`

```auto
$su
#mv /tmp/libusb1.0.so /system/lib64/
#mv /tmp/usbmodeswitch/system/bin/

```

if you are using like me a HUAWEI 3372 4G modem you will need a conf file for usb-modeswitch tool  
you can directly write string code it’s up to you ( google is your friend) but I prefer readable conf file

- just put the following into a `usb-modeswitch.conf` file and then push it to tmp and moves it to `/etc/` folder

```auto
 TargetVendor=0x12d1
 TargetProductList="14db,14dc"
 HuaweiNewMode=1
 NoDriverLoading=1

```

- unplug your adb host of air unit and get connected to remote
- reboot the air unit
- connect your 4G modem to air unit USB OTG port (please use an externaly powered usb cable)
- as explained here : [Herelink Ethernet - #3 by Michael\_Oborne](https://discuss.cubepilot.org/t/herelink-ethernet/4369/3)

```auto
adb shell (gets you into the gcs unit)
adb connect 192.168.0.10
adb -s 192.168.0.10:5555 shell

```

you will reach a shell on air unit

- disable auto bridging of eth0 interface (thank’s a lot @Michael_Oborne I would have never find this one without you)

```auto
su
stop usbethx

```

- check your modem is well registered on usb

```auto
# lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 12d1:1f01

```

- switch the modem into hilink mode (if you are using another modem you should probably use wwan0 mode and it’s a litel bit more confuse to get qmi working)

```auto
# usb_modeswitch -v 12d1 -p 1f01 -c /etc/usb_modeswitch.conf

```

- check your eth0 is registered with : ` ip a`
- wake up the interface : ` ifconfig eth0 up`
- start dhcpd on eth0 : `dhcpcd-6.8.2 eth0` (it will setup route for you)
- check your fresh IPv4
- check you can ping outside : `ping -I eth0 8.8.8.8`

I still need to setup a dns correctly if someone can help it looks iptable is empty and seems android dont care about resolve.conf  
thank’s for all helps

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [25 October 2021 16:44 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/17 "2021-10-25T16:44:39Z")

</div>

to set a dns:  
I’ve try to add a `/syste/etc/resolv.conf`  
with `nameserver 8.8.8.8` inside (I tested 8.8.4.4 and some others found around internet)  
I’m still unable to ping 8.8.8.8  
but [www.google.com](http://www.google.com) is still unknown host

---

<div class="post-metadata">

**Author:** ![Mohammad\_Khazaeei](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/mohammad_khazaeei/32/4434_2.png) [@Mohammad\_Khazaeei](https://discuss.cubepilot.org/u/Mohammad_Khazaeei)\
**Post date:** [26 October 2021 05:35 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/18 "2021-10-26T05:35:40Z")

</div>

How do you command  
su  
It is locked for me

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [26 October 2021 07:39 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/19 "2021-10-26T07:39:08Z")

</div>

you have to be aware that su is lock on remote but available on air unit  
here we speaking on putting 4G network capability on air unit

---

<div class="post-metadata">

**Author:** ![Olivier\_Gasté](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/olivier_gast%C3%A9/32/4309_2.png) [@Olivier\_Gasté](https://discuss.cubepilot.org/u/Olivier_Gast%C3%A9)\
**Post date:** [26 October 2021 07:48 UTC](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446/20 "2021-10-26T07:48:57Z")

</div>

> [@Olivier\_Gasté](#):
>
> to set a dns:  
> I’ve try to add a `/syste/etc/resolv.conf`  
> with `nameserver 8.8.8.8` inside (I tested 8.8.4.4 and some others found around internet)  
> I’m still unable to ping 8.8.8.8  
> but [www.google.com](http://www.google.com) is still unknown host

same result using `setprop`

```
# setprop net.dns1 8.8.8.8 
# getprop | grep dns                                                                                    
[net.change]: [net.dns1]
[net.dns1]: [8.8.8.8]
# ping google.com
ping: unknown host google.com
# ping 8.8.8.8                                                                                          
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=95.8 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=110 time=34.5 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 34.513/65.193/95.873/30.680 ms

```

[Next page](https://discuss.cubepilot.org/t/usb-modeswitch-on-air-unit/7446.md?page=2)
