Thursday, September 6, 2012

XBMC as launcher

Now that XBMC is useful as a media player for my MELE (see HW acceleration thread), I also use it as a launcher.

Basic instructions

Download the APK from here.
And if you want to use an external player, check the previous post.

Advanced instructions

Important: There's already a modified manifset file uploaded here

To make xbmc work as launcher and make it persistent (this means it doesn't close when you watch a movie,and it doesn't need to load everything again when you finish a movie) you have to modify the file: "$XBMC_FOLDER/tools/android/packaging/xbmc/bin/AndroidManifest.xml".

Inside the file you can find the "intent-filter" node, we need to add an Intent for the home action.
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.HOME" />

If you want to xbmc appear in the default launcher as an application, don't replace the line:
<category android:name="android.intent.category.LAUNCHER" />

If you replace LAUNCHER with DEFAULT the application won't be listed anywhere but in the "All" section of the Android application manager.

To make it persistent:
(WARNING this will make XBMC constantly consume resources, so if you have low memory everything will be slower, this doesn't seem to be the case with MELE, but if you are using emulators or other applications with high memory usage this may impact on the performance).

You need to modify the "Application" Node:
"<application android:icon="@drawable/ic_launcher" android:debuggable="true" android:label="@string/app_name" android:hasCode="true">"

add the option:

When this file was modified, the following file got modified also 
I believe you should also modify this file with the desired options.

After modifying the xml, you have to build the apk, and install it normally.

XBMC with external player [temporary solution for lack of HW acceleration]

You may know the XBMC project ("XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media."), it's awesome, open source and works very well.

But, for now, in android the hardware acceleration is not working.

inRivalz came up with a workaround to use an external player, which has working hardware acceleration, instead of the internal player.

This means using a closed-source alternative, for now.

Basic instructions

Download this apk.

Install it on your device, and modify the playercorefactory.xml (which, according to XBMC Wiki is in Android/data/org.xbmc.xbmc/files/.xbmc/userdata/)

<player name="MPC-HC" type="ExternalPlayer" audio="false" video="true">
<rules action="prepend">
<rule video="true" player="MPC-HC"/>

Replace the bold part with either for the corresponding version of the MXPlayer you have installed. - Pro Edition. - Free Edition.

Advanced instructions:

Download the source from XBMC Git: Instructions
Apply this patch Link, but replace "StartActivityWithExtra" with this
// External Player
bool CXBMCApp::StartActivityWithExtra(const string &package,const string &path)
if (!m_activity || !package.size())
return false;
jthrowable exc;
JNIEnv *env = NULL;
jobject oActivity = m_activity->clazz;
jclass cActivity = env->GetObjectClass(oActivity);

// Intent oIntent = new Intent(Intent.ACTION_VIEW);
jclass cIntent = env->FindClass("android/content/Intent");
jmethodID midIntentCtor = env->GetMethodID(cIntent, "<init>", "(Ljava/lang/String;)V");
jstring sIntentView = env->NewStringUTF("android.intent.action.VIEW"); // Intent.ACTION_VIEW
jobject oIntent = env->NewObject(cIntent, midIntentCtor, sIntentView);
// Uri oUri = Uri.parse(sPath);
jclass cUri = env->FindClass("android/net/Uri");
jmethodID midUriParse = env->GetStaticMethodID(cUri, "parse", "(Ljava/lang/String;)Landroid/net/Uri;");
jstring sPath = env->NewStringUTF(path.c_str());
jobject oUri = env->CallStaticObjectMethod(cUri, midUriParse, sPath);
// oIntent.setDataAndType(oUri, "video/*");
jmethodID midIntentSetDataAndType = env->GetMethodID(cIntent, "setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;");
jstring sMimeType = NULL;
sMimeType = env->NewStringUTF("video/*");
oIntent = env->CallObjectMethod(oIntent, midIntentSetDataAndType, oUri, sMimeType);
// oIntent.setPackage(sPackage);
jstring sPackage = env->NewStringUTF(package.c_str());
jmethodID mSetPackage = env->GetMethodID(cIntent, "setPackage", "(Ljava/lang/String;)Landroid/content/Intent;");
oIntent = env->CallObjectMethod(oIntent, mSetPackage, sPackage);

// startActivity(oIntent);
jmethodID mStartActivity = env->GetMethodID(cActivity, "startActivity", "(Landroid/content/Intent;)V");
env->CallVoidMethod(oActivity, mStartActivity, oIntent);
exc = env->ExceptionOccurred();
if (exc)
CLog::Log(LOGERROR, "CXBMCApp::StartActivity Failed to load %s. Exception follows:", package.c_str());
return false;
return true;
// End External Player
The issue with the original code was the method "getLaunchIntentForPackage". This finds the first intent action for the package. The MX Player has both, MAIN and VIEW, but "getLaunchIntentForPackage" only finds the MAIN intent, and for this reason it doesn't work.

Build the source and install it on your device, and modify the playercorefactory.xml (which, according to XBMC Wiki is in Android/data/org.xbmc.xbmc/files/.xbmc/userdata/)

<player name="MPC-HC" type="ExternalPlayer" audio="false" video="true">
<rules action="prepend">
<rule video="true" player="MPC-HC"/>

Replace the bold part with either for the corresponding version of the MXPlayer you have installed. - Pro Edition. - Free Edition.

Wednesday, August 22, 2012

Random MELE Tweaks

Set FileSystem writable
mount -o rw,remount /system

Set FileSystem readable-only
mount -o r,remount /system

Remove infrared capabilities
rmmod sun4i_ir

Power off blue led
echo '0' > /sys/devices/platform/gpio_sw.1/gpio_sw/PH20/data

Power On blue led
echo '1' > /sys/devices/platform/gpio_sw.1/gpio_sw/PH20/data

Power On red led
echo '1' > /sys/devices/platform/gpio_sw.0/gpio_sw/PH10/data

Power off red led
echo '0' > /sys/devices/platform/gpio_sw.0/gpio_sw/PH10/data

This has to be done every time you reboot.

Disable most System apps
  1. Place sh on MELE [link].
  2. navigate to folder.
  3. sh
  4. follow instructions
Enable adb via TCP:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
ifconfig eth0

Download SuperCharger V6 Script

Tuesday, August 21, 2012

ICS [Stock] and CM9/AOKP ICS for MELE A1000


  1. Official MELE files:
    1. Official 4.0 V1
    2. Official 4.0 V1.1
    3. Phoenix card software for Windows 7
    4. Phoenix card software for Windows XP
  2. CM9/AOKP files
    1. Recovery file
    2. Mele 1.0.8 Legacy file
    3. Gapps signed
    4. AOKP
    5. CM9
    6. ADB Recovery files

Installation process for MELE Files:
  1. Flash the desired image with the corresponding PhoenixCard version to an SD card.
  2. Turn off MELE
  3. Place SD inside of MELE
  4. Turn on MELE
  5. Wait for it to stop flashing red and blue lights
  6. Remove SD card
  7. Turn on MELE
The problem is that the xpad module is not supported with the original ICS files, which means no Xbox controller but CM9 and AOKP support xpad.

In order to flash CM9 or AOKP:
  1. Turn on MELE
  2. Connect to Ethernet.
  3. In the ADB Recovery files
    1. Run HDMI or VGA scripts according to your setup(CWM will use this output).
    2. Edit the script.fex MAC address for yours.
    3. Run edit bootload.bat
  4. Copy the following files to the SD
    1. Recovery.img
    2. CM9 or AOKP, your choice
    3. Google apps
    4. Mele legacy file
  5. Execute install-recovery.bat <mele ip address>, this will make MELE reboot in recovery mode.
  6. During recovery mode
    1. Wipe cache
    2. Wipe data
    3. Flash CM9/AOKP
    4. Flash Google Apps
    5. Flash Legacy File
    6. Go to advanced -> Fix permissions
    7. Reboot.
If something goes wrong during the flash process, MELE won't give video at all or it will get stuck in a bootloop. Just flash original 4.0 image and proceed to flash CM9/AOKP again.

CM9/AOKP won't work if you flash 4.0 V1.1, you have to be on 4.0 V1.0
The boot image comes pre-rooted.

Based on Naismith's (Slatedroid) tutorial

Friday, August 17, 2012

XBOX 360 controller support in 3.0.8 kernel

The XBOX 360 controller doesn't work in my MELE (Kernel 3.0.8) because the kernel modules needed to support it [ ff-memless, xpad ] , are disabled by default in our kernel.

Download the ARM kernel
git clone git://
Install the necessary libraries / binaries
apt-get install gcc-4.4-arm-linux-gnueabi build-essential u-boot-tools (if u-boot-tools not found, try uboot-mkimage)

# make clean
# make -j4 ARCH=arm CROSS_COMPILE=/root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi- xconfig

Check(Press 'M') the following modules:
Input device support -> Support for memoryless force-feedback device
Input device support -> Joystick / gamepad
Input device support -> Joystick / gamepad -> X-box gamepad

Compile the modules
# make -j4 ARCH=arm CROSS_COMPILE=/root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-

If you get "arm-linux-gnueabi-gcc" not found, run:
sudo ln -s /usr/bin/arm-linux-gnueabi-gcc-*version* /usr/bin/arm-linux-gnueabi-gcc

That should give you the xpad.ko in the drivers/input/joystick file.

Move it to the MELE, then run

insmod xpad.ko

Alternatively, if you don't want to compile the kernel use this module.
xpad.ko module
download it, copy it to the MELE and then run

insmod xpad.ko