最新消息:20210917 已从crifan.com换到crifan.org

【部分解决】通过添加Vendor ID到adb_usb.ini尝试解决Mac中adb devices检测不到安卓手机设备红米Note8Pro

USB crifan 683浏览 0评论
折腾:
【未解决】红米Note8Pro经常断开无法被安卓的adb检测到设备
期间,无法检测到安卓手机红米Note8Pro。
【报Bug】MacOs下Android手机调试总是自动断开连接 – DCloud问答
https://ask.dcloud.net.cn/question/68164
去看看:
~  ll /Users/xxx/.android/
total 32
-rw-------   1 xxx  CORP\Domain Users   1.7K 11  7  2019 adbkey
-rw-r--r--   1 xxx  CORP\Domain Users   717B 11  7  2019 adbkey.pub
-rw-r--r--   1 xxx  CORP\Domain Users   183B  8  3 11:16 analytics.settings
drwxr-xr-x   2 xxx  CORP\Domain Users    64B 11  8  2019 avd
drwxr-xr-x  10 xxx  CORP\Domain Users   320B  8  5 17:19 build-cache
-rw-r--r--   1 xxx  CORP\Domain Users     0B 11 27  2019 build-cache.lock
drwxr-xr-x  26 xxx  CORP\Domain Users   832B 11 27  2019 cache
-rw-r--r--   1 xxx  CORP\Domain Users   2.1K 11  8  2019 debug.keystore
-rw-r--r--   1 xxx  CORP\Domain Users     0B 11 27  2019 debug.keystore.lock
drwxr-xr-x   3 xxx  CORP\Domain Users    96B 11  8  2019 metrics
drwxr-xr-x   3 xxx  CORP\Domain Users    96B 12  1 15:40 monitor-workspace
此处没有
/User/xxx/.android/adb_usb.ini
去看看:
~  system_profiler SPUSBDataType
2020-12-09 10:21:47.361 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2020-12-09 10:21:47.361 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2020-12-09 10:21:47.362 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2020-12-09 10:21:47.362 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2020-12-09 10:21:47.364 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2020-12-09 10:21:47.364 system_profiler[77164:53421194] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
USB:

    USB 3.1 Bus:

      Host Controller Driver: AppleIntelCNLUSBXHCI
      PCI Device ID: 0x9ded
      PCI Revision ID: 0x0030
      PCI Vendor ID: 0x8086

        USB2.1 Hub:

          Product ID: 0x0610
          Vendor ID: 0x05e3  (Genesys Logic, Inc.)
          Version: 6.54
          Speed: Up to 480 Mb/sec
          Manufacturer: GenesysLogic
          Location ID: 0x14200000 / 1
          Current Available (mA): 500
          Current Required (mA): 100
          Extra Operating Current (mA): 0

            Redmi Note 8 Pro:

              Product ID: 0xff48
              Vendor ID: 0x2717
              Version: 4.04
              Serial Number: hmucaei75ptk7szs
              Speed: Up to 480 Mb/sec
              Manufacturer: Xiaomi
              Location ID: 0x14230000 / 64
              Current Available (mA): 500
              Current Required (mA): 500
              Extra Operating Current (mA): 0

            USB Composite Device:

              Product ID: 0x0002
              Vendor ID: 0x0603  (Novatek Microelectronics Corp.)
              Version: 16.12
              Speed: Up to 1.5 Mb/sec
              Manufacturer: SINO WEALTH
              Location ID: 0x14220000 / 16
              Current Available (mA): 500
              Current Required (mA): 100
              Extra Operating Current (mA): 0

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCITR
      PCI Device ID: 0x15ec
      PCI Revision ID: 0x0006
      PCI Vendor ID: 0x8086
      Bus Number: 0x00

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCITR
      PCI Device ID: 0x15ec
      PCI Revision ID: 0x0006
      PCI Vendor ID: 0x8086
      Bus Number: 0x01

        USB3.1 Hub:

          Product ID: 0x0626
          Vendor ID: 0x05e3  (Genesys Logic, Inc.)
          Version: 6.54
          Speed: Up to 5 Gb/sec
          Manufacturer: GenesysLogic
          Location ID: 0x01100000 / 1
          Current Available (mA): 900
          Current Required (mA): 0
          Extra Operating Current (mA): 0

    iBridge Bus:

      Host Controller Driver: AppleUSBVHCIBCE

        Touch Bar Backlight:

          Product ID: 0x8102
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: 0000000000000000
          Manufacturer: Apple Inc.
          Location ID: 0x80700000

        Touch Bar Display:

          Product ID: 0x8302
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: 0000000000000000
          Manufacturer: Apple Inc.
          Location ID: 0x80600000

        Apple Internal Keyboard / Trackpad:

          Product ID: 0x027b
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 9.27
          Serial Number: FM7845603R8J3VXAH+TVZ
          Speed: Up to 480 Mb/sec
          Manufacturer: Apple Inc.
          Location ID: 0x80500000 / 3
          Current Available (mA): 500
          Current Required (mA): 500
          Extra Operating Current (mA): 0
          Built-In: Yes

        Headset:

          Product ID: 0x8103
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.04
          Serial Number: 000000000000
          Manufacturer: Apple
          Location ID: 0x80400000

        Ambient Light Sensor:

          Product ID: 0x8262
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: 000000000000
          Manufacturer: Apple Inc.
          Location ID: 0x80300000

        FaceTime HD Camera (Built-in):

          Product ID: 0x8514
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: CC28493XQ52J3Y324
          Manufacturer: Apple Inc.
          Location ID: 0x80200000

        Apple T2 Controller:

          Product ID: 0x8233
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: 0000000000000000
          Manufacturer: Apple Inc.
          Location ID: 0x80100000
