RetroPie 2.2
Part One
First thing you'll need to do after you boot into emulation station is press "f4" to get into your command line.
Then type these commands in order pressing "enter" between each command.
sudo chown pi /opt/retropie/configs/all/retroarch.cfg
cd /opt/retropie/emulators/RetroArch/installdir/bin
sudo ./retroarch-joyconfig -j 1 >> /opt/retropie/configs/all/retroarch.cfg
Follow the instructions in the command line and it should get your controller up and running in emulation station and in your games.
Part 2 (not sure if this works yet I'm in the middle of testing it)
From the command line type startx
and boot into the gui.
Open up the file explorer and go to the directory /opt/retropie/configs/all/
and open retroarch.cfg
in your file editor.
Scroll all the way to the bottom and you'll find a a section like this:
input_player1_joypad_index = "0"
input_player1_b_btn = "1"
input_player1_y_btn = "3"
input_player1_select_btn = "6"
input_player1_start_btn = "7"
input_player1_up_axis = "-1"
input_player1_down_axis = "+1"
input_player1_left_axis = "-0"
input_player1_right_axis = "+0"
input_player1_a_btn = "0"
input_player1_x_btn = "2"
input_player1_l_btn = "4"
input_player1_r_btn = "5"
input_player1_l2_btn = "6"
input_player1_r2_btn = "6"
input_player1_l3_btn = "6"
input_player1_r3_btn = "6"
input_player1_l_x_plus_btn = "6"
input_player1_l_x_minus_btn = "6"
input_player1_l_y_plus_btn = "6"
input_player1_l_y_minus_btn = "6"
input_player1_r_x_plus_btn = "6"
input_player1_r_x_minus_btn = "6"
input_player1_r_y_plus_btn = "6"
input_player1_r_y_minus_btn = "6"
input_player1_joypad_index = "0"
input_player1_b_btn = "1"
input_player1_y_btn = "3"
input_player1_select_btn = "6"
input_player1_start_btn = "7"
input_player1_up_axis = "-1"
input_player1_down_axis = "+1"
input_player1_left_axis = "-0"
input_player1_right_axis = "+0"
input_player1_a_btn = "0"
input_player1_x_btn = "2"
input_player1_l_btn = "4"
input_player1_r_btn = "5"
input_player1_l2_btn = "4"
input_player1_r2_btn = "5"
input_player1_l3_btn = "4"
input_player1_r3_btn = "5"
input_player1_l_x_plus_axis = "-0"
input_player1_l_x_minus_axis = "+0"
input_player1_l_y_plus_axis = "+1"
input_player1_l_y_minus_axis = "-1"
input_player1_r_x_plus_axis = "+0"
input_player1_r_x_minus_axis = "-0"
input_player1_r_y_plus_axis = "+1"
input_player1_r_y_minus_axis = "-1"
That's the section laying out the configuration for player 1, copy all that text and change all player1
to player2
and I think you have to increment the top most line...
input_player1_joypad_index = "0" -> input_player1_joypad_index = "1"
that's where i haven't tested yet.
Anyway I hope it all works.
EDIT: I just tried out my usb controllers in a co-op setting with two players and this solution worked for me.