Adding ADK support in your Optimus one Android device

For pt-br readers, sorry for posting this in english, will try to translate soon.

Few days ago I decided to grab a cheap LG Optimus One Android phone and add ADK support (Android Open Accessory, basically an Arduino with a special shield). I didn´t have any experience on hacking Android and after reading tons of tutorials on xda forum, managed to make it happen.

Disclaimer: be aware that I´m not responsible for any damage on your device, and BACKUP always. There is a little risk on running into problems and backups can recover your phone easily. Wait for instruction on how to compile the kernel, and you will be capable of applying fixes to any other device running cm7 and kernel 2.6.35+.

Step 1: Install LG drivers in your phone. More info here

Step 2: Get root access to your phone. Be careful, since there are different ways to do this based on your android version.

[pt-br users, click here for a good explanation]

For 2.2, see here

For 2.3, see here

Step 3: Install a backup tool. I´m using clockworkmod, basically you need to download an app called “Rom Manager” from Market Store and click on “Flash ClockworkMod recovery”. Info here

Don´t do anything else without installing this. This is a small operating system capable of recoverying your phone, even if you make any mistake.

After installed, you can open the “Rom Manager” app, and click on “Reboot into recovery” to enter in recovery mode, or with your phone off, press home symbol + volume down + power and wait till you get into it.

Now with this app installed, create a BACKUP of your phone!

Step 4: If your phone is using the new 2.3.3 software native from LG, you should downgrade your baseband. NOTE: this is valid just for users who have upgraded using LG updater tool. Go to the next step if it is not your case.

This is an important step, mostly because CM7 mod roms are based on the old baseband (e.g. radio firmware). Follow carrefully the instructions posted.

[pt-br users - follow this tutorial here]

Non-pt-br users – follow this tutorial here.

If everything goes fine, you must have lost signal on your mobile. That´s ok, since we will flash the new rom, and everything will be back.

Step 5: Download a customized rom. I´m using miks 6.6.1, that you can get here. Note that you must get testing (6.6.1) in order to have ADK working properly, since this rom is based on kernel 2.6.35.

Save the zip file onto your phone´s smartcard. DO NOT unzip, and put it on the root folder.

Breath a bit, read FAQ, and instructions posted on the link above and dont panic. All the answers are there.

Go to Rom manager app and choose “install rom from sd”, choose the zip file. You can also go into recovery mode and choose update a zip file.

Tips:

a) When in recovering mode, volume up and down moves the cursor; first left button (near home), chooses an option; arrow goes back.

b) You can mount a SD card without needing to boot your system. When in recovery mode, click mount, and choose “SD card”.

Wait till it reboots and applies the rom. Choose “wipe cache” and “wipe factory reset” in order to have your new ROM working properly. If you don´t do this, you will get a logo frozen when booting. Will take some minutes to have your app running again.

If Google apps disappear, read the tutorial again, upload gapps.zip to your sdcard, go to recovery mode and execute. Really simple.

Step 5: Ok, now you are a happy user, running a mod rom. You might experience some bugs, and if you don´t like and want to give up, just restore your backup.

If you feel you need to proceed, let´s move to the next step.

Step 6: Let´s install arduino firmware and demokit app.

a) For Arduino, will not cover driver installation, and others. Everything you want is explained here. The complete package, containing driver, app, etc, you can get directly here.

Basically you need to open arduino IDE and successfully upload demokit.pde into your board. With that said, let´s move.

b) For Android, now comes the tricks:

Setup all Android development – Eclipse, Adt, etc, etc, and don´t forget to download GOOGLE APIS API LEVEL 10. This is important: don´t mess with the other api level 10, must be Google´s one.

1) Open eclipse and setup demokit as described on the page I mentioned on this step. Don´t forget to enable USB Debbuging under system, application, development. This will enable you to upload the code direclty from eclipse.

2) With everything set, right click on your project, mark run as Android Application. Click or device and run. You MUST get an error related to permission, something like com.future.android …

3) Now you need to push some files to your device using ADB, in order to get ride of this errors. Basically we are getting Nexus One files into our device. More details you can see here (will explain below)

  • To push files, you need to remount your /system as write mode. Open your prompt, locate folder where adb is located (mine under windows is c:\program files x86\android\android-sdk\platform-tools).
  • Type adb shell and press enter;
  • Type mount and press enter. Locate where /system is mounted;
  • Now remount, adding the info you located above, in my case:
    • mount -o rw,remount -t yaffs2 /dev/block/mtdblock3
    • chmod 777 /system
  • Download Nexus One files from here and unzip it.
  • Inside it, there are 4 folders – app, etc, framework, lib. Delete app and lib folder;
  • Back to your prompt, let´s push the files via adb:
    • adb push c:\tmp\framework /system/framework  and press enter;
    • adb push c:\tmp\etc /system/etc/permissions and press enter;
  • Now you have the files, you should go back to recovery and wipe dalvik cache (under advanced option);

4) Go back to eclipse and try to run your app again. You might get error of unsigned app, if so, disable this on configurations, applications.

Try again , and if you did everything correctly, you will see demokit on your phone. Open it, and nothing will happen, we still dont have the driver/kernel patched.

Step 7 – flashing a new kernel: I´m using Franco Kernel, which is the best one available to Optimus one, and the newest version is based on 2.6.35.

Here I spent some time figuring out how to download the source, compile the kernel and applying the patches. Will not cover this right now, instead, you can just flash the kernel I compiled.

I didn´t test everything yet, so download franco´s latest version and upload to your sdcard, in case you have any trouble. The process to update the kernel is very similar to updating a ROM: place a zip on your sdcard root folder, go to ROM Manager, and choose to wipe dalvik cache. Just be aware of which kernel version you are applying!

Download mine here and flash.

If everything goes right, connect your usb cable and enjoy! Picture below.

Optimus one running adk

Optimus one running adk

Will post more details soon about how to compile Franco´s Kernel and how to apply those patches, for sure other device owners will be happy.

Questions ? Let me know.

Bookmarksbookmark bookmark bookmark bookmark bookmark bookmark

Popularity: 10%

4 Comments so far

  1. Phillip on November 27th, 2011

    Hi,

    The link to your customer kernel is not working.

    I would love to try this out with my arduino. Also would you be able to post your
    /system/framework/com.google.future.usb.accessory.jar and permission file (xml) from /system/etc/permissions/

    Hope you can comlete your post on compiling the kernel soon as I am having a hell of a time getting anything to compile in eclise!

    Thanks for your post.

  2. Phillip on November 27th, 2011

    Apologies, I now see you already link to the files requested.

    I was also able to download your kernal. I dunno what I did wrong the first time.

    Thanks. Really keen to try this.

  3. Phillip on November 28th, 2011

    Hi,

    Just wanted to say thanks again for your post. I tried using your kernel with my existing rom (A version of Oxygen) but it became very unstable. So I installed miks rom 6.6.1 as per your instruction and everything works fine. Was able to connect to my arduino board.

    Can you tell me … I assume to get this to work, you compiled in the usb_accessory mode, is it possible to compile in usb OTG as well?

    It really took me a long time to get this all up and running, even with your instructions and other reference material on the web. It amazes me how you work this all out in the first place.

    Regards Phil

  4. admin on November 28th, 2011

    Good question. Need to test, since when connecting in accessory mode need to disable everything and just keep adb running. So, not sure.

    Will publish the article soon and maybe you can help on this :-)

    Best

    Robson

Vale Presente