How can I add a new adb command?

40 views
Skip to first unread message

Edware

unread,
May 19, 2009, 8:39:52 AM5/19/09
to Android Linux Kernel Development
Because I want to develop Android debug tools in Android, I want to
via adb interface. How can I add a new adb command? Thanks for your
help.

Edware

unread,
May 19, 2009, 9:01:05 AM5/19/09
to Android Linux Kernel Development
I found a function "int adb_commandline(int argc, char **argv)" in
android\system\core\adb\Commandline.c. Could I add a new command in
it? Or will it have side effect?

Mike Lockwood

unread,
May 19, 2009, 9:47:08 AM5/19/09
to android...@googlegroups.com
In most cases you should be able to add a new command as a commandline
tool on the device side and use "adb shell <command>" to execute it.
Adding new adb commands should only be done if you really need to add
functionality to adb itself.

What are you trying to do?

Mike
--
Mike Lockwood
Google android team

Edware

unread,
May 19, 2009, 10:18:41 AM5/19/09
to Android Linux Kernel Development
I am sorry that I type a wrong word. I want to develop a debug tools
in "PC" to debug the Android phone. Maybe when I type "adb call 123",
Android can make a call to 123. What can I do if I want to implement
it? Can I add a case "call" in adb_commandline() this function and
implement its action? And would it have many side effect? Thanks for
your help.

On 5月19日, 下午9時47分, Mike Lockwood <lockw...@android.com> wrote:
> In most cases you should be able toaddanewcommandas a commandline
> tool on the device side and use "adbshell <command>" to execute it.
> Addingnewadbcommands should only be done if you really need toadd
> functionality toadbitself.
>
> What are you trying to do?
>
> Mike
>
> On Tue, May 19, 2009 at 9:01 AM, Edware <littlenew1...@gmail.com> wrote:
>
> > I found a function "int adb_commandline(int argc, char **argv)" in
> > android\system\core\adb\Commandline.c. Could Iaddanewcommandin
> > it? Or will it have side effect?
>
> > On 5月19日, 下午8時39分, Edware <littlenew1...@gmail.com> wrote:
> >> Because I want to develop Android debug tools in Android, I want to
> >> viaadbinterface. How can Iaddanewadbcommand? Thanks for your

Mike Lockwood

unread,
May 19, 2009, 11:31:04 AM5/19/09
to android...@googlegroups.com
You would need to do more than change the code in commandline.c. That
file is only included in the PC side of adb. You would need to write
more code to implement the functionality on the device side.

I don't see any benefit at all in modifying adb for this. Just write
a tool on the device called "call", and then run it using "adb shell
call 123"

Mike

2009/5/19 Edware <little...@gmail.com>:

Edware

unread,
May 19, 2009, 12:04:12 PM5/19/09
to Android Linux Kernel Development
Thanks for your answer. Because I must test the modem is work or not.
Call is an example, maybe I'll implement lots of functionality. I
extend ADB because our employees want to test in the factory. To use
"adb shell" may save lots of time.

On 5月19日, 下午11時31分, Mike Lockwood <lockw...@android.com> wrote:
> You would need to do more than change the code in commandline.c. That
> file is only included in the PC side ofadb. You would need to write
> more code to implement the functionality on the device side.
>
> I don't see any benefit at all in modifyingadbfor this. Just write
> a tool on the device called "call", and then run it using "adbshell
> call 123"
>
> Mike
>
> 2009/5/19 Edware <littlenew1...@gmail.com>:
>
>
>
>
>
> > I am sorry that I type a wrong word. I want to develop a debug tools
> > in "PC" to debug the Android phone. Maybe when I type "adbcall 123",
> > Android can make a call to 123. What can I do if I want to implement
> > it? Can Iadda case "call" in adb_commandline() this function and
Reply all
Reply to author
Forward
0 new messages