New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adb putty enhancement - support for multi-devices #38

Closed
yumeyao opened this Issue May 5, 2012 · 4 comments

Comments

3 participants
@yumeyao
Contributor

yumeyao commented May 5, 2012

The original adb putty doesn't support for multi-devices, because any string after ':' are recognized as port number by putty, so that even if "transport:" is specified, only "transport" is forwarded to adb_init().

So I changed adb.c a little to make it work.

here is the code snip used to replace original part in adb_init()

    /* send initial data to adb server */
#define ADB_SHELL_DEFAULT_STR "0012" "host:transport-usb"
#define ADB_SHELL_DEFAULT_STR_LEN (sizeof(ADB_SHELL_DEFAULT_STR)-1)
#define ADB_SHELL_SERIAL_PREFIX "host:transport:"
#define ADB_SHELL_SERIAL_PREFIX_LEN (sizeof(ADB_SHELL_SERIAL_PREFIX)-1)
    do {
        size_t len = strlen(host);
        if (len == 0) {
            sk_write(adb->s, ADB_SHELL_DEFAULT_STR, ADB_SHELL_DEFAULT_STR_LEN);
        } else {
#define ADB_SHELL_HOST_MAX_LEN (sizeof(sendbuf)-4-ADB_SHELL_SERIAL_PREFIX_LEN-1)
            if (len > ADB_SHELL_HOST_MAX_LEN)
                len = ADB_SHELL_HOST_MAX_LEN;
            sprintf(sendbuf,"%04x" ADB_SHELL_SERIAL_PREFIX, len+ADB_SHELL_SERIAL_PREFIX_LEN);
            /* memcpy used here because I don't want to use snprintf */
            memcpy(sendbuf+4+ADB_SHELL_SERIAL_PREFIX_LEN, host, len);
            sk_write(adb->s,sendbuf,len+4+ADB_SHELL_SERIAL_PREFIX_LEN);
        }
    } while (0);

_After applying with this patch, one can open adb shell over a specific device by inputing the device ID listed out by "adb devices" into the "Host Name" (Where you may want to change it to "Device ID" when adb is selected)._

_To open the default device (when only 1 device connected), just input a ':' into "Host Name"_

TODO List:

  1. Change "Host Name" to "Device ID" when adb mode is selected.
  2. Allow for blank "Host Name" field when adb mode is selected. (So that ':' is not needed any more)
  3. Add a button to list all devices when adb mode is selected. Adb can be moved to last one, and the button can be placed right after it.
  4. An adb Settings Page in 'Connection', to allow for connecting using other commands rather than "adb shell".

BTW,
I'm willing to accomplish those in TODO list by myself, so could you give me write access to this or simple instructions for how to commit here? I'm quite unfamiliar with github.

@stfnm

This comment has been minimized.

Show comment
Hide comment
@stfnm

stfnm May 5, 2012

Contributor

You can simply fork the repo here on github, commit and push your changes to your fork, and then open a pull request. This is the preferred github way. :)

Also you should check out the help section: http://help.github.com/fork-a-repo/

Contributor

stfnm commented May 5, 2012

You can simply fork the repo here on github, commit and push your changes to your fork, and then open a pull request. This is the preferred github way. :)

Also you should check out the help section: http://help.github.com/fork-a-repo/

@yumeyao

This comment has been minimized.

Show comment
Hide comment
@yumeyao

yumeyao May 5, 2012

Contributor

Thanks. :)
Was working with git on gerrit (Android) way, not sensible about the github way.

The pull request of this basic patch is sent.

Contributor

yumeyao commented May 5, 2012

Thanks. :)
Was working with git on gerrit (Android) way, not sensible about the github way.

The pull request of this basic patch is sent.

@yumeyao yumeyao closed this May 5, 2012

@yumeyao yumeyao reopened this May 5, 2012

@yumeyao

This comment has been minimized.

Show comment
Hide comment
@yumeyao

yumeyao May 5, 2012

Contributor

just reopen here for tracking todo list. :)

Contributor

yumeyao commented May 5, 2012

just reopen here for tracking todo list. :)

FauxFaux added a commit that referenced this issue May 19, 2012

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name
@FauxFaux

This comment has been minimized.

Show comment
Hide comment
@FauxFaux

FauxFaux May 19, 2012

Owner

Looks okay to me, but I still have no way to test it. Merged, thanks.

Owner

FauxFaux commented May 19, 2012

Looks okay to me, but I still have no way to test it. Merged, thanks.

@FauxFaux FauxFaux closed this May 19, 2012

FauxFaux added a commit that referenced this issue Oct 4, 2012

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

@ztNFny ztNFny referenced this issue Oct 9, 2012

Closed

v011 broke ADB #50

FauxFaux added a commit that referenced this issue Oct 25, 2012

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Nov 22, 2012

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Jan 12, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Feb 8, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Mar 19, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Apr 13, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Jun 1, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Jul 13, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Jul 14, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Aug 6, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Aug 7, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name

FauxFaux added a commit that referenced this issue Aug 11, 2013

GH-38: Fix adb-putty to support multi-devices
To connect a specific device, input device ID in host name
To connect the default device, input a colon(:) in host name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment