Adb putty enhancement - support for multi-devices #38

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

Projects

None yet

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.

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/

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
Contributor
yumeyao commented May 5, 2012

just reopen here for tracking todo list. :)

@FauxFaux FauxFaux added a commit that referenced this issue May 19, 2012
@yumeyao @FauxFaux yumeyao + 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
e4a28fb
Owner

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

@FauxFaux FauxFaux closed this May 19, 2012
@FauxFaux FauxFaux added a commit that referenced this issue Oct 4, 2012
@yumeyao @FauxFaux yumeyao + 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
29c4bc6
@ztNFny ztNFny referenced this issue Oct 9, 2012
Closed

v011 broke ADB #50

@FauxFaux FauxFaux added a commit that referenced this issue Oct 25, 2012
@yumeyao @FauxFaux yumeyao + 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
f24b1a8
@FauxFaux FauxFaux added a commit that referenced this issue Nov 22, 2012
@yumeyao @FauxFaux yumeyao + 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
16e3088
@FauxFaux FauxFaux added a commit that referenced this issue Jan 12, 2013
@yumeyao @FauxFaux yumeyao + 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
ecef27a
@FauxFaux FauxFaux added a commit that referenced this issue Feb 8, 2013
@yumeyao @FauxFaux yumeyao + 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
e766aec
@FauxFaux FauxFaux added a commit that referenced this issue Mar 19, 2013
@yumeyao @FauxFaux yumeyao + 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
3963646
@FauxFaux FauxFaux added a commit that referenced this issue Apr 13, 2013
@yumeyao @FauxFaux yumeyao + 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
78306a9
@FauxFaux FauxFaux added a commit that referenced this issue Jun 1, 2013
@yumeyao @FauxFaux yumeyao + 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
94932c4
@FauxFaux FauxFaux added a commit that referenced this issue Jul 13, 2013
@yumeyao @FauxFaux yumeyao + 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
6c59619
@FauxFaux FauxFaux added a commit that referenced this issue Jul 14, 2013
@yumeyao @FauxFaux yumeyao + 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
b073d50
@FauxFaux FauxFaux added a commit that referenced this issue Aug 6, 2013
@yumeyao @FauxFaux yumeyao + 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
96bb165
@FauxFaux FauxFaux added a commit that referenced this issue Aug 7, 2013
@yumeyao @FauxFaux yumeyao + 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
dec082d
@FauxFaux FauxFaux added a commit that referenced this issue Aug 11, 2013
@yumeyao @FauxFaux yumeyao + 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
1926250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment