Getting Connectbot working on Kindle Fire

Ever since getting the Kindle Fire I’ve been dreaming of the day that I can get ConnectBot working.  The first hurdle is that this is not available in the Amazon market.  Luckily, being under the Apache License they did have code available on the google code site.

After installing the apk file, i started up a test connection.  Everything was going well until I got to the part where I enter the server name.  The virtual keyboard pops up, but instead of an enter key there is only .com.  I recognized this as the keyboard that comes up when you are in the web browser.  Unfortunately, unlike the web browser, there is no additional “go” button.

First thing I did was check the issues to see if this has been reported yet.  Yes it had, sounds like many people are itching to ssh from their Kindle Fire :-)

So I dutifully tagged the issue and waited for a fix…

After waiting a few days I couldn’t let it sit. I needed to dig in myself and see if i could find anything.  Seemed like a relatively easy problem

The Process

First I grabbed the code via git from their project page and setup my Android dev environment.  This included installing the Android SDK, installing JDK and installing Eclipse.

Once I got all my goodies installed I connected the Kindle Fire, waited for the “connecting USB” to finish…and…NOTHING!

After a little research I learned I first needed to install the Google USB drivers for this device.  Went into device manager and found the Kindle device with missing drivers, right-clicked and pointed to the ini file.

At this point I was able to do an adb devices and could verify that my Kindle Fire was detected

At this point I was still pretty much at a loss of where to being.  I knew just from playing around with the Kindle Fire that there definitely is a keyboard layout that had an enter key.  For some reason this layout was not using it though, it was defaulting to the same one used for entering websites.  Having the .com where enter should be is normally not a problem – when the keyboard collapses you can then click on the go button.  In this case, however, the keyboard does not allow for that option.

After doing some research I learned that there are many different inputType fields that will basically determine what keyboard layout was used.  Getting closer…

What I finally stumbled upon was, oddly, the default text in the input field “username@hostname:port”.  I was able to use this very unique string to search through the code to eventually come upon my first clue. I was lead to a “hint” (literally) in the <EditText> element, inside of which I noticed the android:inputType that was initially set to textEmailAddress, I changed this to textMultiLine.  My theory being that if it had multiple lines there was some way to send a carriage return.

So far success…

Except now I get to the password line and I’m facing a “new” keyboard with the same issue: a .com where and enter should be.

So doing some more searching I use my same method of searching for the text hint, this time Password: Pretty quickly I found this one but it wasn’t quite the same.  I was lead to strings.xml which is essentially a “lookup table” for strings.  At least now I know that Password: will be in the code somewhere as prompt_password.  So digging some more I found a corresponding <EditText>.  But this lead me to a field for key generation (probably needs to be “fixed” for everything to actually work).  This wasn’t quite what I was looking for.

Browsing the “layout” folder, I was eventually able to find the file I needed. I found a console_password line in act_console.xml.  After adding a android:inputType=”textMultiLine” I was set.  I ran the file, sending it to my Fire and met with success this time when connecting to my server.  Using the following method I was able to take a screenshot of my victory.

The changes 

https://gist.github.com/1384710

The results

I still have little understanding of why what I changed did what it did, or what repercussions this might have on other Android platforms. I hope this does show, however, that with a little persistence to “scratch an itch” it is pretty easy to use some really basic research and techniques to modify Android source code to meet your needs.

Since this has sparked in interest in me for learning more about Android development.  I look forward to learning more about the ins and outs of the platform and how to properly submit and implement patches for bugs like this.

Since this was a quick and dirty hack, I look forward to input on the right way to do this.


Edit 2011-11-22: I forgot to actually describe the problem (lack of Enter key)…

Share

10 Comments

  1. Josh Taylor says:

    Goddamnit… been wanting to get SSH working on my Kindle Fire and this saved me. I just sideload apps from my computer from their APK file, or from the market.

    I’m in the middle of writing a KF “Howto convert your Kindle Fire into an actual Tablet” and will link back to this post for those of us who actually want to do more than read ebooks.

  2. Zach Peters says:

    Glad this helped! Can’t wait to read your write up.

  3. William Jimenez says:

    Thanks for sharing …ive been looking for an ssh client on kindle fire!

  4. Chris says:

    Would you be willing to post a little more information on how you did this? I’m brand new to the Android OS, and I have no idea where to find the files you mentioned. Thanks!

  5. Zach Peters says:

    Chris, email me with what parts you are unclear about and I’m happy to post a followup

  6. John Mead says:

    Hi Zack,

    I’m not much of a hacker… but could sure use your updates. You don’t happen to have a modified version of the apk do you?

    Thanks,
    John

  7. Zach Peters says:

    John, just added a new post with a link to the apk.

    Kindle Fire Connectbot Followup

  8. [...] Just a quick followup to the previous article I had on getting connectbot to work on the Kindle Fire. [...]

  9. John Mead says:

    Hi Zach,

    It worked like a charm. I was able to connect and create a tunnel and finally run a VNC session all from my Kindle Fire. Thanks for the help.

    Thanks,
    John

  10. Dick says:

    I never used a password on my kindle fire. Then today when I opened it it ask for a password and had a strange keyboard. there was #1 thru 0 with letters on the keys but no way to get to the letters to enter a password. As i said I never said ok to a password. Help!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">