Get Bluetooth MAC Address via adb [duplicate]

扶醉桌前 提交于 2019-12-30 03:04:26

问题


Please help me to retrieve the Bluetooth MAC Address of my Galaxy S3 phone connected via USB port. My device is rooted.


回答1:


Running netcfg will show you all interfaces on the system along with their MAC addresses.




回答2:


adb shell cat /sys/class/net/wlan0/address




回答3:


I usually get the mac address of the WiFi interface of an Android device (that is connected to my PC through a USB port) by running these commands:

  1. Find the device name using:

    adb devices
    

    Results usually looks like:

    List of devices attached 
    4e7354af    device
    1f97033e    device
    

    In this case we have two devices connected 4e7354af and 1f97033e. Let's work on the first one: 4e7354af

  2. Get the mac address for the first device:

    adb -s 4e7354af shell ip addr show wlan0  | grep 'link/ether '| cut -d' ' -f6
    

    In previous line, we used the -s option with the adb commands to specify the serial number. Then shell indicate that is a linux command followed by the ip addr show wlan0 | grep 'link/ether '| cut -d' ' -f6 this command can also be used in Linux if its interface has the same name as wlan0.

I generally use this approach because I have many devices connected to my testing environment. Good luck guys.




回答4:


Isn't bluetooth MAC address available on every Android phone in Settings?

Currently I have 2 devices near:

On Samsung Galaxy S2 - Settings > About Phone > Status

On HTC Desire - Settings > About Phone > Hardware Information

(Bluetooth must be turned on)



来源:https://stackoverflow.com/questions/12197925/get-bluetooth-mac-address-via-adb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!