How could adb identify many devices with same serial number?

4,946 views
Skip to first unread message

Yidong Han

unread,
Feb 24, 2010, 9:43:47 PM2/24/10
to Android Linux Kernel Development
Now I am trying to plug in many devices with same model and hence same
serial number to the host Ubuntu PC.

When I execute the command:
$ adb devices

I got these results:

List of devices attached
0123456789ABCDEF device
0123456789ABCDEF device
0123456789ABCDEF device
0123456789ABCDEF device
......

All the above are the real devices with the same serial number.

If I run:
$ adb shell

error: more than one device and emulator

$adb -s 0123456789ABCDEF shell
#

But for the last case, the adb just connect the first plugged in
device, and I could not find way to connect to other devices.

So do you guys know a way to work this problem around?

And I notices, the emulator could be identified by port number, like:


List of devices attached
emulator-5554 device
emulator-5556 device
emulator-5558 device
...

How could I implement such mechanism for the real devices?

I will thank you so much for your help.

Best wishes,
Neil

Mike Lockwood

unread,
Feb 25, 2010, 2:02:40 PM2/25/10
to android...@googlegroups.com
Each device needs to have its own unique serial number even if they
are the same model. That is the whole point of the serial number.
Otherwise there is no way to tell them apart and you have this
problem.

Mike

> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel
>

--
Mike Lockwood
Google android team

San Mehat

unread,
Feb 25, 2010, 6:51:18 PM2/25/10
to android...@googlegroups.com
On Thu, Feb 25, 2010 at 11:02 AM, Mike Lockwood <lock...@android.com> wrote:
Each device needs to have its own unique serial number even if they
are the same model.  That is the whole point of the serial number.
Otherwise there is no way to tell them apart and you have this
problem.


*SMH*
 



--
----------
San Mehat
Staff Software Engineer
Google Inc.
o: 650-253-7422
c: 408-382-1249
s...@google.com

Yidong Han

unread,
Feb 25, 2010, 9:55:53 PM2/25/10
to lock...@android.com, android...@googlegroups.com
Hi Mike, 

Thanks a lot for your quick reply.

But I still get some confusions. 

Like HTC, they assigned device serial number like the followings:

HT97KL900624 device
HT94LLZ00229 device

If they assigned it by this way, HT97KL should be the model name, the following digits may be the real serial number, if it is this case, only 999999 devices could be assigned for each model, am I correct?

Another questions is if each device has a unique serial number, how could we assign it when we make volume production. 

I mean like we have millions device to make, how could we assigned it dynamically? Because I checked the source code 
linux\linux-2.6.29\drivers\usb\gadget\android.c

It seems we could only change the serial number at 

/* String Table */
static struct usb_string strings_dev[] = {
/* These dummy values should be overridden by platform data */
[STRING_MANUFACTURER_IDX].s = "Android",
[STRING_PRODUCT_IDX].s = "Android",
[STRING_SERIAL_IDX].s = "0123456789ABCDEF",
{  } /* end of list */
};

In this case, each time, we have to change it and rebuild the android kernel again. Is any other way around for the volume production?

Thank you so much for your help.

Best wishes,
Yidong


2010/2/26 San Mehat <s...@google.com>

Mike Lockwood

unread,
Feb 25, 2010, 10:41:38 PM2/25/10
to Yidong Han, android...@googlegroups.com
In the android devices I have worked on, the serial number is
programmed into flash. The bootloader passes it to the kernel via the
kernel command line and this is then passed to the USB driver. See
arch/arm/mach-msm/devices-htc.c in the msm kernel for an example.

Mike

On Thu, Feb 25, 2010 at 9:55 PM, Yidong Han

Chris Stratton

unread,
Feb 26, 2010, 1:03:39 AM2/26/10
to android...@googlegroups.com

If they are really out of ideas they could use the MAC from whatever wireless/bluetooth/ethernet they have on the device as part of the unit unique serial number.

On Feb 25, 2010 10:41 PM, "Mike Lockwood" <lock...@android.com> wrote:

In the android devices I have worked on, the serial number is
programmed into flash.  The bootloader passes it to the kernel via the
kernel command line and this is then passed to the USB driver.  See
arch/arm/mach-msm/devices-htc.c in the msm kernel for an example.

Mike

On Thu, Feb 25, 2010 at 9:55 PM, Yidong Han

<neil.yi...@googlemail.com> wrote:
> Hi Mike,
> Thanks a lot for your quick reply.

> But I stil...

Yidong Han

unread,
Feb 26, 2010, 3:57:08 AM2/26/10
to Mike Lockwood, android...@googlegroups.com
Hi Mike,

I just heard that some HTC devices do have the same serial no. 

But anyway, thanks a lot for your reply, very useful information:)

Best wishes,
Yidong

2010/2/26 Mike Lockwood <lock...@android.com>

Yidong Han

unread,
Feb 26, 2010, 4:01:18 AM2/26/10
to android...@googlegroups.com, cs0...@gmail.com
Hi Chris,

OK, then, USB driver just do some tricks to integrate serial number with MAC address. Yeah, tks a lot.

Best wishes,
Yidong

2010/2/26 Chris Stratton <cs0...@gmail.com>
--
Reply all
Reply to author
Forward
0 new messages