搭载Android Things的树莓派3:WiFi MAC地址位置及未联网获取可行性
Hey there! Let's tackle your questions about MAC addresses on Raspberry Pi 3 running Android Things:
1. Where to find the WiFi MAC address on Raspberry Pi 3 with Android Things?
You have a couple of reliable ways to retrieve the WiFi MAC address, depending on your setup:
- Using ADB commands (the most straightforward method for developers):
- Connect your RPi3 to your development machine via USB or network, then run:
Look for the line starting withadb shell ip link show wlan0link/ether— the alphanumeric string separated by colons is your WiFi MAC address. - Alternatively, you can directly read the system file storing the address for a cleaner output:
adb shell cat /sys/class/net/wlan0/address
- Connect your RPi3 to your development machine via USB or network, then run:
- If you have a display connected via HDMI, navigate to Android Things' system settings, find the WiFi section (even if not connected), and the MAC address should be listed under network details.
2. Can I get WiFi and Ethernet MAC addresses on Raspberry Pi 3 with Android Things Developer Preview 7 when not connected to any network?
Absolutely! MAC addresses are hardware identifiers built into the WiFi and Ethernet adapters — they don't require an active network connection to be accessible. You can use these ADB methods regardless of network status:
- For WiFi MAC address:
adb shell cat /sys/class/net/wlan0/address - For Ethernet MAC address:
adb shell cat /sys/class/net/eth0/address
These files in the sysfs filesystem are populated as soon as the OS detects the hardware, so you'll get valid MAC addresses even with no network connected.
内容的提问来源于stack exchange,提问作者Andrii Omelchenko
相关产品推荐
相关产品推荐