其中:
            Redmi Note 8 Pro:

              Product ID: 0xff48
              Vendor ID: 0x2717
              Version: 4.04
              Serial Number: hmucaei75ptk7szs
              Speed: Up to 480 Mb/sec
              Manufacturer: Xiaomi
              Location ID: 0x14230000 / 64
              Current Available (mA): 500
              Current Required (mA): 500
              Extra Operating Current (mA): 0
即:
Vendor ID: 0x2717
xxx@xxx  ~  vi ~/AndroidStudioProjects/
✘ xxx@xxx  ~  vi ~/.android/adb_usb.ini
xxx@xxx  ~  cat ~/.android/adb_usb.ini
0x2717
再去:
adb kill-server
adb start-server
adb devices
结果:
xxx@xxx  ~  adb kill-server
xxx@xxx  ~  adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
xxx@xxx  ~  adb devices
List of devices attached
hmucaei75ptk7szs    device
貌似可以找到设备了
如果这个办法有效,那就是:Mac系统的bug?
过了10多分钟后,还是可以检测到设备的:
说明的确有用,解决了adb检测安卓设备,红米Note8Pro,经常断开的问题。
那去调试看看,是否真的能连上?
[D 201209 10:40:52 __init__:287] device hmucaei75ptk7szs is online
可以连上的。
另外也去看看 android的adb_usb.ini
mac adb_usb.ini
android adb_usb.ini
mac环境下adb常见问题 – 简书
android – adb not finding my device / phone (MacOS X) – Stack Overflow
macos – adb devices does not detect android phone on MAC – Stack Overflow
I can’t find adb_usb.ini file in .android folder? – Stack Overflow
macos – How can I open ~/.android/adb_usb.ini for the Kindle Fire? – Stack Overflow
android – ADB can’t find Nexus 7 on Mac OS X Mavericks – Stack Overflow
apkudo/adbusbini: An adb_usb.ini containing every known vendor ID – just clone into your .android directory.
【总结】
此处环境:
Mac电脑 + (Mac上TypeC转)USB的转接头(有3个USB 3.0的USB口 + 1个HDMI+1个TypeC) + 其中一个USB 3.0接口接 安卓手机 红米Note8Pro
现象:
Mac中用:
adb devices
开始能检测到 安卓设备 红米Note8Pro:
~  adb devices
List of devices attached
hmucaei75ptk7szs    device
但是经常无故断开,而无法检测到
 ~  adb devices
List of devices attached
原因:
估计是Mac的bug导致无故检测不到
解决办法:
Mac中把安卓设备的USB的vendor id=厂商id,加到 adb_usb.ini中。
具体步骤:
(1)先确认你的USB设备的vendor id
方式1:从 Mac-》关于本机-》系统报告-》硬件-》USB-》USB设备树-》点击你的USB设备->显示出:厂商ID
举例:
此处USB设备是安卓手机 红米Note8Pro Redmi Note 8 Pro
厂商ID=vendor ID:0x2717
推测:对应着 红米的厂商:小米?
其产品ID 0xff48 才是对应着 红米Note8Pro  ?
方式2:命令行方式:
system_profiler SPUSBDataType
找到你的设备的部分,找到其中的Vendor ID
举例:
system_profiler SPUSBDataType
。。。
            Redmi Note 8 Pro:
              Product ID: 0xff48
              Vendor ID: 0x2717
              Version: 4.04
              Serial Number: hmucaei75ptk7szs
              Speed: Up to 480 Mb/sec
              Manufacturer: Xiaomi
              Location ID: 0x14230000 / 64
              Current Available (mA): 500
              Current Required (mA): 500
              Extra Operating Current (mA): 0
其中:Vendor ID: 0x2717
(2)把vendor ID加到adb_usb.ini
  • adb_usb.ini 
    • 位置:
      • ~/.android/adb_usb.ini
        • 举例,此处是:
          • /Users/xxx/.android/adb_usb.ini
    • 说明:
      • 如果没有,则自己创建一个
    • 把vendor ID加到里面
    • 注意
      • ini文件里面不能有多余空行
加了之后,可以用cat显示内容,确认一下内容正确:
# cat ~/.android/adb_usb.ini
0x2717
后续:
adb kill-server
adb start-server
adb devices
即可看到设备
xxx@xxx  ~  adb kill-server
xxx@xxx  ~  adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
xxx@xxx  ~  adb devices
List of devices attached
hmucaei75ptk7szs    device
即可。
后记:
后续证明,只是当时解决了。没有彻底解决:
【未解决】红米Note8Pro经常断开无法被安卓的adb检测到设备

转载请注明:在路上 » 【部分解决】通过添加Vendor ID到adb_usb.ini尝试解决Mac中adb devices检测不到安卓手机设备红米Note8Pro

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
87 queries in 0.139 seconds, using 21.74MB memory