Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Does JellyBean support USB tether?

Is there a way compile the JB source so USB tether is always enabled? I would like to have the support through the OS and not depend on an App.

share|improve this question
add comment

2 Answers

Yes.

On ICS the setting can be found at

Settings -> Wireless & Networks -> More.. -> Tethering & portable hotspot -> USB tethering

I think it should be at the same place on Jelly Bean. Note that you need a device with a cellular data chip for this feature. Devices without (e.g. the Nexus 7) won't show this option.

USB tethering support was added with the 2.2 (Froyo) release

share|improve this answer
3  
@Chris: The Nexus 7 doesn't support it. It's only available on devices with cellular data chips (3G/4G). What you want is more like this: android.stackexchange.com/questions/3134/… –  eldarerathis Aug 30 '12 at 19:12
1  
@Chris maybe you want to explain to us what you want to do. Do you want to do reverse tethering over USB? What problem to you want to solve? –  Flow Aug 30 '12 at 19:17
3  
Tethering is more then just IP communication, it includes the routing of the packets to the internet. That's why I rephrased your question to "How can I enable IP communication over USB?". My answer is correct as long as you ask for USB tethering. I suggest you create a new question and write down exactly what you trying to achieve/which problem you want to solve. –  Flow Aug 30 '12 at 19:42
2  
Sure it can be used for that, but it isn't available on your Nexus 7. Wouldn't you accept an answer that solves your problem without tethering involved? Maybe reverse-tethering? Maybe something else? Why has the solution of your problem have be done with tethering if there are maybe other solutions? Besides Wikipedia says that it implies "sharing a internet connection". –  Flow Aug 30 '12 at 19:50
7  
@Chris you have an XY problem. –  kinokijuf Aug 31 '12 at 15:30
show 9 more comments
up vote 2 down vote accepted

I successfully got native USB tethering working on the Nexus 7 with Jelly Bean.

Modify the device/asus/grouper/overlay/frameworks/base/core/res/res/values/config.xml to be the following:

<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<!-- These resources are around just to allow their values to be customized
     for different hardware and product builds. -->
