android-udev-rules/README.md

52 lines
2.0 KiB
Markdown
Raw Normal View History

2015-11-07 19:04:53 +01:00
## Description
2016-08-05 16:23:13 +02:00
These rules refer to https://developer.android.com/studio/run/device.html and include many suggestions from the Archlinux and Github Community.
2013-09-10 18:29:22 +02:00
If you're developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below.
2013-09-10 18:29:22 +02:00
Use this format to add each vendor to the file(example vendor ID is for HTC):
`SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"`
The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.
Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules. please refer to 51-android.rules in [ubuntu directory](ubuntu)
2015-05-02 03:20:09 +02:00
2015-11-07 19:04:53 +01:00
## Installation
2015-05-02 03:20:09 +02:00
#### For Ubuntu
2015-05-02 03:20:09 +02:00
```sh
# Clone the repo (replace repo-url with the Github URL)
git clone <repo-url>
# Create a sym-link to the rules file
2016-05-31 11:41:08 +02:00
sudo ln -s `pwd`/android-udev-rules/51-android.rules /etc/udev/rules.d/
# Change file permissions
sudo chmod a+r /etc/udev/rules.d/51-android.rules
# Restart UDEV
2015-05-02 03:20:09 +02:00
sudo udevadm control --reload-rules
sudo service udev restart
# Add plugdev group to your <login-id>
sudo usermod -a -G plugdev <login-id>
# Repluging your Android and verify adb is enabled in developer options
# Restart ADB server
adb kill-server
adb devices
# You should now see your device
```
## Troubleshooting
Try group plug**in**dev rather than plugdev, then restart udev.
## To Contribute:
1. Please fork this repository
2. Make your edits
3. TEST IT!
4. Create a pull-request
2015-05-02 03:24:12 +02:00
2016-03-03 11:09:37 +01:00
## Note
Some devices (particularly MediaTek and Xiaomi) also require an entry in $HOME/.android/adb\_usb.ini. You can use the adb_usb.ini
`ln -s `pwd`/adb_usb.ini $HOME/.android/