6

I bought a lot (500+) cheap China tablet with AllWinner processor and Android 4.0.3. All tablets expose the same serial number. I can't deploy my application simultaneously on several devices (with a USB hub) using ADB.EXE because it can't distinguish them.

I'm thinking about a pre-deploy process that change the internal serial number, is it possible? Where is the serial number stored?

Note: tablets are rooted

Seraphim's
  • 12,559
  • 20
  • 88
  • 129

3 Answers3

14

You need to populate /sys/class/android_usb/android0/iSerial sysfs file with unique values for every device. Most vendors do it with custom init script, which would read the value from a persistent system property or a regular file and put it in sysfs on every power up.

Alex P.
  • 30,437
  • 17
  • 118
  • 169
  • I can successfully edit the file and set another serial number, but if I reboot the tablet, the original serial number is restored. – Seraphim's Jan 15 '13 at 13:31
  • yes. that's how sysfs works usually. that's why the custom init script is needed. I mean it could be done differently but with the init script is the easiest way. – Alex P. Jan 15 '13 at 16:28
  • I think I don't understand. Are you saying that I need a init script inside Android that change the s.n. at boot? – Seraphim's Jan 15 '13 at 16:33
  • 2
    yes. take a look at https://android.googlesource.com/platform/system/core/+/android-4.2.1_r1/rootdir/init.usb.rc vs https://android.googlesource.com/device/asus/grouper/+/android-4.2.1_r1/init.grouper.usb.rc (standard android vs oem custom usb init script) – Alex P. Jan 15 '13 at 17:22
  • not usefull for my purpose, but interesting! I vote up for you! – Seraphim's Jan 15 '13 at 17:25
  • I used the asus grouper (aka nexus7) as an example of where and how your custom serial number should be set. instead of "${ro.serialno}" you could use "${persist.my.unique.serialno}" and then assign a unique value to that property on every device – Alex P. Jan 15 '13 at 17:33
  • Ok but I can't do this simultaneously on several device, because adb does not distinguish them... correct? – Seraphim's Jan 15 '13 at 19:13
  • 2
    obviously you won't be able to do anything with multiple devices using standard android tools until you fix this issue. depending on your goal - you might prefer to modify the tools (namely adb and fastboot binaries) to use let's say USB DEVPATH instead of USB iSerial as a unique id – Alex P. Jan 15 '13 at 19:50
  • I need to Google, I've no idea what you're talking about ;) thanks – Seraphim's Jan 15 '13 at 20:30
  • 2
    It's actually quite easy to fix: http://stackoverflow.com/a/22824288/21009. With this fix you can run 10 devices at once from eclipse. – Miro Kropacek Apr 02 '14 at 22:27
  • @MiroKropacek Can't try now but very interesting answer. You deserve an upvote! – Seraphim's May 09 '14 at 13:19
1

Try editing /data/misc/wifi/serialno then reboot, it worked as a permanent solution for me

The location of this number may differ between android versions

The serial number should be stored in a file with only the serial number inside and no \n

Arnaud Aliès
  • 1,079
  • 13
  • 26
0

build number etc by editing the 'build.prop' file in /system. The serial number can be changed by adding the property 'ro.serialno=' to build.prop file

  • I changed this by remounting the system partition into read/write but after rebooting it got stuck loading the logo. After another reboot it was back to original value. Using an emulator – nilsi Feb 17 '19 at 15:20