I'm having some issues with using a joystick (specifically a Playstation 2 controller, detected at /dev/input/js0) with mplayer.
What does work (and steps taken):
* Joystick works well with other programs (ex: mame, mythtv)
* jscalibrator picks up the controller, all 16 buttons and axis
* enabled joystick input in /etc/mplayer/mplayer.conf
---> at the very bottom of mplayer.conf looked for:
changed "nojoystick = yes" to "nojoystick = no"Code:#Disable joystick support #It seems to cause very odd problems on laptops #With accelerometers (See LP: #75925) nojoystick = yes
* Created a new file "input.conf" in ~/.mplayer/*Verified Buttons 4 through 9 work properlyCode:## Triangle JOY_BTN0 quit ## Circle JOY_BTN1 set_menu main ## X JOY_BTN2 speed_set 1.0 ## Square JOY_BTN3 frame_step +1 ## L2 JOY_BTN4 speed_mult 0.9091 ## R2 JOY_BTN5 speed_mult 1.1 ## L1 JOY_BTN6 seek -600 ## R1 JOY_BTN7 seek 600 ## Select JOY_BTN8 osd ## Start JOY_BTN9 pause ## L3 JOY_BTN10 sub_select ## R3 JOY_BTN11 switch_audio ## D-Up JOY_BTN12 seek +60 ## D-Right JOY_BTN13 seek +10 ## D-Down JOY_BTN14 seek -60 ## D-Left JOY_BTN15 seek -10
*** Problem 1 ***
Buttons 0 through 3 will not remap to anything other than the defaults. I verified this in the code for mplayer's input.c (snippet below)
So lines 331 through 334 are setting the default for these joystick buttons, but it seems that nothing I do in ~/mplayer/input.conf can change these. So, anybody know of a way to override these 4 defaults (short of recompiling mplayer).Code:326 #ifdef HAVE_JOYSTICK 327 { { JOY_AXIS0_PLUS, 0 }, "seek 10" }, 328 { { JOY_AXIS0_MINUS, 0 }, "seek -10" }, 329 { { JOY_AXIS1_MINUS, 0 }, "seek 60" }, 330 { { JOY_AXIS1_PLUS, 0 }, "seek -60" }, 331 { { JOY_BTN0, 0 }, "pause" }, 332 { { JOY_BTN1, 0 }, "osd" }, 333 { { JOY_BTN2, 0 }, "volume 1"}, 334 { { JOY_BTN3, 0 }, "volume -1"},
*** Problem 2 ***
Buttons 10 through 15 are not detected by MPlayer as JOY_BTNx, instead when I press one of these I see on the terminal output:
The output above was generated by pressing buttons 10-15 sequentially.Code:No bind found for key '0x100001a0'. 7% 1 0 No bind found for key '0x100001a1'. 7% 1 0 No bind found for key '0x100001a2'. 7% 1 0 No bind found for key '0x100001a3'. 7% 1 0 No bind found for key '0x1000019e'. 7% 1 0 No bind found for key '0x1000019f'. 7% 1 0 No bind found for key '0x1000019e'. 8% 1 0 No bind found for key '0x1000019f'. 8% 1 0 No bind found for key '0x100001a0'. 8% 1 0 No bind found for key '0x100001a1'. 8% 1 0 No bind found for key '0x100001a2'. 0.8% 1 0 No bind found for key '0x100001a3'. 0.8% 1 0
I did note (again in mplayer's code: input.c) that buttons 10-15 are not defined. However I was wondering is there a way to just input the hex code from the key into the input.conf (again, make it work w/o having to edit the input.c and recompile). I did try to replace the JOY_BTNx w/ the hex code seen above, but that did not work.
The sections of input.c I'm talking about may be seen below.
As you can see, lines 221 through 230 define JOY_BTN 0 through 9. And to recap, 0-3 seem hard-coded by mplayer and 10+ are undefined.Code:/// The names of the keys as used in input.conf 140 /// If you add some new keys, you also need to add them here 141 142 static mp_key_name_t key_names[] = { 143 { ' ', "SPACE" }, 144 { KEY_ENTER, "ENTER" }, 145 { KEY_TAB, "TAB" }, 146 { KEY_CTRL, "CTRL" }, 147 { KEY_BACKSPACE, "BS" }, 148 { KEY_DELETE, "DEL" }, 149 { KEY_INSERT, "INS" }, 150 { KEY_HOME, "HOME" }, 151 { KEY_END, "END" }, 152 { KEY_PAGE_UP, "PGUP" }, 153 { KEY_PAGE_DOWN, "PGDWN" }, 154 { KEY_ESC, "ESC" }, 155 { KEY_RIGHT, "RIGHT" }, 156 { KEY_LEFT, "LEFT" }, 157 { KEY_DOWN, "DOWN" }, 158 { KEY_UP, "UP" }, 159 { KEY_F+1, "F1" }, 160 { KEY_F+2, "F2" }, 161 { KEY_F+3, "F3" }, 162 { KEY_F+4, "F4" }, 163 { KEY_F+5, "F5" }, 164 { KEY_F+6, "F6" }, 165 { KEY_F+7, "F7" }, 166 { KEY_F+8, "F8" }, 167 { KEY_F+9, "F9" }, 168 { KEY_F+10, "F10" }, 169 { KEY_F+11, "F11" }, 170 { KEY_F+12, "F12" }, 171 { KEY_KP0, "KP0" }, 172 { KEY_KP1, "KP1" }, 173 { KEY_KP2, "KP2" }, 174 { KEY_KP3, "KP3" }, 175 { KEY_KP4, "KP4" }, 176 { KEY_KP5, "KP5" }, 177 { KEY_KP6, "KP6" }, 178 { KEY_KP7, "KP7" }, 179 { KEY_KP8, "KP8" }, 180 { KEY_KP9, "KP9" }, 181 { KEY_KPDEL, "KP_DEL" }, 182 { KEY_KPDEC, "KP_DEC" }, 183 { KEY_KPINS, "KP_INS" }, 184 { KEY_KPENTER, "KP_ENTER" }, 185 { MOUSE_BTN0, "MOUSE_BTN0" }, 186 { MOUSE_BTN1, "MOUSE_BTN1" }, 187 { MOUSE_BTN2, "MOUSE_BTN2" }, 188 { MOUSE_BTN3, "MOUSE_BTN3" }, 189 { MOUSE_BTN4, "MOUSE_BTN4" }, 190 { MOUSE_BTN5, "MOUSE_BTN5" }, 191 { MOUSE_BTN6, "MOUSE_BTN6" }, 192 { MOUSE_BTN7, "MOUSE_BTN7" }, 193 { MOUSE_BTN8, "MOUSE_BTN8" }, 194 { MOUSE_BTN9, "MOUSE_BTN9" }, 195 { JOY_AXIS1_MINUS, "JOY_UP" }, 196 { JOY_AXIS1_PLUS, "JOY_DOWN" }, 197 { JOY_AXIS0_MINUS, "JOY_LEFT" }, 198 { JOY_AXIS0_PLUS, "JOY_RIGHT" }, 199 200 { JOY_AXIS0_PLUS, "JOY_AXIS0_PLUS" }, 201 { JOY_AXIS0_MINUS, "JOY_AXIS0_MINUS" }, 202 { JOY_AXIS1_PLUS, "JOY_AXIS1_PLUS" }, 203 { JOY_AXIS1_MINUS, "JOY_AXIS1_MINUS" }, 204 { JOY_AXIS2_PLUS, "JOY_AXIS2_PLUS" }, 205 { JOY_AXIS2_MINUS, "JOY_AXIS2_MINUS" }, 206 { JOY_AXIS3_PLUS, "JOY_AXIS3_PLUS" }, 207 { JOY_AXIS3_MINUS, "JOY_AXIS3_MINUS" }, 208 { JOY_AXIS4_PLUS, "JOY_AXIS4_PLUS" }, 209 { JOY_AXIS4_MINUS, "JOY_AXIS4_MINUS" }, 210 { JOY_AXIS5_PLUS, "JOY_AXIS5_PLUS" }, 211 { JOY_AXIS5_MINUS, "JOY_AXIS5_MINUS" }, 212 { JOY_AXIS6_PLUS, "JOY_AXIS6_PLUS" }, 213 { JOY_AXIS6_MINUS, "JOY_AXIS6_MINUS" }, 214 { JOY_AXIS7_PLUS, "JOY_AXIS7_PLUS" }, 215 { JOY_AXIS7_MINUS, "JOY_AXIS7_MINUS" }, 216 { JOY_AXIS8_PLUS, "JOY_AXIS8_PLUS" }, 217 { JOY_AXIS8_MINUS, "JOY_AXIS8_MINUS" }, 218 { JOY_AXIS9_PLUS, "JOY_AXIS9_PLUS" }, 219 { JOY_AXIS9_MINUS, "JOY_AXIS9_MINUS" }, 220 221 { JOY_BTN0, "JOY_BTN0" }, 222 { JOY_BTN1, "JOY_BTN1" }, 223 { JOY_BTN2, "JOY_BTN2" }, 224 { JOY_BTN3, "JOY_BTN3" }, 225 { JOY_BTN4, "JOY_BTN4" }, 226 { JOY_BTN5, "JOY_BTN5" }, 227 { JOY_BTN6, "JOY_BTN6" }, 228 { JOY_BTN7, "JOY_BTN7" }, 229 { JOY_BTN8, "JOY_BTN8" }, 230 { JOY_BTN9, "JOY_BTN9" }, 231 232 { KEY_XF86_PAUSE, "XF86_PAUSE" }, 233 { KEY_XF86_STOP, "XF86_STOP" }, 234 { KEY_XF86_PREV, "XF86_PREV" }, 235 { KEY_XF86_NEXT, "XF86_NEXT" }, 236 237 { 0, NULL } 238 }; 239
Any help and/or hints are greatly appreciated! (Surely I'm not the only one who's tried to do this...
One last note, the controller analog sticks are not picked up by mplayer (which is fine), the d-pad registers as buttons 12-15 (with other programs, registers as the hex codes above w/ mplayer).
Bookmarks