Tuesday, September 7, 2010

Reboot-Persisting All-User-Access USB Serial Port on Froyo

I turned the USB into a serial port. Then, I noticed it wasn't usable without superuser permissions. Recently, I got some great information from a former Android coder and have now have a permanent fix that persists on reboot with Android 2.2 (Froyo).

First, I edit init.mahimahi.c
(mahimahi is the board for Nexus One (aka HTC Passion), if you're working on another HTC device, you'll need to edit the right file for your device).
$ gedit path/to/device/htc/passion/init.mahimahi.c

I put the following at lines 64 and 65.
#mwk: Enable Serial Port for all users
chmod 0777 /dev/ttyMSM0

I run lunch.
~/mydroid$ . build/envsetup.sh
~/mydroid$ lunch
I choose option 4 (full_passion)

I plug in a Nexus One and extract the device info.
~/mydroid$ cd device/htc/passion
~/mydroid/device/htc/passion$ ./extract-files.sh

I re-make the AOSP.
~/mydroid/device/htc/passion$ cd ../../..
~/mydroid$ make

I get the phone in bootloader mode (the fast way).
$ adb reboot-bootloader

I flash the device. (On this website, step 14 didn't work for me, so I now run the command this way.)
~/mydroid/out/host/linux-x86/bin$ sudo ./fastboot -p passion -w flashall

On the phone, I enable applications from unknown sources.
Settings--> Applications --> Unknown sources --> checked

Also, on the phone, I enable USB Debugging, Stay Awake, and Allow Mock Locations.
Settings--> Applications --> Development --> checked all three