ADB

From iDroid Project

Revision as of 22:06, 7 April 2022 by Ddominator (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ADB or Android Debug Bridge is the main way to communicate and change files on the android system. ADB allows you to send and receive files based on the commands sent. ADB is found in the Android SDK.

Some of the guides in the iDroidWiki use ADB commands, so please know what and how to use ADB for maximum success with the other guides.

Contents

Disclaimer

To quote someone, if you do not know why sudo rm -rf / is a bad idea, read everything first until you understand. Then once you understand, proceed to doing what you want to do with ADB.

General Instructions

  • iDroid versions starting with MoJo 1.0.4.1 use USB connection for ADB. Please have your iPhone/iPod USB cable ready.
  • Make sure that USB Debugging mode is enabled/ticked in iDroid under Settings > Applications > Development

Instructions for Linux

Creating the udev Rules

You must first create the following udev rules to enable ADB connection over USB.

  1. Open a Terminal and type this:
    sudo nano /etc/udev/rules.d/51-android.rules
  2. Enter your password and add this to the file:
    SUBSYSTEM=="usb" ID_VENDOR_ID=="0bb4", MODE="0666"
    SUBSYSTEM=="usb" ID_VENDOR_ID=="18d1", MODE="0666"
    SUBSYSTEM=="usb" ID_VENDOR_ID=="05ac", MODE="0666"
  3. Save the file and exit nano.
  4. In Terminal, enter the following. You may have to enter your password if needed.
    sudo chown root:root /etc/udev/rules.d/51-android.rules
  5. Then reboot Linux or restart udev using this command:
    sudo restart udev

Getting the ADB File

  1. Download the zipped ADB file created when iDroid is compiled.
  2. Extract the archive. You should get a file named adb.
  3. Open a Terminal and navigate (cd) to the directory where the extracted adb file is located.
  4. Copy the adb file into /usr/local/bin. This is to make sure ADB can be called without having to state the full path. You will need root privileges on Linux to copy to this directory:
    sudo cp adb /usr/local/bin/adb
    Enter your password if prompted.
  5. Connect your iDroid and USB cable through a powered USB hub.

Instructions for OS X

  1. Download the Android SDK for your operating system.
  2. Extract the archive.
  3. In the platform-tools folder, you will find the ADB file used to connect to your phone.
  4. Copy the adb file from the platform-tools folder into /usr/local/bin. This is to make sure ADB can be called without having to state the full path.
  5. Connect your iDroid and USB cable through a powered USB hub. Newer generation apple computers do not have enough power for the native USB ports and ADB will constantly disconnect.
  6. A workaround for ADB on Macs is to connect it via WiFi instead of using USB.

Instructions for Windows

  1. Download the OIB tools from here if you have not done so in the past.
  2. Extract the zip archive and run the executable installer if this is your first time to do so.
  3. Run the Add Hardware Wizard (Start -> Run -> "hdwwiz")

Add Hardware Wizard

  1. Read the warnings, then click "Next"
  2. Choose "Install the hardware that I manually select from a list (Advanced)" this is the 2nd option, then click "Next"
  3. Select "Show All Devices", then click "Next"
  4. You are going to see a grayed-out text box with "(Retrieving a list of all devices)", click the "Have Disk..." button
  5. "Browse" to the where you installed OpeniBoot Tools (default is C:/Program Files/OpeniBoot Tools/) and then to ADB. It will be looking of a .inf file so select "android_winusb.inf" and click "Open" then "OK". It's the only file there so you shouldn't go wrong.
  6. 3 choices will come up in the previously-grayed-out text box. Select "Android ADB Interface" then click the "Next" button
  7. Install the driver. When a warning comes up about unknown manufacturer. click "Install this Software Anyway" or "Always trust this source"
  8. Wait for the confirmation. It should warn about "Device cannot start", click the "Finish" button.

Installing the Non-functional iDroid USB drivers

  1. Boot into iDroid
  2. Connect your iDroid via USB
  3. The Adding Hardware will automatically start (if it hasn't already). Click "Skip obtaining drivers from Windows Update" as it won't find any at all.
  4. If it is proceeding as planned, Windows will tell you it wasn't able to find drivers for "iPhone2G" or "iPhone3G" or "iPodTouch1G".

Replacing the Non-functional iDroid USB drivers with the Working Android Drivers

  1. Before doing this step, make sure that you have installed the Android USB drivers as mentioned above and you have done no editing to the iDroid USB drivers. Your iDroid must be booted and connected via USB cable.
  2. Open Device Manager (Start -> Run -> "devmgmt.msc")
  3. Look for the Other Devices tab, expand the tab if you have to.
  4. "iPhone2G" or "iPhone3G" or "iPodTouch1G". Any other devices listed here that are not mentioned are from your computer and not the iDroid.
  5. Right-click "iPhone2G" or "iPhone3G" or "iPodTouch1G", a menu should pop-out and click "Update Driver Software..."
  6. A new window should appear. Pick/click the bottom option: "Browse my computer for driver software"
  7. Choose the bottom option: "Let me pick from a list of device drivers on my computer"
  8. A list with a scrollbar should appear and "Android Phone" should be near the top of the list. Select "Android Phone" and click the "Next" button.
  9. Under Model, choose/select "Android ADB Interface" and click the "Next" button.
  10. A warning will appear, answer "Yes" but read the warning anyway.
  11. Click the "Close" when the wizard is completed.
  12. Safely remove your iPhone2G or iPhone3G (yes you now can), then reconnect it via USB cable.
  13. There should also be an Android Phone tab, with 2 devices of "Android ADB Interface" listed. One of will have a yellow exclamation mark; this is the driver we added via Add Hardware Wizard that could not start.
  14. Uninstall the driver with the yellow exclamation mark but do not delete the software for the driver. This is too stop Windows from popping up with new Hardware found on every start-up.

Connecting via WiFi

iDroid will not connect via WiFi unless the ADB daemon on iDroid is instructed to use WiFi. Please take note that this is like a tethered jailbreak such that the next time you boot iDroid, you will have to do these steps again to connect via WiFi.

Getting your iDroid's IP Address

  1. Make sure that your iDroid is connected to the same network as the PC that will be using ADB.
  2. Connect to that WiFi network if you haven't.
  3. Once connected to WiFi in iDroid, go to Settings > Wireless & network settings > Wi-Fi settings.
  4. Under the WiFi networks heading, look for the network that you are connected to. You know you are connected to this network because the word Connected is under the network's SSID. It also has the WiFi signal icon to its right (not a check mark).
  5. Touch that network and a window box will appear with the IP address. Copy the IP address.

Switching from USB to WiFi

  1. Connect your iDroid to your PC (any OS).
  2. Open a Terminal or Command Prompt.
  3. Enter the following command:
    adb tcpip 5555
    It will be successfull when "restarting in TCP mode port: 5555" is displayed on the next line.
    • OS X users, you may have to reconnect your iDroid by USB (unplug then re-plug) if you get "error: device not found" when entering adb tcpip 555 command.
  4. To initialize the WiFi connection, enter:
    adb connect xxx.xxx.xxx.xxx:5555
    Where xxx.xxx.xxx.xxx is your iDroid's IP Address. If all goes well, the next line will display "connected to xxx.xxx.xxx.xxx:5555".

Shell

ADB Shell is Android's mini Terminal. Commands in Shell are similar to those one uses in Linux Terminal. To go into Shell, ADB must be connected, then in Linux/OS X Terminal or Windows Command prompt enter:

adb shell

A console beginning with # shows you are in the Shell. Enter exit to leave ADB Shell

Enabling Read/Write capabilites

By default, the iDroid system (mounted from system.img) is on a read-only filesystem. This is of course for security purposes and to prevent anyone from accidentally messing up the system. In Terminal or Command Prompt, use this command carefully:

adb shell mount -o remount,rw -t yaffs2 /dev/mtdblock3 /system

This will enable the iDroid /system folder to have read/write capabilities. You may now use ADB shell to delete stuff or ADB push to send files.

Sending and Receiving Data

To send data from the PC to iDroid (using adb push), the partition has to be mounted and changed to read/write capabilities.

After the file system has been mounted, you can now send and receive data from the phone, using:

adb push /path_to_where_the_file_is /system/location_on_phone
adb pull /system/location_on_phone /path_to_where_the_file_is

These two commands will send and/or receive data from iDroid to the PC and vice-versa

Other Useful Commands

  • ADB install sends the APP to your userdata.img and installs it without having to use the bundled File Manager. Usage:
adb install /path_to_your_app.apk
  • ADB kill-server disconnects ADB and terminates the ADB process. Usage:
adb kill-server

A more detailed guide of ADB and it's commands can be found at the Android Developer's site. This is a very informative guide and it would be redundant (and plagiarism) to just copy its content to this Wiki page.

GUI Frontend

ADB now has GUI for Windows and Linux (Mac - not yet). For more information check the links bellow.

ADB GUI For Windows

ADB GUI for Linux