How to pair a Wireless Xbox 360 Controller and fix Camera Spin
Video that demonstrates the setup, show an example of the problem, the steps to solve the problem, and the working solution!!!
So first lets just talk about the Hardware Setup.
- Xbox 360 Wireless Controller
- OTG Cable.
- Xbox 360 Wireless Dongle (This is meant for the PC but also works on the Android, and quite lovely on emulators)
This setup alone works well for allot of the emulators out there, however some of the games are not working with the controller, for instance GTA3 , Dead Trigger, Shadowgun and others. So by reading the logcat I was able to figure out a solution. Snippet of logcat below
07-22 19:55:48.039 350 405 D EventHub: No input device configuration file found for device 'Xbox 360 Wireless Receiver'.
07-22 19:55:48.059 350 405 I EventHub: New device: id=4, fd=269, path='/dev/input/event3', name='
360 Wireless Receiver', classes=0x80000341, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false, usingSuspendBlockIoctl=true, usingClockIoctl=false
<6>[ 117.819812] usb 2-1: new full speed USB device number 2 using tegra-ehci
<6>[ 117.873142] usb 2-1: New USB device found, idVendor=045e, idProduct=0719
<6>[ 117.873219] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 117.873337] usb 2-1: Product: Xbox 360 Wireless Receiver for Windows
<6>[ 117.873403] usb 2-1: Manufacturer: ¬©Microsoft
<6>[ 117.873518] usb 2-1: SerialNumber: FE425DB0
So when i searched through the /system/usr/keylayout/ I saw there was a profile for the xbox 360 wired controller so I thought why not copy the profile and name it a wireless xbox controller. This idea worked. You name keylayouts by Vendor ID and Product ID which I also was able to get from the logcat. What is nice about this is I think we can use this to solve issues with other controllers as well, but I don't know of any that are also having problems.
For this solution a rooted Nexus 7 is required. I already have a step by step video on rooting if you need the help on the nexus 7. but after obtaining root you need to enter into the Android Shell (i was using Terminal Emulator for Android on the Nexus 7 downloaded from the google play store ) . I entered this commands to get this all setup.
- cd /system/usr/keylayout/
- mount -o remount,rw /system
- cp Vendor_045e_Product_0291.kl Vendor_045e_Product_0719.kl
- chmod 644 Vendor_045e_Product_0291.kl
- chmod 644 Vendor_045e_Product_0719.kl
Restart System and Enjoy!!!!
I attached the Key Character Mapping file as well. This is found in /system/usr/keychars . For nexus 7 users this isn't necessary but some other devices have different generic .kcm so this is needed (in the process of being confirmed) PLEASE NOTE THE .KCM Extension
Some of you do not have the Keylayout file for even the USB Xbox Controller, I am attaching the file (it needs to be unzipped), you will need to paste it into the /system/usr/keylayout/ folder. You also could rename this to the Wireless Xbox Controller Vendor and Product ID and copy it 'Vendor_045e_Product_0719' .
Update 2: When copying the file you still need to mount the Systems folder using the command listed above: "mount -o remount,rw /system" and also remember to modify its priveledges using the
"chmod 644 Vendor_045e_Product_0291.kl"
PLEASE NOTE THE .KL EXTENSION FOR THIS FILE