Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1321894
  • 博文数量: 478
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4833
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-28 11:12
文章分类

全部博文(478)

文章存档

2019年(1)

2018年(27)

2017年(21)

2016年(171)

2015年(258)

我的朋友

分类: Android平台

2015-07-14 13:39:12

今天在linux下连接平板usb,试用adb shell时出现error: insufficient permissions for device,

而且我们输入adb devices显示:

xxnan@xxnan-pt:~$ adb devices
List of devices attached 
????????????    device
那么我们怎么解决它呢?


首先在终端查看usb的ID,输入lsusb命令,我们可以看到我们刚插如usb的ID号,如:

xxnan@xxnan-pt:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0461:4d80 Primax Electronics, Ltd 
Bus 001 Device 004: ID 1c7a:0801 LighTuning Technology Inc. Fingerprint Reader
Bus 002 Device 003: ID 5986:0190 Acer, Inc 
Bus 001 Device 019: ID 0bb4:0c02 High Tech Computer Corp. Dream / ADP1 / G1 / Magic / Tattoo (Debug)

红色的就是我们插入usb的ID号。


那么我们进入到cd /etc/udev/rules.d/下,新建一个51-android.rules文件(sudo  vim  51-android.rules),在这个文件中写上:

SUBSYSTEM=="usb", ATTRS{idVendor}==" 0bb4", ATTRS{idProduct}=="0c02",MODE="0666"

保存,再为51-android.rules加上权限(sudo chmod a+x 51-android.rules).


拔掉usb重新插上就可以了,如:

xxnan@xxnan-pt:~$ adb devices
List of devices attached 
AB100607    device

这样就解决了不能识别USB的问题。

倘若这样依然解决不了问题,如下方式肯定可以:
在linux系统上,使用普通用户连接adb的时候经常出现权限问题:
[niutao@niutao] $ adb shell

  1. adb server is out of date. killing...
  2. * daemon started successfully *
  3. error: insufficient permissions for device
虽然可以通过切换成root用户,然后adb kill-server & adb start-server解决,但每次切换终端或者重启之后还是要重新kill一下,比较麻烦,所以可以通过以下方法永久解决:
首先找到adb命令所在的目录:

  1. [niutao@niutao] $ whereis adb
  2. adb: /sbin/adb /usr/sbin/adb
而后给adb命令加上s权限:

  1. [niutao@niutao /sbin] $ sudo chmod a+s adb
这样就永久解决权限问题啦。





阅读(515) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~