NVIDIA Shield Controller on Linux

I got an NVIDIA Shield Controller with my Shield Tablet a while back. I’ve used it some on both the tablet itself and via USB on Windows, but it doesn’t work out of the box on Linux and until recently I didn’t care because my wireless 360 controllers worked just fine. However, I left the 360 controllers at home with the Xbox itself when I moved out to college, only bringing the Shield controller with. So this week I actually took the time to get it working, and this is the result of my search.

The only requirement for this that I didn’t already have installed was xboxdrv, the userspace gamepad driver. (Which is available in the AUR on Arch Linux.) To find the correct device path I used evtest. (Available in community on Arch.) You don’t necessarily need it, but you’ll find the device faster than just trying everything with xboxdrv.

First you need to make sure that the controller is connected and being detected properly. To do this you can check /dev/input/by-id/ for any items containing "NVIDIA" in their name. Unfortunately in my experience these handy symlinks only exist for the little mousepad thing. As such the next step is to go through and run evtest on every /dev/input/event* device until you find the one that responds when you press a button or move a stick on the controller.

Once you find the device, just put it in place of "/dev/input/event20" in the below command. (event20 is what it was on my desktop)

sudo xboxdrv --evdev "/dev/input/event20" --evdev-keymap "KEY_HOMEPAGE=guide,BTN_THUMBR=tr,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_START=start,BTN_A=a,BTN_THUMBL=tl,BTN_NORTH=x,KEY_BACK=back,BTN_B=b" --evdev-absmap "ABS_RZ=y2,ABS_BRAKE=lt,ABS_Y=y1,ABS_GAS=rt,ABS_Z=x2,ABS_X=x1,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y" --axismap "-y2=y2,-y1=y1" --mimic-xpad

If you get an error like "couldn’t convert ‘BTN_WEST’ to enum, not a member of EV_KEY" try this command instead:

sudo xboxdrv --evdev "/dev/input/event20" --evdev-keymap "KEY_HOMEPAGE=guide,BTN_THUMBR=tr,BTN_Y=y,BTN_TL=lb,BTN_TR=rb,BTN_START=start,BTN_A=a,BTN_THUMBL=tl,BTN_X=x,KEY_BACK=back,BTN_B=b" --evdev-absmap "ABS_RZ=y2,ABS_BRAKE=lt,ABS_Y=y1,ABS_GAS=rt,ABS_Z=x2,ABS_X=x1,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y" --axismap "-y2=y2,-y1=y1" --mimic-xpad

For some reason it doesn’t always start spewing event info at you until you use the controller with something, so to know whether or not it worked I usually just open Steam and press the home button. If Steam enters Big Picture mode the controller is set up and should work with any game a normal 360 controller works with. I personally have tested it with Knights of the Old Republic II and Shadow of Mordor without any major issues. If you don’t like all that event info in your face/terminal you can add --silent to the xboxdrv command to suppress it.

If it doesn’t work, try restarting the application you’re testing it with. If that doesn’t work go back and verify all the steps. If it still doesn’t work I really have no idea what’s wrong and probably won’t be of much help, but you can comment here and I’ll give it a shot. (So long as you can give more information than “it’s not working”, cuz if that’s all you’ve got I KNOW I won’t be able to do anything.)

‘Till later

-chip

