Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

ADB enhanced Putty (replacement for "adb shell" command)

OP sztupy

8th October 2010, 07:57 PM   |  #1  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 857
 
1,059 posts
Join Date:Joined: Dec 2008
Donate to Me
More
We all know that running "adb shell" from the command line is pretty crap, and when using a latter busybox version which has coloring support it's ultimately crap. One workaround was usually to start a telnet server on the phone, and use putty to connect to that telnet server. Actually there is a more easier way to do that which also works for non rooted phones.

Actually the Android Debug Bridge has a terminal connection feature (roughly speaking), which will be enabled after you connect to the adb server in "0006shell:" mode. You can actually use the putty to connect to this interface always, by setting the following things:
- Turn off line discipline in settings
- Use RAW mode to connect to localhost:5037
- Enter "0012transport-usb" (without quotes)
- Enter "0006shell:" (without quotes)

Now you've got a full fledged connection to your device. The main drawback is that it's tedious to repeat the above all the time, so I've made some modifications to the putty binary that adds a new type of connection, called "Adb"

To use the enhanced putty:
- Select Adb from the connection type list
- Enter "transport-usb" in the host (or any other connection string, check the adb socket interface documentation if you need something else than connecting via usb)
- Enter 5037 as port, if it's not already set there.
- Connect and enjoy (you might also save this connection, so next time you only have to double-click on the settings)

DL and source: http://github.com/sztupy/adbputty/downloads

Screenshot:
Attached Thumbnails
Click image for larger version

Name:	putty.jpg
Views:	22889
Size:	34.4 KB
ID:	415809  
Last edited by sztupy; 9th October 2010 at 12:58 AM.
The Following 26 Users Say Thank You to sztupy For This Useful Post: [ View ]
9th October 2010, 12:05 AM   |  #2  
Namuna's Avatar
Senior Member
Flag New York
Thanks Meter: 92
 
492 posts
Join Date:Joined: Jan 2010
Donate to Me
More
Thanks for this sztupy! I had scripted out connecting to my N1 via putty, but lost the scripts.

I just tried connecting using your tweaked putty, but got an error. Here're a couple screenshots to show how I tried to connect and the issue I had.
Attached Thumbnails
Click image for larger version

Name:	puttySettings.gif
Views:	1917
Size:	24.2 KB
ID:	415787   Click image for larger version

Name:	gethost.gif
Views:	1465
Size:	10.8 KB
ID:	415788  
9th October 2010, 12:48 AM   |  #3  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 857
 
1,059 posts
Join Date:Joined: Dec 2008
Donate to Me
More
Quote:
Originally Posted by Namuna

Thanks for this sztupy! I had scripted out connecting to my N1 via putty, but lost the scripts.

I just tried connecting using your tweaked putty, but got an error. Here're a couple screenshots to show how I tried to connect and the issue I had.

The only place where it uses gethostbyname is while querying "localhost". I don't know why this fails. (maybe IPv6 related(?)...) I'll replace it to actually use "127.0.0.1"...
4th April 2011, 10:47 PM   |  #4  
Member
Thanks Meter: 4
 
71 posts
Join Date:Joined: Dec 2007
Hi there, just go an LG Optimus 2X, and I'm starting to play with it.
But as my linux skill is almost inexistant I do have a hard time
So I wanted to use your alternate putty, mainly for tab-completion, but it doesn't work.
Putty is working, but "tab" is just tabing ...
Read that's a server functionality ==> does it mean that I need to install something on my phone ?

Thx for your time
5th April 2011, 01:00 PM   |  #5  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 857
 
1,059 posts
Join Date:Joined: Dec 2008
Donate to Me
More
Quote:
Originally Posted by goulloux

Hi there, just go an LG Optimus 2X, and I'm starting to play with it.
But as my linux skill is almost inexistant I do have a hard time
So I wanted to use your alternate putty, mainly for tab-completion, but it doesn't work.
Putty is working, but "tab" is just tabing ...
Read that's a server functionality ==> does it mean that I need to install something on my phone ?

Thx for your time

To have auto complete you need to have an auto-complete enabled shell on the phone. The default "sh" shell is very minimal (as usual phone users won't use it), so you need another one. Busybox's "sh" is actually "ash" which has all of the features you need. So to use this feature you have to have busybox installed (which is usually there if you have rooted your phone, or can be installed from market)

If you have busybox installed, then you have to run it's sh with "busybox sh" or "busybox ash". You'll get a new prompt with the new features.
13th July 2011, 11:42 PM   |  #6  
Senior Member
Thanks Meter: 105
 
357 posts
Join Date:Joined: Feb 2011
More
Thanks for adb putty!

How can I configure Home and End keys?
14th September 2011, 04:01 PM   |  #7  
Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Sep 2011
Wink Putty replacement
Hi there,
I don't know how relevant my post is in the context of this thread but I just wanted to let everyone know that I came across a new free terminal "ClearTerminal" which seems to be good.
You can try this one out if you need a replacement for putty or any other terminal.
It's available at clearconnex.com/content/clearterminal

Have a good time
27th November 2011, 11:49 PM   |  #8  
Euclid's Brother's Avatar
Senior Member
Flag Dallas, TX
Thanks Meter: 256
 
900 posts
Join Date:Joined: May 2011
Donate to Me
I'm using the modified PuTTY above, which works great if there is only one device connected. Is there a way to specify a device# if you have more than one device connected?

Thanks,
28th November 2011, 02:35 AM   |  #9  
d00mz's Avatar
Senior Member
Flag North Texas
Thanks Meter: 22
 
296 posts
Join Date:Joined: Oct 2007
Donate to Me
More
Pretty sweet! How do you get the colors in the session? Mine is black & white only. Running CM7.1.
28th November 2011, 04:50 AM   |  #10  
Junior Member
Thanks Meter: 1
 
11 posts
Join Date:Joined: Apr 2011
only colors ?
i think its the same ..

Post Reply Subscribe to Thread

Tags
adb, command line, putty, shell
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes