How to use ADB

From BananaPro/Pi
Jump to: navigation, search
This page is a translated version of the page How to use ADB and the translation is 100% complete.

Other languages:



Download the latest version Android SDK and install it.
The ADB it in the directory adb\platform-tools.


Install ADB

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb

Make sure your user is in the plugdev group

sudo usermod -a -G plugdev [your username]

Check the Equipment

Connect the LeMaker Guitar to your Linux PC via USB3.0 and run cmd lsusb, and get result like this:
So, the ID number of LeMaker Guitar is 10d6:0c02.

Create a File 51-android.rules

As root, create a new file named 51-android.rules under /etc/udev/rules.d and write this content to it:

SUBSYSTEM=="usb", ATTR{idVendor}=="10d6", MODE="0666", GROUP="plugdev"

Then change the permission of the file:

sudo chmod a+r /etc/udev/rules.d/51-android.rules

Restart udev

sudo udevadm control --reload-rules
sudo service udev restart

Unplug and replug the guitar.

Create a File adb_usb.ini

Append a new file named adb_usb.ini under directory ~/.android, and write the ID number of LeMaker Guitar to it and change the permission.

echo 0x10d6 > ~/.android/adb_usb.ini
chmod 755  ~/.android/adb_usb.ini

Restart ADB

Restart ADB:

adb kill-server
adb start-server

And run the next command to list the devices;

adb devices

How to Use

Before Use ADB

Open the ADB Debug on Guitar

(A) Open the Developer options on LeMaker Guitar Find the Build number at Settings -> About tablet, like this:
And click the button Build number six times, there will be a Developer options button like this: Adb-2.jpg
(B) Open the ADB Debug
Click the Developer options button and open the USB debugging like this:

Two Ways to use ADB

(A) Via Internet
Run this command on your PC:

adb connect [IP Address of Guitar(default port:5555)]

You can find the Guitar's IP like this:
(B) Via USB Cable
Connect LeMaker Guitar to you PC via USB cable, and you will see this:
Your computer should find the LeMaker Guitar as a Android Phone, you may install a software like mobile phone assistant.

Common Commands

Display the Android system:

android list targets

Display all ADB devices:

adb devices

Install App:

adb install -r App.apk

Uninstall App:

adb uninstall <the main package name of apk>

Get files from LeMaker Guitar:

adb pull <local path> <remote path>

Send files to LeMaker Guitar:

adb push <remote path> <local path>

Check the log info:

adb logcat (-s label)

Get administrator privileges:

adb root

Check the bug report:

adb bugreport

Use ADB debug

Debug kernel

(a) Modify the code in the kernel source directory

(b) Compile kernel, the resulting binary directory uImage under android\kernel\arch\arm\boot

(c)The kernel image uImage pushed under board /misc partition by ADB tool

adb push uImage /misc
adb shell sync    //Verify that the file has been written to disk

If there are mistakes in the use of the process

D:\>adb push boot.img /misc
failed to copy 'boot.img' to '/misc/boot.img':Permission denied

Run the following command

adb root
adb shell mount -o rm,remount/misc

Note:Because the Misc partition is read-only,This command is required to allow the partition to become available to root write,Otherwise push ADB will be reported when the partition error
Then adb push kernel under board /misc

(d) Reboot

adb shell reboot

(e)After reboot the system running the kernel is the kernel image after the above steps are updated.

Debug drive

(a) If the driver to be debugged is compiled with kernel,Compile the kernel for debugging,if compiled into a module,used the steps described in this section.

(b) Into the driver directory to modify the driver module code.

(c) Compiler driver module

 cd  ($sdk_root)/android
 ./  modules

The resulting binary file in the directory where the driver source code or android\owl\out\s500_android_gb5_wxga\misc\modules

(d) The driver file ko push board / misc / modules directory.

 adb push xxx.ko  /misc/modules
 adb shell sync

===(e) Uninstall the current use of the module===>

 adb shell rmmod xxx
 adb shell insmod xxx.ko

Or restart

 adb shell reboot

(f) And then run the test