繁体   English   中英

fastboot和adb无法与sudo一起使用

[英]fastboot and adb not working with sudo

尝试运行fastboot命令时,我的Ubuntu机器上出现一个非常奇怪的问题。

当我跑步时:

fastboot devices

我懂了

no permissions   fastboot

因此,我以管理员身份运行命令:

sudo fastboot devices

然后我得到结果

sudo: fastboot: command not found

怎么会这样? 我在PATH中有该目录,并且无需sudo即可正常运行。

无需每次都需要运行fastboot来通过sudo强制授予权限,而是可以永久解决此问题:

  1. 使用lsusb识别您的设备USB VendorID
  2. 配置udev以在插入设备时设置适当的权限
  3. 利润!

作为奖励-它也将针对adb修复。

例如,在我的情况下(对于“ Megafon SP-A20i”):

$ fastboot devices
no permissions  fastboot
$ sudo fastboot devices
[sudo] password for kaa: 
MedfieldA9055F28    fastboot
$ 

让我们修复:

首先,我们需要识别设备:

a)查找USB总线号(黑客:我知道设备是基于Intel的设备)

$ fastboot -l devices
no permissions         fastboot usb:1-1.2
$ lsusb |grep 001 |grep -i intel
Bus 001 Device 044: ID 8087:09ef Intel Corp. 
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
$ 

b)寻找其他英特尔设备:

$ lsusb |grep 8087
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 044: ID 8087:09ef Intel Corp. 
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
$ 

集线器并不是智能手机,因此-我们需要的USB vendorID是“ 8087”。

其次,配置udev (您必须用自己的值替换“ idVendor”值):

$ sudo sh -c "echo '# Megafon SP-A20i' >> /etc/udev/rules.d/51-android.rules"
$ sudo sh -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"8087\", MODE=\"0666\", GROUP=\"plugdev\"' >> /etc/udev/rules.d/51-android.rules"
$ sudo service udev restart
udev stop/waiting
udev  start/running, process 1821
$ 

第三,重新插入设备以允许udev发挥其魔力。

最终检查:

$ fastboot -l devices
MedfieldA9055F28       fastboot usb:1-1.2
$ adb devices
List of devices attached 

$ fastboot reboot
rebooting...

finished. total time: 0.253s
$ sleep 90
$ adb devices
List of devices attached 
MedfieldA9055F28    device

$ 

瞧!

您可以使用

sudo $(哪个fastboot)设备

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM