All most all of the android v4.0 and higher tablets are USB host enabled and comes with kernel modules of ps3/xbox joystick etc but i had a cheap chinese made USB joystick (DragonRise gamepad) which i wanted to connect and play games with on my momo9 tablet with CM10 and there was no kernel module available for my requirement so here is my story how i compiled kernel module.
Prerequisites
- Requires a root access.
- Joystick and micro USB OTG cable.
- Android Terminal emulator and busybox.
Then i started searching for the kernel module of my joystick and found many versions of generic joydev.ko but none of them were compatible for my device. When i used dmesg command to determine the cause for one of such module i found that the mismatch of vermagic which means that an android (linux) kernel module can be loaded only if it is compiled for the same linux version and if it is compiled for the CPU. Using uname -a command i found the linux kernel version and CPU which powers my android.
Once the kernel version is determined i again google for kernel module of my joystick which are build for my kernel and CPU but i was not able to find joystick kernel module for my momo9c with CM10 so i downloaded allwinner kernel source from https://github.com/christiantroy/linux-allwinner and the Sourcery CodeBench Lite edition from http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ and then compiled the kernel module. I compiled the kernel module on Backtrack5 virtual machine using following commands
make ARCH=arm sun4i_crane_defconfig
make menuconfig ARCH=arm
make modules ARCH=arm CROSS_COMPILE=/sourcery-arm-toolchain/bin/arm-none-eabi
Then i moved the compiled module hid-dr.ko to the tablet to /system/modules/lib and loaded the module using insmod command and verified the new input joystick device using ls -l /dev/js? command. At last i downloaded a generic USB joystick android keylayout file for the joystick and moved it into the /system/usr/keylayout directoy.
Then i configured input devices and key mappings in nesoid emulator and started playing my favorite game on tablet with joystick. Though i have not tested but i am sure that if two joysticks are connected using USB OTG cable and USB Hub then multi-player games can also be played.
My compiled hid-dr.ko kernel module for Linux 3.0.6.36+ and the keylayout file can be downloaded from
https://dl.dropboxusercontent.com/u/48560079/joystick_hid_dr.zip contains hid-dr.ko and Vendor_0079_Product_0006.kl files.
Happy gaming!!! and enjoy :)
No comments:
Post a Comment