Using adb with a OnePlus X on Linux…

… is not really that hard. Just annoying. Since OnePlus’ USB ID is not in the default adb list, you need to add it yourself:
echo "0x2a70" >> ~/.android/adb_usb.ini
where 0x2a70 is the identifier for OnePlus. (you can find this with lsusb)

To add automatic permissions to the device node when it’s created, add this udev rule to /etc/udev/rules.d/51-android.rules (all on one line):

SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", MODE="0666", GROUP="plugdev" ATTR{idVendor}=="2a70", ATTR{idProduct}=="9011|f003", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

Compiling Android / CyanogenMod from source

On the HTC Desire S, I’ve been using an unofficial build (made by Flinny) of CyanogenMod 10 for a while – happily so.
Unfortunately the author is/was a bit strapped for time, and development slowed down significantly at the time. Updates for CM 10.1 and later were not forthcoming.
Since I’m enough of a geek, and suffering from ORD, I decided to try to ‘roll my own’: to compile CM from source. As it turned out, it’s not quite as hard as you’d think it is.

First, you need toI was going to write a lengthy tutorial here, but there are plenty of tutorials out there. So instead of inventing the wheel yet again, you can just go look at this one, or here or . Or you can just go and Google it ;)

You can find the thread for my unofficial builds on XDA Developers.
The git repository with all my sources can be found here, on GitHub.

Android Backup & Restore

You’ve just gotten your shiny new Android Phone, and you want to migrate to it. There are several options, including Titanium Backup to move stuff, but Google also has you covered (party): Android Backup & Restore. You can find this setting on your phone, under “Settings” and “Backup & Restore”. This thing backups several things, but far from all:

  • Your installed (Google Play) apps
  • WiFi accesspoints & passwords (if this is a good thing, is another question)
  • Certain application settings (this is application dependent)
  • Probably more…

This feature is known to be a bit of a battery drainer, so many people leave it off by default. This is ofcourse a PITA when you want to move – as your phone won’t start backing up immediately after you tap the option.

Luckely, you can trigger this manually: you need to activate USB Debugging on your phone, and then start a new ADB shell with the command aplty called adb shell
Then you can play around with the backup manager, bmgr. In most cases you’ll just want to trigger a backup immediately: bmgr run
This will trigger the backup manager to run a backup, send all your stuff over to the cloud. Give it a few minutes, and then add your Google Account to your new phone, and presto – it’s all there. Sortof.

For a full overview what you can do with bmgr, see the android developer webpage.

Manually flashing an OTA-update

I recently acquired a second-hand HTC One X. A week or two back HTC decided to release the JellyBean update for the phone, all was well. Yesterday, another update was sighted on XDA, and since it seems like this one gives better battery life, I didn’t feel like waiting another 3-5 weeks before it became available in my country, so I searched on how to manually flash an OTA.

As always, this procedure comes with no guarantees it will work for you. It might as well decide to eat your cat, or turn your blood into liquid metal (if you don’t have a cat).
Continue reading

Copying over your wifi access points on Android

In case you have just bought a new phone, rooted it, and want to copy over all your wifi access points, there are a few options:

  • Use the synchronisation to Google to have them keep a backup. Not my favourite, since it tends to restore just a bit too much (like all the apps you already removed before)
  • Use a tool like Titanium Backup, but I’ve noticed that this doesn’t always work between phones. On the same one, sure.
  • Manually copy them over. This is the way I usually go, and it works well.

First, copy the original files over: (do this for both phones)

  1. Plug your phone via USB, enable USB debugging in the setting (developer options) and make sure you have the Android SDK installed on your computer
  2. Disable wifi on your phone. Really. Just do it.
  3. open a shell to your phone, and copy the wpa_supplicant.conf file to your SD:
    adb shell
    su
    cd /data/misc/wifi
    cp wpa_supplicant.conf /mnt/sdcard

  4. Pull the file to your computer somewhere:
    adb pull /mnt/sdcard/wpa_supplicant.conf /tmp/wpa_supplicant.old

Repeat this for the new phone, but in the last step, you should pull it to /tmp/wpa_supplicant.new.

Now, edit the /tmp/wpa_supplicant.old file, and remove everything that doesn’t read

network={
        ssid="mynetwork"
        psk="mysupersecretkey"
        key_mgmt=WPA-PSK
        priority=1
}

network={
        ssid="myotherfabnetwork"
        key_mgmt=NONE
}

Next, we want to add this to the new file. Easy peasy: cat /tmp/wpa_supplicant.old >> /tmp/wpa_supplicant.new.

The last thing to do is put the new file on the new phone, and reset it’s permissions:
adb push /tmp/wpa_supplicant.new /mnt/sdcard/wpa_supplicant.conf
adb shell
su
cd /data/misc/wifi
cp wpa_supplicant.conf wpa_supplicant.conf.backup
mv /mnt/sdcard/wpa_supplicant.conf .
chown system.wifi wpa_supplicant.conf

And you’re good to go. Rebooting your phone might not be necessary, but it’s recommended.

S-OFF and Jellybean on the HTC Desire HD (Ace)

I acquired a secondhand HTC Desire HD, a nice phone (albeit a bit heavy). Comes with Android 2.3 (Gingerbread) and Sense. I’m personally not much of a Sense fan, and I wanted to move to a newer Android release, so I looked around on how to achieve S-OFF.

In the end, it’s fairly easy, thanks to the Advanced Ace Hack Kit (AAHK now for short).

Requirements for the adventure:

First, read the “effen manual” that comes with the AAHK. Find the code, and once you’re in the menu, pick option 1 – “Hack Ace”.
Wait a bit.
See the phone reboot some.
Wait some more.
*poof* you’re now S-OFF!

The next thing I did was flash a new recovery (I’m a big fan of 4Ext Recovery), and after that downloaded the radio and the lastest version of JellyTime and the accompanying Google Apps and flashed those. A reboot later: JellyBean on the HTC Desire HD!

Reset android lockscreen to slide

You’ve just reconfigured the security lockscreen settings on your (rooted) android phone, and then forgotten eg. the PIN code to unlock it? It happened to me yesterday.

Luckely(?) there’s an easy way around it, if you have adb activated:

Connect your phone to your computer, and do this:

adb shell
su
rm /data/system/locksettings.db*
reboot

This will basically delete the lockscreen settings database, which will make it revert to the default setting (slide to unlock).

This does mean that if you have adb enabled by default on your phone, the lockscreen is defeated very easily. So don’t depend on it with your life.