Using adb on the Kindle Fire

USB debugging is enabled by default on the Kindle Fire but it’s not obvious how to connect to it. Because I’ll never get the thirty minutes I of my life I wasted figuring it out back, I’ve decided to write about it with the hope that it helps some other poor sucker.

The short story (TL;DR)

Create or edit ~/.android/adb_usb.ini to add the USB vendor ID for the Kindle:

0x1949

This file is read by adb at run time and contains a list of IDs of vendors who produce Android devices. If you’ve used adb before with other Android devices but haven’t got a clue why you can’t get it working on your Kindle, this is probably it; I had never had to do this before either.

If it’s still not working, you’ll also have to add a udev rule to set proper permissions on the device, something like /etc/udev/rules.d/60-android-adb.rules:

# kindle fire adb (stock)
SUBSYSTEM=="usb", ATTR{idVendor}=="1949", ATTR{idProduct}=="0006", MODE="0666"

After that you should just replug your Kindle Fire and you should be good to go. Now run off and root it already.

The long story

The answer to this ~/.android/adb_usb.ini voodoo can be found in the source code for adb itself. usb_vendors.c lists a handful of Android vendors and their USB product IDs:

// Google's USB Vendor ID
#define VENDOR_ID_GOOGLE 0x18d1
// Intel's USB Vendor ID
#define VENDOR_ID_INTEL 0x8087
// HTC's USB Vendor ID
#define VENDOR_ID_HTC 0x0bb4
// Samsung's USB Vendor ID
#define VENDOR_ID_SAMSUNG 0x04e8
...

When adb starts up it scans the USB bus for devices with product IDs it recognizes which are likely to be Android devices. For devices by manufacturers who aren’t in the list (like Amazon), there’s this additional bit which instructs adb to read extra vendor IDs from ~/.android/adb_usb.ini:

#define ANDROID_PATH ".android"
#define ANDROID_ADB_INI "adb_usb.ini"
...
    if (get_adb_usb_ini(temp, sizeof(temp)) == 0) {
        FILE * f = fopen(temp, "rt");

        if (f != NULL) {
            /* The vendor id file is pretty basic. 1 vendor id per line.
Lines starting with # are comments */
            while (fgets(temp, sizeof(temp), f) != NULL) {
                if (temp[0] == '#')
                    continue;
...

So there you have it, I’m no longer confused. The mystery is solved, my Kindle Fire is now rooted, and I’ve learned a little bit more about Android internals.

3 thoughts on “Using adb on the Kindle Fire

  1. I really love your efforts at solving such mysteries, you don’t give up. valuable info for hardware hackers and tech enthusiasts. now i am one step ahead in getting a Kindle Fire. will be back on the usb-serial project , want to set up some robotics project for undergrad microprocessor students. great job.

    1. It’s actually my girlfriend’s Kindle, haha. I had told her, “Hold on, I just wanna root this real quick” like I’ve done on a million other devices… I was frustrated that it took so long to figure out.

      All the guides out there which mention this mysterious adb_usb.ini file fail to explain what it does! A bunch of Windows n00bs on Stackoverflow saying stupid stuff like “Maybe you have to restart your computer” and a bunch of ridiculous superstitious stuff.

      I’m glad I got to the bottom of it. 🙂

Comments are closed.