ubuntu adb installation and use

ubuntu adb installation and use

Install

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

There is a message indicating that the installation was successful

Configure
Find Device
Insert usb

adb devices

If the List of devices attached is empty, it means that adb cannot recognize the device yet, but usb can still recognize it.
locate usb

Unplug the usb, lsusb, plug in the usb, lsusb, compare the device changes, found a new device
Bus 001 Device 044: ID 2207:0010, 2207 is the idVendor of the device, 0010 is idProduct

Configure adb
to create and edit a 51-android.rules configuration file

cd /etc/udev/rules.d
sudo vi 51-android.rules

Edit information:

SUBSYSTEM==“usb”, ATTR{
    
    idVendor}==“xxxx1”, ATTR{
    
    idProduct}==“xxxx2”, MODE=“0600” , OWNER==“xxxx3”

Among them, xxxx1 is the idVendor of the usb device,
xxxx2 is the idProduct of the usb device
, xxxx3 is the username for logging in to Ubunut

Modify the permissions of 51-android.rules, plus readable and executable permissions

chmod a+rx 51-android.rules //or sudo chmod a+rx 51-android.rules

Add adb_usb.ini file and edit to make adb recognize the device

vi ~/.android/adb_usb.ini

Add the value of idVendor

0x2207
#注意需要加上0x的前缀

restart adb

sudo service udev restart
adb kill-server
adb start-server

Check whether the configuration is successful
Insert usb, use

adb devices

It is found that the device name under List of devices is ???
Input sudo adb remount, error: insufficient permissions for device appears

Solution:
re-edit the configuration file

sudo vi /etc/udev/rules.d/51-android.rules

SUBSYSTEM==“usb”, ENV{DEVTYPE}==“usb_device”, MODE=“0666”

unplug usb

adb remount
adb devices

Use adb to transfer data to the development board
Enter the development board

adb shell
ls

The current directory is the directory of the development board
Create a new console, enter adb push linux system file path development board file directory in any directory

adb push ./1.txt /sdcard

Appearance such as
6746 KB/s (5864644 bytes in 0.848s)
indicates success

pull file

adb pull ./test.txt /home/linux/Desktop

Guess you like

Origin blog.csdn.net/qq_43508270/article/details/125708939