Can I use adb.exe to find a description of a phone?
If I call the command "adb.开发者_StackOverflow社区exe devices" I get a list of devices with a unique ID for each. These IDs are perfect for programming but not very human readable. Is there any way I can link one of these IDs to a (not necessarily unique) description of the phone? For example, if I have a device with an ID 1234567890abcdef is there any way I can figure that in real life it is a Motorola Droid X?
In Android there is a Model number
entry in settings that shows phone name.
There is a way to quickly see this via command line:
adb shell cat /system/build.prop | grep "product"
This is what's shown for Samsung Galaxy S 4G:
ro.product.model=SGH-T959V
ro.product.brand=TMOUS
ro.product.name=SGH-T959V
ro.product.device=SGH-T959V
ro.product.board=SGH-T959V
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=Samsung
ro.product.locale.language=en
ro.product.locale.region=US
# ro.build.product is obsolete; use ro.product.device
ro.build.product=SGH-T959V
On a HTC Desire, the output looks like this:
ro.product.model=HTC Desire
ro.product.brand=htc_wwe
ro.product.name=htc_bravo
ro.product.device=bravo
ro.product.board=bravo
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=HTC
ro.product.locale.language=hdpi
ro.product.locale.region=
You can refine your query to show only one line:
adb shell cat /system/build.prop | grep "ro.product.device"
or
adb shell cat /system/build.prop | grep "ro.product.model"
With newer devices, you can run
adb devices -l
This will list some devices in a more human readable form
Example:
04d9a601ce516d53 device usb:1A134500 product:occam model:Nexus_4 device:mako
015d4b3406280a07 device usb:1A134700 product:nakasi model:Nexus_7 device:grouper
01466E620900F005 device usb:1A134600 product:mysid model:Galaxy_Nexus device:toro
Yes, adb shell cat /system/build.prop
is wonderful, but also as @Matt said, it sometimes differs because of different manufacture.
IMHO, the most reliable approach is the built-in command: adb shell getprop
======================================================================
Here is a comparison for an exception (Genymotion emulator):
By adb shell cat /system/build.prop
you'll get
ro.product.brand=generic
ro.product.name=vbox86p
ro.product.device=vbox86p
ro.product.board=
ro.product.cpu.abi=x86
ro.product.manufacturer=Genymotion
ro.product.locale.language=en
ro.product.locale.region=US
So there is no model value :(
By adb shell getprop
you'll get
[ro.product.manufacturer]: [Genymotion]
[ro.product.model]: [Nexus422ForAutomation]
[ro.product.name]: [vbox86p]
Here you get the model name: Nexus422ForAutomation :)
Unfortunately, there is no reliable way to do this since each manufacturer tweaks their build properties
If you type "adb help" into the command line you can see a list of the adb commands and a description for each.
I'm using this script (on MacOS):
#!/bin/bash
devices=`adb devices | grep "device" | grep -v "List of" | cut -d " " -f 1`
for device in $devices
do
manufacturer=`adb -s $device shell getprop ro.product.manufacturer | sed -e 's/[[:space:]]*\$//'`
model=`adb -s $device shell getprop ro.product.model | sed -e 's/[[:space:]]*\$//'`
echo "$device: $manufacturer $model"
done
It produces e.g. the following output:
T076000UWX: motorola XT1053
C4F12070E5A068E: samsung GT-P7510
4df1ff977b919f91: samsung GT-N7100
4258393032523638324D: Sony Ericsson LT18i
精彩评论