Tag - android

Entries feed - Comments feed

Monday, November 12 2012

Rooting Sanei N10 Deluxe on linux command line

The Sanei N10 Deluxe tablet is _potentially_ a good tablet. Unfortunately the original firmware is absolutely useless. To get rid of it the device has to be rooted and re-flashed with something more SANE(I) ;-)

Requirements:

1. the device itself - Sanei N10 Deluxe

2. usb cable

3. linux box with installed Android SDK

4. internet connection - for downloading AndroidRoot

The procedure below is based on bat file from AndroidRoot:

1. Download and unzip AndroidRoot

It contains some windows executables, a .bat file and 2 files that are important for linux users: "su" and "superuser.apk"

Copy those 2 files to your home directory (or any other, I assume they are in the home dir)

3. Switch on "USB Debugging" on the tablet. It's in Settings -> Developer Options

4. Connect the device and make sure it's detected by the system:

przemo@localhost:$lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 8087:07da Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 010: ID 18d1:0003 Google Inc.

The last line show that the tablet is connected.

5. Make sure you have rights to access the device (adb command is part of Android SDK):

przemo@localhost:$~/android-sdk-linux/platform-tools/adb devices
List of devices attached
20080411    device

If there is no device check here

6. Go to Android SDK directory -> platform-tools. On my linux box it's:

cd ~/android-sdk-linux/platform-tools/

7. Now time to start rooting

./adb shell mv /data/local/tmp /data/local/tmp.bak
./adb shell ln -s /data /data/local/tmp
./adb reboot

8. Wait for the tablet to complete reboot and type:

./adb shell rm /data/local.prop > nul
./adb shell "echo \"ro.kernel.qemu=1\" > /data/local.prop"
./adb reboot

9. Again, wait for the tablet to complete reboot and confirm that we have root access:

./adb shell id

The result should be:

uid=0(root) gid=0(root)