20 thoughts on “NVIDIA Shield Controller on Linux

    1. Use the command sudo evtest /dev/input/event1 and keep increasing the 1 until you find the device that outputs the controller events to the console or you get “no such file or directory” (which means there aren’t any more devices)

      Like

  1. Thanks! I did find the event that had all of the controller outputs but when I added the event into the command above this is all I got. sudo: xboxdrv: command not found

    Like

      1. I’m just using Ubuntu Gnome 14.04. I’m pretty sure that I’ve already installed xboxdrv in order to stop that green light from flashing on the xbox 360 controller. Maybe Ill try and install it again and see what happens.

        Like

  2. Ok, my apologies, looks like i didnt have xboxdrv installed yet. But now this is what i get when i paste the command with the event number — [ ERROR ] ——————————————————
    couldn’t convert ‘BTN_WEST’ to enum, not a member of EV_KEY

    Perhaps I did not have the right event number?

    Like

      1. Well crap. The event number i was using was the correct one. It just keeps giving me the same error. Anything else i might be able to try? Also, thanks for the help, i appreciate it.

        Like

      2. So it prints a line like

        Event: time 1453950550.143775, type 1 (EV_KEY), code 308 (BTN_WEST), value 0

        When you press the Y button on it? Or does it have something else in the place of BTN_WEST?

        Like

  3. Heres the output that it gives me. Event: time 1453951953.576340, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
    Event: time 1453951953.576340, type 1 (EV_KEY), code 308 (BTN_Y), value 1
    Event: time 1453951953.576340, ————– SYN_REPORT ————
    Event: time 1453951953.664309, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
    Event: time 1453951953.664309, type 1 (EV_KEY), code 308 (BTN_Y), value 0
    Event: time 1453951953.664309, ————– SYN_REPORT ————

    Also I noted that after installing the xboxdrv and rebooting my device number for the controller changed from 6 to 10. So I put that in your command and this time I didnt get anything after entering the command. I tried the controller in a game or two and nothing worked. I feel like im close here.

    Like

    1. So this must be an older version of evdev that uses BTN_Y instead of BTN_WEST, this probable also applies to X. Try:
      sudo xboxdrv --evdev "/dev/input/event20" --evdev-keymap "KEY_HOMEPAGE=guide,BTN_THUMBR=tr,BTN_Y=y,BTN_TL=lb,BTN_TR=rb,BTN_START=start,BTN_A=a,BTN_THUMBL=tl,BTN_X=x,KEY_BACK=back,BTN_B=b" --evdev-absmap "ABS_RZ=y2,ABS_BRAKE=lt,ABS_Y=y1,ABS_GAS=rt,ABS_Z=x2,ABS_X=x1,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y" --axismap "-y2=y2,-y1=y1" --mimic-xpad

      Like

  4. Ok, now were getting somewhere. This is what I get with the updated command – Your Xbox/Xbox360 controller should now be available as:
    /dev/input/js6
    /dev/input/event18

    Press Ctrl-c to quit, use ‘–silent’ to suppress the event output

    I opened up a game and it didnt work though. Is there something else I need to do after this to get it working?

    Like

  5. Well, I take that back. It is working. It works just fine in Steam’s big picture mode but its super buggy in games for some reason. Or not working at all in some games. So close….

    Like

    1. My first guess would be related to the fact that its output is going to js6, meaning there are 5 other “joystick” devices connected to your system. (They may not be actual joysticks, but other devices that are detected as joysticks) The game you tried probably only checked the first one it found. I’m not sure what you could do about that, to fix the issues UE4 had with that I had to modify the engine source code…

      Like

      1. Huh, thats weird. The only other things I have or had plugged in are just mouse, keyboard, xbox 360 controller/dongle, and wacom tablet. Well, I might fiddle with it a bit more but for now the 360 controller seems to be the way to go for me. Perhaps there will be native out of the box support for the nvidia controller in the future. Thanks for the help though, plus you helped me learn a bit more about this system.

        Like

      2. I know that if the xpad kernel module is loaded it automatically creates devices for all four controllers the 360 wireless dongle can connect to, even if they aren’t connected. I also heard of some kind of a mouse creating a js device.

        Like

  6. You’re my hero!
    For Debian users, you just have to install “xboxdrv” and “evtest”, then follow the complete tutorial, it works!

    Liked by 1 person

  7. Thanks for these instructions! However, I was unable to get these drivers to start at boot. Any help would be appreciated.

    Like

    1. I don’t know if I can help there, I always run it manually when I need it. You could put the xboxdrv command in an autostart script, but if/when the device number changes the script will fail.

      Like

Leave a comment