A cross-platform tool to enable USB tethering from an Android device to a laptop without interacting with the mobile interface. This tool automates the process of enabling USB tethering using the Android Debug Bridge (ADB).
- Supports Windows, Linux, and macOS.
- Automatically detects the operating system and uses the appropriate ADB binary.
- Retries enabling USB tethering up to 5 times in case of failures.
- Provides a Python wrapper for consistent execution across platforms.
- Includes platform-specific scripts for enabling tethering.
- An Android device with USB debugging enabled.
- A USB cable to connect the device to your computer.
- Python 3.6+ (required for running
usb_tether_launcher.py
). - No additional installation of ADB is required, as platform-specific binaries are included.
To use this tool, USB debugging must be enabled on your Android device:
- Open Settings on your Android device.
- Go to About phone.
- Tap Build number 7 times to enable Developer Options.
- Go back to Settings, find Developer Options.
- Enable USB debugging.
- Connect your device to your computer via USB.
- When prompted on your device, allow USB debugging for this computer.
https://github.com/CKShetty4/USB-Tether.git
cd USB-Tether
Run the Python script to enable USB tethering:
python usb_tether_launcher.py
The script will:
- Detect your operating system (Windows, Linux, or macOS).
- Use the appropriate platform-specific ADB binary from the
platform-tools
directory. - Execute the corresponding script (
enable_tethering.bat
for Windows orenable_tethering.sh
for Linux/macOS). - Attempt to enable USB tethering with retries if needed.
USB-Tether/
├── enable_tethering.bat # Windows batch script for enabling tethering
├── enable_tethering.sh # Shell script for Linux/macOS
├── usb_tether_launcher.py # Python wrapper for cross-platform execution
├── platform-tools/ # Directory containing ADB binaries
│ ├── linux/ # Linux-specific ADB binary and dependencies
│ ├── mac/ # macOS-specific ADB binary and dependencies
│ ├── windows/ # Windows-specific ADB binary and dependencies
├── License # License file
└── README.md # This file
-
Python Launcher (
usb_tether_launcher.py
):- Detects the operating system.
- Runs the appropriate platform-specific script (
enable_tethering.bat
orenable_tethering.sh
). - Ensures the script is executable on Unix-based systems.
-
Platform-Specific Scripts:
- Windows (
enable_tethering.bat
): Usesadb.exe
to set the USB function torndis
(Remote Network Driver Interface Specification) for tethering. - Linux/macOS (
enable_tethering.sh
): Uses the respective ADB binary to set the USB function torndis
. - Both scripts retry up to 5 times with a 2-second delay between attempts if the command fails.
- Windows (
-
ADB Binaries:
- The
platform-tools
directory includes ADB binaries for Windows, Linux, and macOS, along with necessary dependencies (e.g.,libc++.so
for Linux,libc++.dylib
for macOS, andAdbWinApi.dll
for Windows).
- The
- No devices found: Ensure your Android device is connected via USB and USB debugging is enabled.
- Permission denied on Linux/macOS: The script automatically sets execute permissions, but you can manually run
chmod +x platform-tools/linux/adb
orchmod +x platform-tools/mac/adb
. - ADB command fails: Verify that the USB cable is functional and the device is properly connected.
- Unsupported OS error: The tool supports Windows, Linux, and macOS only. Ensure you are using a supported operating system.
This project is licensed under the MIT License. See the License file for details.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For questions or support, please open an issue on the GitHub repository.