Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get device information (such as product, model) from adb command

Tags:

android

adb

One way to achieve this is as follows:

adb devices -l 

example output:

123abc12               device product:<id> model:<id> device:<id> 456abc45               device product:<id> model:<id> device:<id> 

But this list's out all devices connected, but I want to get the information for a specific device.
I want information only about "123abc12". The output should be:

123abc12               device product:<id> model:<id> device:<id> 

The second device should not be shown.
I have the device name i.e 123abc12, and it can be used to get the required information, but I don't know how.
Thanks.

like image 908
Destructor Avatar asked Feb 28 '14 10:02

Destructor


People also ask

How do I get adb devices list?

Go back to Settings -> Developer options -> turn on USB debugging. Go back to your terminal adb devices and you should see the connected device. Hope that helps.

What is adb devices command?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

How can I get IMEI number from adb?

adb shell dumpsys iphonesybinfo You can check and save the IMEI number of your device by dialing *#06# in your dialer app and taking a screenshot of it.


1 Answers

The correct way to do it would be:

adb -s 123abc12 shell getprop 

Which will give you a list of all available properties and their values. Once you know which property you want, you can give the name as an argument to getprop to access its value directly, like this:

adb -s 123abc12 shell getprop ro.product.model 

The details in adb devices -l consist of the following three properties: ro.product.name, ro.product.model and ro.product.device.

Note that ADB shell ends lines with \r\n, which depending on your platform might or might not make it more difficult to access the exact value (e.g. instead of Nexus 7 you might get Nexus 7\r).

like image 76
Simo Kinnunen Avatar answered Oct 03 '22 01:10

Simo Kinnunen