10. Now we can install "su" (make sure correct location of "su" is used - that's the file from AndroidRoot):

./adb remount
./adb push ~/su /system/xbin/su
./adb shell chown 0.0 /system/xbin/su
./adb shell chmod 06755 /system/xbin/su

11. Revert the changes that gave us root access:

./adb shell rm /data/local.prop
./adb shell rm /data/local/tmp
./adb shell mv /data/local/tmp.bak /data/local/tmp

12. Install superuser.apk (same comment about location of apk file as for point 10)

./adb push ~/superuser.apk /system/app/superuser.apk

13. Reboot and enjoy rooted tablet:

./adb reboot

That's it - now the Sanei N10 Deluxe is ROOTED.

Monday, September 10 2012

3 steps to have live tracking in JOSM

What you have to have: - JOSM + LiveGPS plugin - android SDK - TetherGPS on you android phone.

1: Start TetherGPS and connect the phone using USB cable (turn on "Debugging" - it's in settings) 2: Type: adb tcp:2947 tcp:2947 - this forwards port 2947 from your phone to your computer. "adb" is part of Android SDK 3: Open JOSM (with LiveGPS pugin) and Click in the main menu LiveGPS->Autocenter

That's all. As soon as you mobile phone gets GPS fix JOSM will start updating your location on the map! You can save the track and help improving OpenStreetMap

That's how it looks: JOSM live tracking

Monday, August 6 2012

How to use an android phone as a GPS receiver with GPS-less tablet using only GPL software....

... or how to use GPS-less tablet as big screen GPS car navigation. The setup that I tested:

- tablet Sanei N10 Deluxe with Android 4.0.3

- Samsung Galaxy S2 with CyanogenMod9

The tablet has no GPS receiver, so my favourite navigation/tracking OSMAnd cannot be used directly. To solve that problem I downloaded BlueGPS for the tablet and BlueNMEA for the phone. BlueNMEA works as GPS data server, the location is transmitter over bluetooth to BlueGPS on the tablet. BlueGPS uses "mock location" function to provire real GPS location for all the software runnng on the tablet.

How to set it up?

1. Allow use "mock locations" in

Settings -> Developer Options -> Allow mock locations on the tablet.

2. Pair tablet and phone using normal bluetooth functions in

Settings -> Bluetooth

3. Start BlueGPS on tablet

4. Start BlueNMEA on the phone

BlueNMEA before connection 5. Wait for the tablet to appear on devices list

BlueNMEA connected

6. As soon as the phone GPS get fix the info is passed to the tablet, so it can be used by i.e. OSMAnd or any other navigation software.

Wednesday, February 9 2011

Hello World, my first android application in 3 steps (CLI only)

The official android webpage suggests that Eclipse is the best tool for devloping. I tried really hard to set it up, but after 2 days, 6 IRC channels and many differen config switches tested I gave up. PermGen out of memory error finally won with my patience. Looks like my problems were caused by java virtual machine I tried to use, but it makes no difference at all - Eclipse was unusable. I decided to got the CLI way and I'm not dissapointed.

A few words of explanation: I'll show how to create a simple "Hello World" app using just one console (or terminal window), but it's much more convinient to use 2 or 3 of them to avoid changing directory all the time.

Three steps to my first application

1. Go to "tools" directory in android-sdk:
przemo@pldmachine ~$ cd ~/android/sdk/tools/
and type (in one line):

./android create project
--target android-8
--name Test
--path /home/users/przemo/workspace/Test
--activity TestActivity
--package com.android.test

przemo@pldmachine$ ./android create project --target android-8 --name Test --path /home/users/przemo/workspace/Test --activity TestActivity --package com.android.test
Created project directory: /home/users/przemo/workspace/Test
Created directory /home/users/przemo/workspace/Test/src/com/android/test
Added file /home/users/przemo/workspace/Test/src/com/android/test/TestActivity.java
Created directory /home/users/przemo/workspace/Test/res
Created directory /home/users/przemo/workspace/Test/bin
Created directory /home/users/przemo/workspace/Test/libs
Created directory /home/users/przemo/workspace/Test/res/values
Added file /home/users/przemo/workspace/Test/res/values/strings.xml
Created directory /home/users/przemo/workspace/Test/res/layout
Added file /home/users/przemo/workspace/Test/res/layout/main.xml
Created directory /home/users/przemo/workspace/Test/res/drawable-hdpi
Created directory /home/users/przemo/workspace/Test/res/drawable-mdpi
Created directory /home/users/przemo/workspace/Test/res/drawable-ldpi
Added file /home/users/przemo/workspace/Test/AndroidManifest.xml
Added file /home/users/przemo/workspace/Test/build.xml
Added file /home/users/przemo/workspace/Test/proguard.cfg

As you can see "android" did all the boring job of creating app skeleton for us.

2. Go to the application directory and compile it.

przemo@pldmachine$ cd ~/workspace/Test/
przemo@pldmachine$ ant debug

[removed compile output]
.. debug:
        echo Running zip align on final apk...
        echo Debug Package: /home/users/przemo/workspace/Test/bin/Test-debug.apk
BUILD SUCCESSFUL
Total time: 4 seconds
przemo@pldmachine ~/workspace/Test$

Those are only last few lines of a succesful build. Now we're ready to install the app

3. Go to "platform-tools" and upload the app to phone:

przemo@pldmachine$ cd ~/android/sdk/platform-tools/
przemo@pldmachine$ ./adb -d install /home/users/przemo/workspace/Test/bin/Test-debug.apk
*daemon not running. starting it now on port 5037 *
*daemon started successfully *
233 KB/s (13223 bytes in 0.055s) pkg: /data/local/tmp/Test-debug.apk Success
przemo@pldmachine$

Now you should see a new application named TestActivity in your phone. It doesn't do anything usefull, but that's my first android app!

Thursday, February 3 2011

LG Optimus One P500 - first steps of an android developer

I got my LG P500 roughtly 30 hours ago, so it's high time to share the first impressions. If you're looking for a review if the phone is good, responsive, have a good display and so on - yes, the phone is quite good and I like it. I bought P500 to get some hands-on experience with android, so the most important thing for me was to get access from android sdk. It's really easy if you're a linux user. If you're still using windows - I'm sorry that's a linux fanboy blog. Switch and come back later....

Now let's move to some more interesting stuff.

First, you have to switch on USB debugging on P500. It's in Settings/Applications/Development. Next connect USB cable. Do not select option to connect as an USB storage. Open a terminal and type "lsusb" to check if your linuxbox sees the phone:

przemo@pldmachine ~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 003 Device 002: ID 03f0:011d Hewlett-Packard Integrated Bluetooth Module
Bus 001 Device 015: ID 1004:618e LG Electronics, Inc.

OK, we've got it! Now go to your android sdk directory (how to install android-sdk) and type:

przemo@pldmachine ~/android/sdk$ platform-tools/adb devices

The result will look probably like this:

przemo@pldmachine ~/android/sdk$ platform-tools/adb devices
List of devices attached
???????????? no permissions

Which means that the LG P500 is connected but you don't have enough access rights. To fix it we have to define a new rule for udev. You have to be root or use sudo to do it. The file should be located in /etc/udev/rules.d/51-android.rules and it should contain just one line:

SUBSYSTEM=="usb", [SYSFS]ATTR{idVendor}=="1004", MODE="0666"

It used to be SYSFS, but now it's ATTR. It defines that udev should give you full access rights when a LG device (idVendor="1004") is connected - 1004 is the same number that is bolded in the results of lsusb command. The last touch, changing access rights to the rules file:

chmod a+r /etc/udev/rules.d/51-android.rules

Now reconnect your phone to get full access rights:

przemo@pldmachine ~/android/sdk$ platform-tools/adb devices
List of devices attached
80A354043043410507 device

We can test if it really works, let's try to open remote shell on our shiny P500:
przemo@pldmachine ~/android/sdk$ platform-tools/adb shell

$ ls -l
dr-x------ root    root             2011-02-02 13:03 config
drwxrwx--- system  cache            2011-02-03 18:23 cache
lrwxrwxrwx root    root             2011-02-02 13:03 sdcard -> /mnt/sdcard
drwxr-xr-x root    root             2011-02-02 13:03 acct
drwxrwxr-x root    system           2011-02-02 13:03 mnt
lrwxrwxrwx root    root             2011-02-02 13:03 d -> /sys/kernel/debug
lrwxrwxrwx root    root             2011-02-02 13:03 etc -> /system/etc
drwxrwx--- lgdrm   lgdrm_acc        1980-01-06 00:19 lgdrm
drwxrwx--x system  system           2011-02-02 13:03 persist
drwxr-xr-x root    root             2010-10-01 22:48 system
drwxr-xr-x root    root             1970-01-01 01:00 sys
drwxr-x--- root    root             1970-01-01 01:00 sbin
dr-xr-xr-x root    root             1970-01-01 01:00 proc
-rwxr-x--- root    root       16316 1970-01-01 01:00 initlogo.rle
-rwxr-x--- root    root        9323 1970-01-01 01:00 init.thunderg.rc
-rwxr-x--- root    root       18323 1970-01-01 01:00 init.rc
-rwxr-x--- root    root        4869 1970-01-01 01:00 init.qcom.rc
-rwxr-x--- root    root        3352 1970-01-01 01:00 init.qcom.post_boot.sh
-rwxr-x--- root    root         122 1970-01-01 01:00 init.lge.hidden_reset.sh
-rwxr-x--- root    root      357656 1970-01-01 01:00 initv
-rw-r--r-- root    root        1152 1970-01-01 01:00 fota.rc
-rw-r--r-- root    root         118 1970-01-01 01:00 default.prop
drwxrwx--x system  system           1980-01-06 00:19 data
drwxr-xr-x root    root             1970-01-01 01:00 chargerimages
drwxr-xr-x root    root             1970-01-01 01:00 bootimages
drwx------ root    root             2010-10-01 22:03 root
drwxr-xr-x root    root             2011-02-03 22:35 dev

Hey, it looks almost like a normal linux box root directory! I like it.... :-)