Closed Bug 875534 Opened 12 years ago Closed 10 years ago

Unable to direct ADB forward command to inari devices due to colon (:) in serial ID

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

ARM
Gonk (Firefox OS)
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: davehunt, Unassigned)

References

Details

Inari devices use the MAC address (for example F8:DF:A8:0B:35:25) as the serial number. This makes it possible to direct to a single device when multiple are attached, however the colon (:) character is causing certain commands to fail. One such command is forward, which is necessary to configure the device for responding to Marionette commands. The following is an excerpt from the output of adb with trace debug enabled: $ adb -s F8:DF:A8:0B:35:25 forward tcp:2828 tcp:2828 ... system/core/adb/adb_client.c::_adb_connect():_adb_connect: host-serial:F8:DF:A8:0B:35:25:forward:tcp:2828;tcp:2828 system/core/adb/transport.c::writex():writex: fd=3 len=4: 30303337 0037 system/core/adb/transport.c::writex():writex: fd=3 len=55: 686f73742d73657269616c3a46383a44 host-serial:F8:D As you can see from the above, the colon is causing the serial ID to be interpreted as 'F8' and the service requested to be 'D'. I have tried escaping this on the command line and by setting the ANDROID_SERIAL environment variable.
Yeah - I think we'll need to get the serial number to not contain any colons. It should either use no separator or use a '-'
(In reply to Dave Hylands [:dhylands] from comment #1) > Yeah - I think we'll need to get the serial number to not contain any > colons. It should either use no separator or use a '-' The device serial has colons by default is there a way to override this permanently?
Flags: needinfo?(dhylands)
To be quite honest, I'm not sure. I started to look at where android retrieves the serial number from, and didn't get to the bottom of it. If I get a chance, I'll dig a bit further.
Flags: needinfo?(dhylands)
It's coded in the kernel. Is patching kernel or adb feasible options?
Faramarz, do you know who's best to answer comment 4, and/or look into this further? It'd really help us scale much faster if we didn't have to bring up Mac Minis using a 1:1 mapping, like this. Thanks!
Flags: needinfo?(frashed)
:mwu can you see comment #4 please?
Flags: needinfo?(frashed)
Flags: needinfo?(mwu)
(In reply to Kan-Ru Chen (:kanru) (Mozilla Corporation) from comment #4) > It's coded in the kernel. Is patching kernel or adb feasible options? It's not actually in the kernel. It's a hack that I stuck into one of the init scripts in the root directory. On other devices, I think I used a timestamp as the serial. The ideal solution would be getting a proper serial from the bootloader, but the bootloaders we have don't report that correctly.
Flags: needinfo?(mwu)
If these are releng builds, I can get them updated to fix this issue.
(In reply to Michael Wu [:mwu] from comment #8) > If these are releng builds, I can get them updated to fix this issue. Oops, I missed this; these are definitely releng builds, so if you would, please do!
After speaking to :nbp it seems this may be possible to fix during our flash process.
Flags: needinfo?(nicolas.b.pierron)
(In reply to raymond [:retornam] from comment #2) > (In reply to Dave Hylands [:dhylands] from comment #1) > > Yeah - I think we'll need to get the serial number to not contain any > > colons. It should either use no separator or use a '-' > > The device serial has colons by default is there a way to override this > permanently? The adb serial number can be changed with a simple comamnd: $ adb shell 'setprop persist.usb.serialno' new_serial Sadly, even if this persist across reboot, this does not persist across flashing. One thing I did to solve[1] this issue is to give the phone the same serial as its fastboot number. The main reason being that the flash.sh command use the same serial for both adb and fastboot. Still, the command was blocking while waiting for the phone with the correct serial, because the flash process reset the serial number of adb. To prevent the reset of the serial number, a solution is to flash the phone with an image which already overwrite the serial number, such as as soon as it is flashed, adb would start with the new serial, and the flash process can continue. - If you are building the phone your-self, and have one tree per phone, then you can do as I did for arewefastyet, which is to add a Makefile rule to create the image with the desired /data/local.prop file in the userdata image. - Otherwise, you will need to have a script which can do the following: - unzip the userdata image. - mount the userdata image on a directory. - add local.prop file to the directory root of the userdata directory. - compress an image of the same size of the original. - flash with this new userdata image. In both cases, the local.prop file should contain the following line: echo "persist.usb.serialno=$fastbootSerial" > local.prop This way, adb will have the same serial as fastboot and the flash.sh command would be able to terminate when called with a "-s <serial>" argument. [1] https://github.com/nbp/arewefastyet/blob/master/driver/b2g-benchmark.sh#L97
Flags: needinfo?(nicolas.b.pierron)
(In reply to Nicolas B. Pierron [:nbp] from comment #11) > (In reply to raymond [:retornam] from comment #2) > > (In reply to Dave Hylands [:dhylands] from comment #1) > > > Yeah - I think we'll need to get the serial number to not contain any > > > colons. It should either use no separator or use a '-' > > > > The device serial has colons by default is there a way to override this > > permanently? > > The adb serial number can be changed with a simple comamnd: > > $ adb shell 'setprop persist.usb.serialno' new_serial I investigated this with Dave, and it seems that the inari does not honor this property, but the unagi do use it /root/init.*.usb.sh which is used during the start-up of the phone. These files can be found in the temporary build products[1], when you are building your own version for the device. This is how I found that the setprop should be able to set a value which persist across reboots. If you cannot find what is setting the serial number, you want to look at which init file is writing into the iSerial file[2] used by adbd when the connection is initialized. And if you cannot find the service, then this easiest way would be to have a second init script which is stopping adbd, set the value into the iSerial[2], and start adbd again. In which case this will re-establish a connection with the device and take the new name instead of the MAC address. [1] B2G/out/target/product/unagi/obj/ETC/init.*.usb.sh*/init.*.usb.sh [2] /sys/class/android_usb/android0/iSerial
You can use the usb:<blah> listed in "adb devices -l" and that seems to work.
(In reply to Stuart Colville [:scolville] from comment #13) > You can use the usb:<blah> listed in "adb devices -l" and that seems to work. Excellent tip.
We are no longer testing against Inari.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Depends on: 1499102
You need to log in before you can comment on or make changes to this bug.