Monday, April 8, 2013

Rooting Allview Speed City

I was looking for a budget tablet with decent hardware (except for the screen which is crappy) so I settled on the Allview Speed City. This tablet is similar to the Chinese Onda 701 with the small difference that the Speed City does not have Volume Up/Down hardware buttons. The same hardware may be marketed and sold under other names in various countries, so check the specs before attempting to root it.

The tablet is running a custom ROM based on Android 4.1.1 that includes some bloatware (like an antivirus) next to the standard apps. Fortunately, it has a recovery ROM that lets you install zip files, so, it doesn't appear to be fully locked.

So, as any power user, I wanted to root the tablet and be the master of the software installed. Problem is - there was no known root available when I bought it.

Note: before proceeding make sure you understand the risks of rooting, and also be advised that you may lose your warranty.

Rooting instructions for the impacient

So without much ado, to root the tablet, you will need to follow these steps:
  1. Download the root + google apps package: (if the link is no longer valid drop a comment and I will re-upload it)
  2. Unzip the archive downloaded above ( to an external SD card in the root of that card. You will get two files:  factory_update_param.aml and
  3. Plug in the SD card into the tablet (the procedure requires an external SD card; internal storage doesn't work).
  4. Turn off the tablet
  5. Turn on the tablet in recovery mode. You do this by holding the HOME button and the POWER button pressed until you will see a big green android on the screen. You can release the buttons now. (the screen looks like the following image - sorry for the quality)
  6. Once the update is complete, the tablet will reboot automatically and you will get a message "Updating system apps". Once it's finished, you are rooted (if Superuser is not installed, you can install it from the market).
  7. Profit! :)

 The emergency ROM

All Android devices have a recovery ROM that allows you to unbrick your device if tragedy strikes. For the Allview Speed City you can enter in the Recovery ROM by holding the HOME and POWER buttons pressed at startup. You will be presented with something like this:

Since unlike the Onda 701 you do not have hardware keys for Volume Up/Down, you'll need to use the HOME button as DOWN ARROW and the POWER button as ENTER.

Other than that, the Recovery ROM is pretty functional.

Extra resources: Visit this link to learn more about rooting this tablet and alternate firmwares for it:
Also, special thanks to the members of the XDA community who made this possible.

Monday, January 14, 2013

Android: Disabling Battery full alert

I keep hearing in my dreams a sort of "ding" sound made by my phone (running Android 4.1). It's trying to tell me to disconnect the charger from the wall socket (to be greener), but unfortunately it's doing this in the middle of the night, and it's annoying. There is no risk to damage your phone if you keep it plugged in beyond this point anyway.

Well, there seem to be apps that let you manage the notification sound (like Battery full notification), but they seem overkill for what I want.

Luckly, I found this thread in my searches:

If you have a rooted phone, you can follow the instructions in the thread, or follow these steps in a terminal emulator on your phone:

cd /system/media/audio/ui
mount -o remount,rw /system
mv TW_Battery_caution.ogg TW_Battery_caution.ogg.bak
mount -o remount,ro /system
 It renames the notification sound, so that next time your phone wants to wake you up to unplug the charger, it will have no voice :P

Wednesday, January 9, 2013

Android: Adding scp/sftp support to dropbear and mounting with sshfs

I have recently received an android smartphone, and one of the first things I did with it was to root it :). This allows power-usres to get the most out of their hardware.

The next thing on my list was to set up a SSH server and to be able to transfer files between my Linux system and my phone (by the way, I'm running Android 4.1 and it seems USB mass storage support has been removed. MTP/PTP modes have either horrible transfer speed or are poorly supported in Ubuntu).

With the above in mind, the plan was to:
  • Enable tethering on the phone
  • Run a SSH server to support issuing remote commands and file transfer (FTP might have been an alternative, but I'm a SSH adept).
Browsing the market I found SSHDroid which does all that it advertised. Problem is - the free version conflicts with my add-blocking apps and requests that they are disabled to run.

For me, this is a big nuisance, so I kept looking. I found Dropbear SSH Server 2, which is completely free, but doesn't support scp/sftp.

So, I wanted scp/sftp support, so I started to work on a solution.

If, after starting Dropbear server you try to transfer a file via scp you get this error (pris is the name of my phone and is mapped to an IP address via the /etc/hosts file):
adrianp@frost:~$ scp test.log root@pris:/storage/sdcard0/
Welcome to DropBear SSH Server II!
root@pris's password:
sh: scp: not found
lost connection
then, you are in the same situation I was...

For scp/sftp to work, the process needs to have access to the scp/sftp-server binaries on your android system. But it seems dropbear doesn't come with those binaries. But searching around the system, the binaries are available in the SSHDroid package.

So, I was doing the following steps to make those binaries available to the whole system (needs a rooted system with busybox installed):

root@android:/data/local # scp
sh: scp: not found
127|root@android:/data/local # find / -name scp 2>/dev/null

1|root@android:/data/local # /data/data/
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

1|root@android:/data/local # ls -l /system/xbin/                              
-rwxr-xr-x root     shell       59760 2012-09-28 12:15 dexdump
-rwsr-sr-x root     root        91992 2012-12-21 10:02 su
root@android:/data/local # echo $PATH                                         
root@android:/data/local # mount -o remount,rw /system
root@android:/data/local # ln -s /data/data/ /system/xbin/scp

root@android:/data/local # ln -s /data/data/ /system/xbin/ssh
root@android:/data/local # ln -s /data/data/ /system/xbin/sftp-server
root@android:/data/local # mount -o remount,ro /system
At this point, you can use scp to transfer files from your computer to your Android device. However, you can't mount it with sshfs yet.

The problem when mounting it is that sshfs tries to use the sftp server, and by default it tries to call it from /usr/libexec/sftp-server. This path does not exist on your android device, and you will need to instruct sftp to use /system/xbin/sftp-server instead. You can do this with the following command:

sudo sshfs -o sftp_server=/system/xbin/sftp-server  root@pris:/storage /media/pris
Of course, in order to mount the device as a regular user and to be able to transfer files, you will need to prepare your mount point and your fstab entry:

adrianp@frost:~/temp$ sudo mkdir -p /media/pris
adrianp@frost:~/temp$ sudo chown root:fuse /media/pris
adrianp@frost:~/temp$ sudo chmod g+w /media/pris
adrianp@frost:~/temp$ cat /etc/fstab | grep pris
sshfs#root@pris:/storage /media/pris fuse user,fsname=sshfs#root@pris:/storage,noauto,sftp_server=/system/xbin/sftp-server 0 0
You will now be able to mount the device via the command line (or in Nautilus). It will ask for your ssh password, and then it will display the files as if they were local. In terms of performance, I get about 4.6MB/s reads and 4.1MB/s write speed (over USB).  Compared to ~240kB/s read/write in MTP mode, I would say I get quite a performance boost!

Remember, in order to follow the steps above you will need:
  • a rooted android device
  • busybox installed
  • SSHDroid installed (it will remain installed even if you don't start the ssh service. You can possibly uninstall it if you replace the "ln -s" commands with "cp" instead)
  • Dropbear II (and started)
  • either a wifi connection between your PC and android device, or USB tethering (it's what I'm using)