Is it possible to connect to device using ADB through serial port?

10,273 views
Skip to first unread message

ji fei

unread,
Feb 3, 2012, 1:25:15 AM2/3/12
to android...@googlegroups.com

I am now connecting my development device through ethernet because the usb port hasn't been enabled. But every time i restart some thread the connection is disconnected and dispatching a app to device is also very slow. So i doubt is it possible to using serial port to connect?
thanks


Alvin Wong

unread,
Feb 5, 2012, 9:02:24 AM2/5/12
to android-porting
Hi there,

I think the only way to debug through serial port is to use a serial
console, like setting "console=/dev/ttyS0,115200n1
androidboot.console=/dev/ttyS0" (is it right?). Using adb through
serial seems not possible (unless you can emulate the adb protocol or
ethernet through the serial port, but this would be very rare).

I suppose you should be able to use adb through network (tcp). Are you
using it now? I now debug my device through WiFi, even when I have
`adb logcat`, `adb shell` and `adb shell cat /proc/kmsg` all running
at the same time the speed is quite fast. When I `adb push` some
files, the speed is 141 KB/s (10104 bytes in 0.069s), which is quite
acceptable. I expect running through wired ethernet can be much
faster.

I just add `setprop adb.tcp.port 5555` to init.rc to be able to use
adb via network. Don't even think of using serial port as the speed
would be much much slower.

Good luck,
Alvin Wong

sai

unread,
Feb 6, 2012, 1:28:01 AM2/6/12
to android-porting
I know there is a daemon(adbd?) in the android device to communicate
with pc host. you can read the source code of adb.maybe repair it for
serial port.

Alvin Wong

unread,
Feb 7, 2012, 6:00:14 AM2/7/12
to android-porting
First I would like to reply to ji fei's message:

Well connecting through network isn't the best method, especially when
you are debugging core functions. My WiFi connection also resets when
the system_server is restarted. But once you get the system_server
stable it is quite good. Or if you can get rid of the USB gadget if
you have a USB controller, it is better to be used.

Otherwise I think adb via network is the second best method.

You can still use the serial port to act as a console. Perhaps not as
convenient as adb, but at least you get a stable console. (I wished I
have a serial port connected on my device, then porting could be
easier)

2012/2/6 ji fei <...@gmail.com>:
> I can complete every work except "adb sync" using serial port.
> adb logcat:   echo "logcat" > /dev/ttyS0 && cat /dev/ttyS0 &
> simulate some keystroke: echo "input keyevent 3" > /dev/ttyS0
>
> Other command can be done using " echo cmd > /dev/ttyS0" and cat /dev/ttyS0
> will print the stand output of target device. I did this just because the
> connection of Ethernet is not very stable and when i restart system_service
> process i have to reconnect.



Now reply to sai's message:

Yes there is adb for debugging.

However I think using adb via serial port is far too complicated, as
you have to modify both adbd and adb on the host computer. It doesn't
worth the effort.
Reply all
Reply to author
Forward
0 new messages