Activate Tethering with ADB - Android 5.1 I'm on LINUX, and I've create a simple script to activate :
- Data connexion (3G/4G) switch ON
- Enable tethering switch ON
- Change PC ethernet connexion

So I've just have to plug my phone on my USB, and launch my script and voila :)

But, recently I've got a new phone (Xiaomi MI4c) which works with android 5.1.1
And my script isn't working properly, and I don't know why !:crying:
Everything works, except "enable tethering" with ADB:

#adb shell su -c 'service call connectivity 30 i32 1' 
Result: Parcel(
  0x00000000: 00000000 00000002 00000006 006e0062 '............b.n.'
  0x00000010: 00700065 0064005c 00000000 00000006 'e.p.\.d.........'
  0x00000020: 00740062 0070002d 006e0061 00000000 'b.t.-.p.a.n.....')


And nothing happend

adb works fine :

# adb shell su -c 'service list connectivity'  |grep connectivity
54  connectivity: [android.net.IConnectivityManager]


I've found this :

service call connectivity 32 i32 1 on Ice Cream Sandwich (4.0) 
service call connectivity 33 i32 1 on Jelly Bean (4.1 to 4.3) 
service call connectivity 34 i32 1 on KitKat (4.4)
service call connectivity 30 i32 1 on Lollipop (5.0)


How can I see which number should I use to enable this functionality with ADB ? 

Thanks for your help.
I'm uncertain behind the reason because I reached the result using trial and error but this command would do the job for Android 5.1.1:

service call connectivity 31 i32 1


As expected, you need root privileges. 

Also, you may be able to get something interesting from the source code of a service, in this case, it would be android.net.IConnectivityManager.