Mayflash N64 Controller Adapter

An awesome device once configured

Within the past week I purchased a usb adapter for my old N64 controllers so I could use them to play games on my laptop that’s running Linux Mint 11. (Buy one on

The adapter claims to be plug-and-play with no drivers required for use with a PC. Although this is true and I was able to successfully map the keys with Mupen64Plus with no issues, the joystick on the N64 controller did not respond as such.

For instance, at full-tilt Mario (in Mario64) walked instead of ran. In some games this was okay, but in most this was completely unsatisfactory. I ended up visiting various blogs, forums, etc around the interwebs but was unable to get a straight answer as to how to properly configure the device.

Some said it was impossible, others said it was extermemly easy. Few said anything as to how to do it. So, without further ado, this is what I did to make it work well:

1. Map the buttons like you normally would (inculding the analog sticks (e.g. assign axis0 to controller 1 y-axis, axis1 to x-axis, etc)

2. The programs you’re using must be told to use /dev/input/js0 (which both analog sticks are using since the computer treats the adapter as one device) so you have to add a line to /etc/environment so effects take place system wide

 sudo gedit /etc/environment

add the line


3. Install jscal in order to calibrate the axises of the analog sticks (so they respond appropriately). Next calibrate the axises. (Alternatively, install jscal and skip to step 6. This is my setup and it may work for you).

sudo apt-get install jscal

Make sure the controllers are plugged in then:

jscal -c /dev/input/js0

Don’t touch the controllers while a bunch of numbers fly past in the terminal. When it asks to set the minimum for axis0 (or whatever) press your analog stick to the lowest number it will go to and the press A (or any button), do the same thing for the maximum and center, repsectively.

**Pro tip: C-buttons are considered to be an axis, don’t forget to set these! (The D-pad is also considered an axis, but don’t worry about this now).

4. At this point, go ahead and test your controllers with your application of choice. If they work, skip to step 6, if the D-pad is giving you issues (and everything else works), go to the next step.

5. List the calibration settings:

jscal -p /dev/input/js0

Copy these into a text file

Now set the controller back to default settings using jcal

jscal /dev/input/js0

List the new settings:

jscal -p /dev/input/js0

Copy the last 4 sets of numbers from the terminal and replace the last 4 sets of numbers in the text file. Each set should look something like:

1,0,128,128,5592235 (or any other five numbers)

6. Paste the contents of the text file into the terminal. Mine is as follows:

jscal -s 12,1,0,128,128,6391125,5772629,1,2,125,125,5899500,6468127,1,0,128,128,5592235,5592235,1,0,128,128,5592235,5592235,1,0,128,128,6100620,6882750,1,0,128,128,5592235,5592235,1,0,128,128,5592235,5592235,1,0,126,126,6391125,6032073,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912 /dev/input/js0

If this works, move to the next step.

7. Everytime the computer is restarted, these settings will be lost so we’re going to create a script that runs whenever the adapter is plugged in and one that runs at startup (only if the adapter is plugged in)

Create a script to run the jscal -s command

sudo gedit /usr/local/scripts/n64.jscal

Paste the following (or whatever your jscal settings are)

jscal -s 12,1,0,128,128,6391125,5772629,1,2,125,125,5899500,6468127,1,0,128,128,5592235,5592235,1,0,128,128,5592235,5592235,1,0,128,128,6100620,6882750,1,0,128,128,5592235,5592235,1,0,128,128,5592235,5592235,1,0,126,126,6391125,6032073,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912  /dev/input/js0

8. Save the file and make it executable

sudo chmod x+ /usr/local/scripts/n64.jscal

9. Create a rule that runs this script everytime the usb is plugged into the computer.

**make sure the adapter is plugged in**


you should see something similar to

Bus 003 Device 004: ID 0e8f:3013 GreenAsia Inc.

Copy the vendor and product ID

**protip: vendor is the 0e8f part, product is 3013

sudo gedit /etc/udev/rules.d/60-n64.rules

It is highly important that the file starts with 60 (or less) is followed by a dash and ends with .rules

(For more information, see the readme file in /etc/udev/rules.d/)

Paste in the following:

ATTRS{idVendor}=="0e8f", ATTRS{idProduct}=="3013", RUN+="/usr/local/scripts/n64.jscal"

Replace “oe8f” and “3013” with your vendor and product and “/usr/local/scripts/n64.jscal” with your script location. The quotation marks must stay.

10. Save the file and restart udev

sudo /etc/init.d/udev restart

Now everytime you plug in your adapter (with the controllers already plugged into it) the n64.jscal calibration script should run.

11. Now it’s time to make a startup script. I’m not sure if this is necessary, but I’d like to have it just in case.

sudo cp /usr/local/scripts/n64.jscal /etc/init.d/

sudo update-rc.d n64.jscal defaults

Now you should be ready to use your perfectly calibrated Mayflash N64 controller to USB adapter with 2 controllers.


Buy one on


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: