Author Topic: Cubietruck - gamepad won't work <<== SOLVED!  (Read 36258 times)

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Cubietruck - gamepad won't work <<== SOLVED!
« on: March 09, 2014, 08:02:24 pm »
Hi,

I would like to know if there is a gamepad/joypad/game controller that really works on CT with Android...
I have a common USB dualshock gamepad, also tried a Sixaxis PS3, installed USB/BT Joystick Center, and no luck...
Tested on all nand 1.01 versions of http://dl.cubieboard.org/software/a20-cubietruck/android...
I read that with Gamepad IME and joydev.ko file may work, but dont know where to get a compatible one...
So, is there anyone that could help on this?
Thank you,
« Last Edit: March 23, 2014, 08:42:31 pm by actkk2000 »

Offline calhemp

  • Newbie
  • *
  • Posts: 11
  • Karma: +3/-0
    • View Profile
Re: Cubietruck - gamepad won't work :(
« Reply #1 on: March 10, 2014, 07:49:42 pm »
hi install a 'terminal ide' and 'busybox', and check your 'dmesg'  after/before when you plug your game pad and check what driver is load or not. if not this is the problem..

try tu put your usb joystick in a linux machine and check what drivers are load. my joystik is a pantherlord (chinesse dual ps2 clone)

in other device like cubieboard (mele a2000) months ago I 'll have to compile the driver and load with insmod for play two players retro games like snes and neogeo in android ;).
(I think that you will have to create also a new joystick keyboard layout. generic.kl  for android (find ind google is easy,  but with your id gamepad)


when the driver is load with joytick center you can map buttons because not all games can play jostick and mapping joystick to keyboard keys is the clue.

try ;)

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work :(
« Reply #2 on: March 11, 2014, 04:49:27 pm »
Thank you calhemp.
But I am not sure to be capable to do all this stuff... could you be more specific on "compile the driver and load with insmod", do you mean joydev.ko or something else?
And in that case do I have to compile the entire Android system from the SDK?...
Don't know where to start looking to modify Android...  :o



Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work :(
« Reply #3 on: March 23, 2014, 08:23:25 pm »
After struggling myself to get a driver for my usb gamepad, I finally managed to compile one.
I am using this image on my CT with kernel 3.4.39 for resolution 1080p:

Quote
Quote from: @lex on March 14, 2014, 06:26:36 PM

Here is a CT image with HDMI 1080p (1920x1080):
https://drive.google.com/file/d/0B7A7OPBC-aN7c1liYW9Ld1RUMVU/edit?usp=sharing

I compiled the driver module with this source code:

Quote
Quote from: @lex on March 20, 2014, 08:25:11 AM
try this:
http://dl.cubieboard.org/software/a20-cubieboard/android/android-SDK.zip

This driver is for "Dragon Rise USB gamepad" [ Generic Chinese Vendor_0079_Product_0006 ( VID:PID 0079:0006 ) or DragonRise Inc. PC TWIN SHOCK Gamepad, named hid-dr.ko, kernel version 3.4.39

Looks like this:

Download driver from here or from attachment:

http://www.firedrive.com/file/106461AEAA4F96B1

Copy hid-dr.ko to "/system/vendor/modules" and load it with "insmod hid-dr.ko" from terminal.

Included is keyboard layout file (copy to "/system/usr/keylayout", not needed in my case) and a script to load the module at start (use a script manager)

Works great on FPse for PSX gaming!

Thanks @lex and calhemp for your help!  ;D


« Last Edit: April 01, 2014, 08:59:53 pm by actkk2000 »

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #4 on: March 31, 2014, 07:22:48 pm »
For what is worth, the steps I followed for driver compilation, a little more explained:
(Requirement: to know exactly what is the driver module needed)
(Done on Windows 8.1 PC, AMD Phenom II X4 processor, 8 GB RAM)

1- Install VMWare Workstation:
https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation/10_0

2- Download VMWare image of Ubuntu Linux machine:
http://www.traffictool.net/vmware/ubuntu1204.html

3- Mount Ubuntu image on VMWare (set memory 1024 MB), login, open terminal, change to root (su -) and run:
apt-get update & upgrade

4- Follow these instructions to install software:
http://docs.cubieboard.org/tutorials/cb1/installation/compiling_android_ics_a10_on_ubuntu_12.04
(could not install libraries 32 bit though :(, not sure if really necessary...)

5- Download, transfer (map a network drive) and decompress SDK file inside Ubuntu:
http://dl.cubieboard.org/software/a20-cubieboard/android/android-SDK.zip

6- Go to "android-SDK/lichee/linux-3.4" dir, edit file ".config" with nano and find driver to enable. In this case:
CONFIG_HID_DRAGONRISE=n

7- Change the line to CONFIG_HID_DRAGONRISE=m
Copy ".config" file as "linux-3.3/arch/arm/configs/cubietruck_defconfig" (replace)

8- Follow these instructions, but starting from "Build Linux kernel" line:
http://docs.cubieboard.org/tutorials/ct1/installation/cb3_a20-compiling_android_image_for_cubietruck
and stop after "Success Building" (do not continue on "Build Android image")
(In this case OS dir name is Linux-3.4, not 3.3)

9- During the compiling process, when asked to compile driver module answer Y

10- After finishing, go to "android-SDK/lichee/linux-3.4/output/lib/modules/3.4/" dir
and find driver module (in this case hid-dr.ko), copy it to host PC.

11- Download this CT image (kernel 3.4.39, same as SDK):
https://drive.google.com/file/d/0B7A7OPBC-aN7c1liYW9Ld1RUMVU/edit?usp=sharing

12: Follow these instructions to install image on CT with PhoenixSuit:
http://docs.cubieboard.org/tutorials/common/livesuit_installation_guide
http://docs.cubieboard.org/tutorials/ct1/installation/cb3_a20-install_nand_boot_android_for_cubietruck

13- Install in CT "SuperSu","Android Terminal Emulator", "Busybox", "Root Browser" from market.

14- Use usb cable to copy driver to CT, move it with "Root Browser" to "/system/vendor/modules" and load it with "insmod hid-dr.ko" from terminal (change to root with su -).

15- Create a "script.sh" file and install "SManager" from market to configure to load module on startup.

Enjoy!

« Last Edit: April 01, 2014, 08:07:02 pm by actkk2000 »

Bloodyludi

  • Guest
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #5 on: April 05, 2014, 01:07:57 pm »
hi, i'm currently trying to get my xbox 360 controller working on CT.
In order to achieve this, i need to compile the xpad.ko driver located in "\drivers\input\joystick".
I have the same Android image (kernel-3.4.39) running on my CT as you.
I am a total noob at linux and also don't have a vm running it.
So, you can you do me a huge favor and compile it for me? (If it doesn't take you too much time and effort) :)

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #6 on: April 05, 2014, 02:51:26 pm »
Perhaps, if you can find out exactly which line(s) of the .config file should I enable for the xpad driver.
Unfortunately I don't have such gamepad to test it, although I borrowed a wireless one once, prior to heard about the driver compiling procedure, and of course it didn't work either...  ???
Is your gamepad wireless or can be usb plugged?


Bloodyludi

  • Guest
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #7 on: April 06, 2014, 11:24:33 am »
I have the wireless version.
The gamepad requires a Receiver which is plugged in via USB.
According to this manual it should work with android: http://www.se7ensins.com/forums/threads/how-to-use-xbox-controllers-on-your-android-device.882265/

I couldn't find a specific entry for the xpad.ko in .config.
But I think the flag that should be enabled is CONFIG_INPUT_JOYSTICK. This might let you access more specific entries.
In the Kconfig inside of "\drivers\input\joystick" I found the line which should enable the driver. It's called "config JOYSTICK_XPAD".

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #8 on: April 06, 2014, 10:46:01 pm »
Well I had to do a couple more rounds since it didnt work at first  :-\

It seems that according to Kconfig file notes for xpad driver, it's also needed to enable in .config:
CONFIG_INPUT_JOYSTICK=m
CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y

And since it failed at first, it was also needed to re-enable the new imported lines in .config from Kconfig:
CONFIG_JOYSTICK_XPAD=m
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y

Finally after the process finished for the 3rd time, it came out the xpad.ko driver  ;D

You can download it from here or from the attachment:
http://www.firedrive.com/file/FD75B229EBCC7B56

You may also will need to install the layout file following the instructions from the link you provided.
Remember this is only for kernel versi├│n 3.4.39.
And don't forget to let me know if this driver worked after all.

Good luck!

« Last Edit: April 06, 2014, 11:05:51 pm by actkk2000 »

Bloodyludi

  • Guest
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #9 on: April 09, 2014, 10:35:20 am »
THANK YOU!
Finally it works.
I am now able to use one Xbox 360 controller. Another one will map to the same keys.
The D-PAD wasn't recognized at first. I slightly changed the .kl file, so it now recognizes it as the same keys as the left stick.
I attached the .kl in case s/o needs it.
The right and left trigger isn't working yet.

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #10 on: April 09, 2014, 11:41:55 am »
Good news!!
Seems that is really possible to make working drivers for CT after all! ;D

virtualaddict

  • Guest
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #11 on: May 11, 2014, 01:26:11 am »
Thank you guys SO MUCH for this post. I spent hours trying to figure out what USB controller I had and what the correct key layout was.

For anyone else who bought Etekcity controllers off Amazon (2 for $15 is nice deal - amazon link ) it turns out these controllers are technically DragonRise USB controllers and their vendor ID and product ID are 0079 and 0006.

This file: Vendor_0079_Product_0006.kl was what I needed to get my DragonRise USB controllers working properly, and it was the only file I needed to put in system/usr/keylayout/ to get everything working. Didn't need to mess around with anything in system/lib/modules/. I tweaked the file slightly for "DragonRise USB" controllers, since it was a little off at first, there's a comment that says it was actually for "Speedlink Strike gamepad", which have the same VID and PID. Weird. Anyway,. I can do just about everything with my controller now, including the process of opening emulators and closing them, saving, etc, which was what I REALLY wanted for my MK808B android mini TV.

I'll attach the file I tweaked to this comment. Hopefully Google will pick this up for the next  frustrated soul in my shoes. :)

THANK YOU GUYS!  ;D

edit: I just want to come back to say if you want your Select button to be HOME, then change this one line in the .kl file:
key 0x128    HOME              WAKE
For some reason,  when I just made it HOME the entire mapping structure was ruined and my controller wouldn't work at all. But when I add WAKE part, it works!  8)
« Last Edit: May 14, 2014, 01:28:02 am by virtualaddict »

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #12 on: May 11, 2014, 05:35:47 pm »
Thank you very much virtualaddict!
I am very glad if this is helpful to people in some way  :D

Offline calhemp

  • Newbie
  • *
  • Posts: 11
  • Karma: +3/-0
    • View Profile
Re: Cubietruck - gamepad won't work <<== SOLVED!
« Reply #13 on: May 12, 2014, 04:33:21 pm »
woow atckk2000, sorry I forget that I had replied this thread ... and  how help you more.

you did the same I did ;)  and now is more clear here and best explicated for future.

great work been here  ;)

Offline actkk2000

  • Hero Member
  • *****
  • Posts: 572
  • Karma: +2/-11
    • View Profile
Re: Cubietruck - gamepad won't work &lt;&lt;== SOLVED!
« Reply #14 on: May 13, 2014, 07:35:01 am »
My pleasure! Feels good to help people, although I really know too little... [emoji6]