Announcement

Collapse
No announcement yet.

Make any controller compatible with Android Tv

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make any controller compatible with Android Tv

    Hello guys sorry for my bad English , so to make a driver for any controller you will need your device to be rooted you will need Es file explorer , Key Test app ( https://github.com/downloads/chrisbo...st/KeyTest.apk) , Android Terminal

    Steps:
    -Open Es file explorer go to /system/usr/keylayout/ make a copy of Generic.kl
    -Open Terminal enter the command
    cat /proc/bus/input/devices now you will see the vendor id and product id codes rename the Generic.kl file like Vendor_[VendorID]_Product_[ProductID].kl of your gamepad vendor and product
    Ex:
    I: Bus=0003 Vendor=0c45 Product=7403 Version=0100
    N: Name="SONiX USB Device"

    P: Phys=usb-usb20_host-1.1.1/input0
    S: Sysfs=/devices/platform/usb20_host/usb2/2-1/2-1.1/2-1.1.1/2-1.1.1:1.0/input/input9
    U: Uniq=
    H: Handlers=sysrq kbd event1 keychord
    The file will be Vendor_0c45_Product_7403.kl

    -install keytest.apk open it now press ex A button you will get the scanCode ex: (scanCode=290)
    you will need to do this to all your keys write them down to a paper it is easy like this :

    BUTTON_A 290
    BUTTON_B 289
    BUTTON_X 291
    BUTTON_Y 288
    BUTTON_L1 292
    BUTTON_R1 293
    BUTTON_L2 294
    BUTTON_R2 295
    BUTTON_SELECT 296
    BUTTON_START 297


    if your gamepad does not have A B X Y and it is with number or ps style etc here is and ex photo for the keys order

    -now open the Vendor_Product.kl file you have created with es text editor or any other editor
    find every scanCode line and edit it like this :

    scanCode / Android function key

    key 290 BUTTON_A
    key 289 BUTTON_B
    key 291 BUTTON_X
    key 288 BUTTON_Y
    key 292 BUTTON_L1
    key 293 BUTTON_R1
    key 294 BUTTON_L2
    key 295 BUTTON_R2
    key 296 BUTTON_SELECT
    key 297 BUTTON_START


    -now save the file copy it to /system/usr/keylayout/ set permissions to (-rw-r–r–)
    -reboot device now you will have a compatible gamepad for the D-pad and sticks they work from default
    -Tested on Leo's Fortune , Prince of Persia Shadow & Flame ,Beach Buggy Racing, GTA III

    NOTE this is for games that support gamepads

    Last edited by cheaterel; 04-06-2015, 01:01.

  • #2
    Does this work on any android? Because I inserted the comand, and it says "not found"...

    Comment


    • #3
      Originally posted by seanberna View Post
      Does this work on any android? Because I inserted the comand, and it says "not found"...
      I think yes tried on my Phone, tablet, TV stick and it works
      Try with Jack Palevich terminal and BusyBox installed
      Type like this cat /proc/bus/input/devices

      Comment


      • #4
        Hello,

        I have a USB PS2 clone controller that works very well with USB/BT Joystick center and i can play all the GTA games just fine.

        My problem is that in my gamepad the right analogue stick the X ad Y Axis are detected Swaped. When i move the stick forward it registers as left and when i move right it registers as down. This problem can we overcomed in USB/BT Joystick center because i can map the buttons as i see fit.

        In games that have native gamepad support such as : Shadowgun, Shadowgun; DeadZone, Dead Trigger - MadFinger Games, i can move my character ok but when i try to look aroung using the right analogue stick UP is left and Right is down, so this is rather confusing.

        Is there a way to modify keymappings in the native support driver ?

        Thanks

        Comment


        • #5
          root@rk3288:/system/usr/keylayout # cp Generic.kl Generic2.kl
          cp: can't create 'Generic2.kl': Read-only file system
          1|root@rk3288:/system/usr/keylayout # touch Generic2.kl
          touch: Generic2.kl: Read-only file system


          /system/usr/keylayout/ is not writable

          I am rooted and i am trying to perform the changes via SSH

          Comment


          • #6
            My Gamepad:

            I: Bus=0003 Vendor=07b5 Product=0312 Version=0110
            N: Name="Mega World USB Game Controllers"
            P: Phys=usb-ff540000.usb-1.2/input0
            S: Sysfs=/devices/ff540000.usb/usb3/3-1/3-1.2/3-1.2:1.0/input/input100
            U: Uniq=
            H: Handlers=event3 ddr_freq
            B: PROP=0
            B: EV=1b
            B: KEY=fff 0 0 0 0 0 0 0 0 0
            B: ABS=30027
            B: MSC=10


            and my Keylayout file:


            # Copyright (C) 2011 The Android Open Source Project
            #
            # Licensed under the Apache License, Version 2.0 (the "License");
            # you may not use this file except in compliance with the License.
            # You may obtain a copy of the License at
            #
            # http://www.apache.org/licenses/LICENSE-2.0
            #
            # Unless required by applicable law or agreed to in writing, software
            # distributed under the License is distributed on an "AS IS" BASIS,
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
            # See the License for the specific language governing permissions and
            # limitations under the License.

            #
            # Mega World USB Game Controllers
            #

            key 0x188 BUTTON_A
            key 0x189 BUTTON_B
            key 0x190 BUTTON_X
            key 0x191 BUTTON_Y
            key 0x192 BUTTON_L1
            key 0x194 BUTTON_R1
            key 0x193 BUTTON_L2
            key 0x195 BUTTON_R2
            key 0x196 BUTTON_SELECT
            key 0x197 BUTTON_START
            key 0x198 BUTTON_THUMBL
            key 0x199 BUTTON_THUMBR

            axis 0x00 X
            axis 0x01 Y
            axis 0x02 RZ
            axis 0x05 Z
            axis 0x10 HAT_X
            axis 0x11 HAT_Y








            But my changes are not applied





















            Comment


            • #7
              I updated my config to :


              key 0x188 BUTTON_A
              key 0x189 BUTTON_B
              key 0x190 BUTTON_X
              key 0x191 BUTTON_Y
              key 0x192 BUTTON_L1
              key 0x194 BUTTON_R1
              key 0x193 BUTTON_L2
              key 0x195 BUTTON_R2
              key 0x196 BUTTON_SELECT
              key 0x197 BUTTON_START
              key 0x198 BUTTON_THUMBL
              key 0x199 BUTTON_THUMBR

              axis 0x00 X
              axis 0x01 Y
              axis 0x03 RZ
              axis 0x04 Z
              #axis 0x10 HAT_X
              #axis 0x11 HAT_Y


              and applied correct file attributes and the config seems to work since ONLY the right analogue stick is working obviously there is a fault in my syntax.
              Can anyone help ?

              Comment


              • #8
                Cheaterel;

                I followed every step, and did it a few times, and for some reason I can't make it work. My box (and games) recgonize it as before; that means that only the sticks are working. I really don't know why.

                And by the way, my scanCodes are identical to yours..

                Comment


                • #9
                  I managed to fix it i had to change the file attributes and my KL file is the following :




                  ​##################



                  # Copyright (C) 2011 The Android Open Source Project
                  #
                  # Licensed under the Apache License, Version 2.0 (the "License");
                  # you may not use this file except in compliance with the License.
                  # You may obtain a copy of the License at
                  #
                  # http://www.apache.org/licenses/LICENSE-2.0
                  #
                  # Unless required by applicable law or agreed to in writing, software
                  # distributed under the License is distributed on an "AS IS" BASIS,
                  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                  # See the License for the specific language governing permissions and
                  # limitations under the License.

                  #
                  # Mega World USB Game Controllers
                  #


                  key 256 BUTTON_1
                  key 257 BUTTON_2
                  key 258 BUTTON_3
                  key 259 BUTTON_4
                  key 260 BUTTON_5
                  key 261 BUTTON_6
                  key 262 BUTTON_7
                  key 263 BUTTON_8
                  key 264 BUTTON_9
                  key 265 BUTTON_10
                  key 266 BUTTON_11
                  key 267 BUTTON_12
                  key 268 BUTTON_13
                  key 269 BUTTON_14
                  key 270 BUTTON_15
                  key 271 BUTTON_16

                  key 288 BUTTON_1
                  key 289 BUTTON_2
                  key 290 BUTTON_3
                  key 291 BUTTON_4
                  key 292 BUTTON_5
                  key 293 BUTTON_6
                  key 294 BUTTON_7
                  key 295 BUTTON_8
                  key 296 BUTTON_9
                  key 297 BUTTON_10
                  key 298 BUTTON_11
                  key 299 BUTTON_12
                  key 300 BUTTON_13
                  key 301 BUTTON_14
                  key 302 BUTTON_15
                  key 303 BUTTON_16


                  key 304 BUTTON_A
                  key 305 BUTTON_B
                  key 306 BUTTON_C
                  key 307 BUTTON_X
                  key 308 BUTTON_Y
                  key 309 BUTTON_Z
                  key 310 BUTTON_L1
                  key 311 BUTTON_R1
                  key 312 BUTTON_L2
                  key 313 BUTTON_R2
                  key 314 BUTTON_SELECT
                  key 315 BUTTON_START
                  key 316 BUTTON_MODE
                  key 317 BUTTON_THUMBL
                  key 318 BUTTON_THUMBR



                  axis 0x00 X
                  axis 0x01 Y
                  axis 0x03 Z
                  axis 0x04 RZ
                  axis 0x05 Z
                  axis 0x02 RZ
                  axis 0x10 HAT_X
                  axis 0x11 HAT_Y

                  ##################



                  I had to use both

                  KeyTest.apk

                  and

                  https://play.google.com/store/apps/d....gamepad&hl=en

                  To understand what was going on

                  I made my keylayout a bit generic so there are functions in the config not actually on the gamepad

                  Comment


                  • #10
                    I don't understand Biomecanoid; what exactely was missing in your first files?

                    Comment


                    • #11
                      Syntax was wrong

                      key 0x188 BUTTON_A instead of key 288 BUTTON_1
                      and i swap Z with RZ

                      and the kl file attributes should be te same as the existsing kl files in the files and if i remember correctly its 644

                      Comment


                      • #12
                        Originally posted by seanberna View Post
                        I don't understand Biomecanoid; what exactely was missing in your first files?

                        Hello , your problem is after you create your .kl file you need to apply permission 644 and it will work

                        Comment


                        • #13
                          May I ask if this method is only for USB devices?
                          I was trying to make a key layout file like you said for my Bluetooth gamepad but i hit a problem with the terminal program.
                          I got "No such file or directory" when i hit cat/proc/bus/input/devices.
                          Is this because I have Bluetooth devices instead of USB?
                          But I actually have a usb air mouse connected to it.

                          Comment


                          • #14
                            Originally posted by knight46 View Post
                            May I ask if this method is only for USB devices?
                            I was trying to make a key layout file like you said for my Bluetooth gamepad but i hit a problem with the terminal program.
                            I got "No such file or directory" when i hit cat/proc/bus/input/devices.
                            Is this because I have Bluetooth devices instead of USB?
                            But I actually have a usb air mouse connected to it.

                            Opps. My bad. It will show Bluetooth devices as well.

                            Comment


                            • #15
                              Trying to get my box to work with an easyget arcade usb controller set but the KeyPress application doesn't register it. Any suggestions?
                              I know the controller is working on windows as a generic usb joystick and they claim it works with RetroPie. Would be nice if I can use my Mini Ms8 ii instead of having another box for emulation.

                              Comment

                              Working...
                              X