<resources>
    <!-- Flag indicating whether we should enable the automatic brightness in Settings.
     config_hardware_automatic_brightness_available is not set, so we will use software implementation -->
    <bool name="config_automatic_brightness_available">true</bool>

    <!-- There is no charging LED. -->
    <bool name="config_unplugTurnsOnScreen">true</bool>

    <!-- Our amoled doesn't animate well. -->
    <bool name="config_animateScreenLights">false</bool>

    <!-- disable menu hard key on Crespo in non-pattern lockscreen -->
    <bool name="config_disableMenuKeyInLockScreen">true</bool>

    <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
     The N entries of this array define N + 1 zones as follows:

     Zone 0:        0 <= LUX < array[0]
     Zone 1:        array[0] <= LUX < array[1]
     ...
     Zone N:        array[N - 1] <= LUX < array[N]
     Zone N + 1:    array[N] <= LUX < infinity

     Must be overridden in platform specific overlays -->
    <integer-array name="config_autoBrightnessLevels">
    <item>7</item>
    <item>94</item>
    <item>208</item>
    <item>458</item>
    <item>2223</item>
    </integer-array>

    <!-- Array of output values for LCD backlight corresponding to the LUX values
     in the config_autoBrightnessLevels array.  This array should have size one greater
     than the size of the config_autoBrightnessLevels array.
    -->
    <integer-array name="config_autoBrightnessLcdBacklightValues">
    <item>10</item>
    <item>35</item>
    <item>55</item>
    <item>70</item>
    <item>70</item>
    <item>250</item>
    </integer-array>

    <!-- Array of output values for button backlight corresponding to the LUX values
     in the config_autoBrightnessLevels array.  This array should have size one greater
     than the size of the config_autoBrightnessLevels array.
    -->
    <integer-array name="config_autoBrightnessButtonBacklightValues">
    <item>255</item>
    <item>255</item>
    <item>255</item>
    <item>0</item>
    <item>0</item>
    <item>0</item>
    </integer-array>

    <!-- Array of output values for keyboard backlight corresponding to the LUX values
     in the config_autoBrightnessLevels array.  This array should have size one greater
     than the size of the config_autoBrightnessLevels array.
     Crespo has no keyboard so all values are zero.
    -->
    <integer-array name="config_autoBrightnessKeyboardBacklightValues">
    <item>0</item>
    <item>0</item>
    <item>0</item>
    <item>0</item>
    <item>0</item>
    <item>0</item>
    </integer-array>

    <!-- Minimum screen brightness allowed by the power manager. -->
    <integer name="config_screenBrightnessDim">10</integer>

    <!-- Component name of the default wallpaper. This will be ImageWallpaper if not 
     specified -->
    <string name="default_wallpaper_component">com.android.wallpaper/.nexus.NexusWallpaper</string>

    <integer name="config_deskDockKeepsScreenOn">0</integer>
    <integer name="config_carDockKeepsScreenOn">1</integer>

    <!-- Default color for notification LED is white -->
    <color name="config_defaultNotificationColor">#ffffffff</color>

    <!-- Default blink frequency for notification LED is 9 seconds. -->
    <integer name="config_defaultNotificationLedOff">9000</integer>

    <!-- Package name providing network location support. -->
    <string name="config_networkLocationProviderPackageName" translatable="false">com.google.android.location</string>

    <!-- Package name providing geocoder API support. -->
    <string name="config_geocodeProviderPackageName" translatable="false">com.google.android.location</string>

    <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
     Please don't copy them, copy anything else. -->

    <!-- This string array should be overridden by the device to present a list of network
     attributes.  This is used by the connectivity manager to decide which networks can coexist
     based on the hardware -->
    <!-- An Array of "[Connection name],[ConnectivityManager connection type],
     [associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet]  -->
    <!-- the 5th element "resore-time" indicates the number of milliseconds to delay
     before automatically restore the default connection.  Set -1 if the connection
     does not require auto-restore. -->
    <!-- the 6th element indicates boot-time dependency-met value. -->
    <string-array translatable="false" name="networkAttributes">
    <item>"wifi,1,1,1,-1,true"</item>
    <item>"mobile,0,0,0,-1,true"</item>
    <item>"mobile_mms,2,0,2,60000,true"</item>
    <item>"mobile_supl,3,0,2,60000,true"</item>
    <item>"mobile_dun,4,0,4,60000,true"</item>
    <item>"mobile_hipri,5,0,3,60000,true"</item>
    <item>"bluetooth,7,7,0,-1,true"</item>
    </string-array>

    <!-- This string array should be overridden by the device to present a list of radio
     attributes.  This is used by the connectivity manager to decide which networks can coexist
     based on the hardware -->
    <!-- An Array of "[ConnectivityManager connectionType],
                  [# simultaneous connection types]"  -->
    <string-array translatable="false" name="radioAttributes">
    <item>"1,1"</item>
    <item>"0,1"</item>
    <item>"7,1"</item>
    </string-array>

    <!-- List of regexpressions describing the interface (if any) that represent tetherable
     USB interfaces.  If the device doesn't want to support tething over USB this should
     be empty.  An example would be "usb.*" -->
    <string-array translatable="false" name="config_tether_usb_regexs">
    <item>"rndis0"</item>
    </string-array>

    <!-- Array of allowable ConnectivityManager network types for tethering -->
    <!-- Common options are [1, 4] for wifi and dun or [0,1,5,7] for -->
    <!-- mobile, wifi, hipri and bluetooth -->
    <integer-array translatable="false" name="config_tether_upstream_types">
    <item>0</item>
    <item>1</item>
    <item>5</item>
    <item>7</item>
    </integer-array>

    <!-- List of regexpressions describing the interface (if any) that represent tetherable
     Wifi interfaces.  If the device doesn't want to support tethering over Wifi this
     should be empty.  An example would be "softap.*" -->
    <string-array translatable="false" name="config_tether_wifi_regexs">
    <item>"wlan0"</item>
    </string-array>

    <!-- List of regexpressions describing the interface (if any) that represent tetherable
     bluetooth interfaces.  If the device doesn't want to support tethering over bluetooth this
     should be empty. -->
    <string-array translatable="false" name="config_tether_bluetooth_regexs">
    <item>"bnep\\d"</item>
    </string-array>

    <!-- Vibrator pattern for a very short but reliable vibration for soft keyboard tap -->
    <integer-array name="config_keyboardTapVibePattern">
    <item>30</item>
    </integer-array>

    <!-- Vibrator pattern for feedback about booting with safe mode disabled -->
    <integer-array name="config_safeModeDisabledVibePattern">
    <item>1</item>
    </integer-array>

    <!-- crespo doesn't handle this blur effect very quickly. -->
    <bool name="config_sf_slowBlur">true</bool>


    <!-- Boolean indicating if restoring network selection should be skipped -->
    <!-- The restoring is handled by modem if it is true -->
    <bool translatable="false" name="skip_restoring_network_selection">true</bool>

    <!-- Specifies the amount of time to disable virtual keys after the screen is touched
     in order to filter out accidental virtual key presses due to swiping gestures
     or taps near the edge of the display.  May be 0 to disable the feature.
     It is recommended that this value be no more than 250 ms.
     This feature should be disabled for most devices. -->
    <integer name="config_virtualKeyQuietTimeMillis">250</integer>

    <!-- Boolean indicating if current platform supports bluetooth wide band
     speech -->
    <bool name="config_bluetooth_wide_band_speech">false</bool>

    <bool name="config_ui_enableFadingMarquee">false</bool>

    <!-- The attenuation in dB applied to the sound effects played
     through AudioManager.playSoundEffect() when no volume is specified. -->
    <integer name="config_soundEffectVolumeDb">-12</integer>

<string-array name="config_usbHostBlacklist">

    <item>/dev/bus/usb/001</item>

    </string-array>

<bool name="config_showNavigationBar">true</bool>

</resources>

Modify out/target/product/grouper/root/init.usb.rc to be the following:

# Copyright (C) 2012 The Android Open Source Project
#
# USB configuration common for all android devices
#

on post-fs-data
    chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
    chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
    chown system system /sys/class/android_usb/android0/f_rndis/ethaddr
    chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr

# Used to disable USB when switching states
on property:sys.usb.config=none
    stop adbd
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/bDeviceClass 0
    setprop sys.usb.state ${sys.usb.config}

# adb only USB configuration
# This should only be used during device bringup
# and as a fallback if the USB manager fails to set a standard configuration
on property:sys.usb.config=adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct D002
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state ${sys.usb.config}

# USB accessory configuration
on property:sys.usb.config=accessory
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d00
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    setprop sys.usb.state ${sys.usb.config}

# USB accessory configuration, with adb
on property:sys.usb.config=accessory,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d01
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state ${sys.usb.config}

# audio accessory configuration
on property:sys.usb.config=audio_source
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d02
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    setprop sys.usb.state ${sys.usb.config}

# audio accessory configuration, with adb
on property:sys.usb.config=audio_source,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d03
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state ${sys.usb.config}

# USB and audio accessory configuration
on property:sys.usb.config=accessory,audio_source
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d04
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    setprop sys.usb.state ${sys.usb.config}

# USB and audio accessory configuration, with adb
on property:sys.usb.config=accessory,audio_source,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d05
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state ${sys.usb.config}

# Used to set USB configuration at boot and to switch the configuration
# when changing the default configuration
on property:persist.sys.usb.config=*
    setprop sys.usb.config ${persist.sys.usb.config}

on property:sys.usb.config=rndis
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 4e23
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/bDeviceClass 224
    write /sys/class/android_usb/android0/enable 1
    setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=rndis,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 4e24
    write /sys/class/android_usb/android0/functions ${sys.usb.config}
    write /sys/class/android_usb/android0/bDeviceClass 224
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state ${sys.usb.config}

And use a modified tegra kernel that has RNDIS enabled.

Please reference this XDA post

share|improve this answer
    
could you post a diff? if the file is ever updated with a system update, replacing it would be dangerous. a diff would highlight the required additions. -- if you are on windows, one can produce a diff with for example winmerge –  naxa Mar 6 at 16:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.