Mupen64plus with ds4drv

I just configured the Nintendo 64 emulator Mupen64plus to use my PS4 controller. I’m running Ubuntu 14.10 and installed Mupen through the package manager and ds4drv with pip:

sudo apt-get install mupen64plus
sudo pip install ds4drv

Then I added the following lines to /usr/share/games/mupen64plus/InputAutoCfg.ini

[Sony Computer Entertainment Wireless Controller]
plugged = True
plugin = 2
mouse = False
AnalogDeadzone = 4096,4096
AnalogPeak = 32767,32767
DPad R = hat(0 Right)
DPad L = hat(0 Left)
DPad D = hat(0 Down)
DPad U = hat(0 Up)
Start = button(9)
Z Trig = button(6)
B Button = button(0)
A Button = button(1)
C Button R = axis(2+)
C Button L = axis(2-)
C Button D = axis(5+)
C Button U = axis(5-)
R Trig = button(5)
L Trig = button(4)
Mempack switch =
Rumblepak switch =
X Axis = axis(0-, 0+)
Y Axis = axis(1-, 1+)

This maps the Dualshock D-pad to the N64 D-pad, the left joystick to the N64 joystick, right joystick to the C buttons, X is the A button and square is the B button, shoulder buttons are L1 and R1, Z button is L2 and Start is the Options button.