https://wiki.archlinux.org/api.php?action=feedcontributions&user=Raku&feedformat=atomArchWiki - User contributions [en]2024-03-28T15:27:32ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Mpv&diff=468434Mpv2017-02-17T02:00:20Z<p>Raku: /* Added warning of deprecated option */</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Multimedia players]]<br />
[[ja:Mpv]]<br />
[[ru:Mpv]]<br />
[[zh-hans:Mpv]]<br />
{{Related articles start}}<br />
{{Related|MPlayer}}<br />
{{Related articles end}}<br />
<br />
[http://mpv.io/ mpv] is a media player based on [[MPlayer]] and MPlayer2. It supports a wide variety of video file formats, audio and video codecs, and subtitle types. A comprehensive (although admittedly incomplete) list of differences between ''mpv'' and the aforementioned players can be found [https://github.com/mpv-player/mpv/blob/master/DOCS/mplayer-changes.rst here].<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|mpv}} package from the [[official repositories]] or {{AUR|mpv-git}} from the [[Arch User Repository]].<br />
<br />
=== Front ends ===<br />
<br />
''mpv'' provides an elegant User Interface called OSC which appears when moving the mouse. To ease casual users, other graphical interfaces exist:<br />
<br />
* {{App|Baka MPlayer|Free and open source, cross-platform, ''libmpv'' based multimedia player (Qt 5).|http://bakamplayer.u8sand.net/|{{Pkg|baka-mplayer}}, {{AUR|baka-mplayer-git}}}}<br />
* {{App|bomi|Powerful and easy to use multimedia player (Qt 5).|https://bomi-player.github.io/|{{AUR|bomi}}, {{AUR|bomi-git}}}}<br />
* {{App|GNOME MPV|A simple frontend for ''mpv'' (GTK+ 3).|http://gnome-mpv.github.io/|{{AUR|gnome-mpv}}, {{AUR|gnome-mpv-git}}}}<br />
* {{App|Media Player Classic Qute Theater|A clone of [[Wikipedia:Media Player Classic|Media Player Classic]] reimplimented in Qt.|https://github.com/cmdrkotori/mpc-qt|{{AUR|mpc-qt-git}}}}<br />
* {{App|[[Wikipedia:SMPlayer|SMPlayer]]|Qt multimedia player with extra features (CSS themes, YouTube integration, etc.) (Qt 5).|http://smplayer.sourceforge.net/|{{Pkg|smplayer}}}}<br />
* {{App|xt7-player-mpv|Qt/Gambas GUI to mpv with a rich set of configurable options including filters and drivers, ladspa plugins support as well as library/playlist managment, YouTube, online radios, podcasts, DVB-T and more.|https://github.com/kokoko3k/xt7-player-mpv|{{AUR|xt7-player-mpv-git}}}}<br />
<br />
{{Note|CMPlayer/''bomi'' packages provide ''mpv'' internally.}}<br />
<br />
== Configuration ==<br />
<br />
''mpv'''s configuration is read from the files {{ic|mpv.conf}} (settings), {{ic|input.conf}} (key bindings), and {{ic|lua-settings/osc.conf}} (on screen display). For a full list of options, see the {{man|1|mpv|url=https://mpv.io/manual/master/}} or the [https://github.com/mpv-player/mpv/tree/master/DOCS/man GitHub docs].<br />
<br />
If the [[environment variable]] {{ic|XDG_CONFIG_HOME}} is not set, user configuration files will be read from the {{ic|~/.config/mpv}} directory. System-wide configuration files are read from the {{ic|/etc/mpv}} directory.<br />
<br />
=== An example input.conf file ===<br />
<br />
Copying the following into {{ic|~/.config/mpv/input.conf}} will add a number of useful keybindings to mpv such as rotating video 90 degrees, zooming and panning.<br />
<br />
Alt+RIGHT add video-rotate 90<br />
Alt+LEFT add video-rotate -90<br />
Alt+- add video-zoom -0.25<br />
Alt+= add video-zoom 0.25<br />
Alt+j add video-pan-x -0.05<br />
Alt+l add video-pan-x 0.05<br />
Alt+i add video-pan-y 0.05<br />
Alt+k add video-pan-y -0.05<br />
<br />
=== mpv and PulseAudio/ALSA mixer controls since 0.18.1 ===<br />
<br />
This entry only applies if you are using pulseaudio for mpv ({{ic|1=-ao=pulse}} or {{ic|1=ao=pulse}} in {{ic|mpv.conf}}), or if you want to control your ALSA mixer volume with mpv.<br />
<br />
Add the following to your {{ic|~/.config/mpv/input.conf}} to make volume changes work again from PulseAudio/ALSA to mpv and vice versa:<br />
<br />
/ add ao-volume -2<br />
SHIFT+* add ao-volume 2<br />
<br />
Change the above to whatever volume keys you use.<br />
<br />
== Tips and Tricks ==<br />
<br />
=== Hardware Decoding ===<br />
<br />
See [[Hardware video acceleration]].<br />
<br />
Unlike ''mplayer'' and ''mplayer2'', ''mpv'' has both VA-API and VDPAU support built-in. To enable it, run ''mpv'' with the {{ic|1=--hwdec='method'}} option. You can find list of all available methods looking for {{ic|1=--hwdec=<api>}} in [[man page]] {{man|1|mpv|url=https://mpv.io/manual/master/}}. To make this persistent, add the line {{ic|1=hwdec=''method''}} to your configuration file. <br />
<br />
When hardware decoding is used, the video output should generally be set to {{ic|opengl}} or {{ic|opengl-hq}} (or possibly {{ic|vdpau}} if using {{ic|1=hwdec=vdpau}}). In particular, {{ic|1=hwdec=vaapi}} should be used with {{ic|1=vo=opengl}} [https://github.com/mpv-player/mpv/blob/master/DOCS/man/vo.rst] if possible. <br />
<br />
If hardware decoding cannot be used, ''mpv'' will automatically fall back to software decoding.<br />
<br />
By default, hardware decoding is enabled for codecs h264, vc1, wmv3, hevc, mpeg2video and vp9. It is however possible to specify codecs (e.g. {{ic|1=--hwdec-codecs=h264,mpeg2video}}) or allow all codecs ({{ic|1=hwdec-codecs=all}}) to use hardware decoding.<br />
<br />
=== High quality video output ===<br />
<br />
The {{ic|opengl-hq}} profile is a high quality preset which use the OpenGL video driver and enables various options selected by the mpv developers. To make use of it, specify it in your configuration file.<br />
<br />
{{hc|1=~/.config/mpv/mpv.conf|2=profile=opengl-hq}}<br />
<br />
This comes with a GLSL debanding filter by default, which may lead to bad performance for some users, and can reduce the visual quality of grainy content. You can disable it easily though.<br />
<br />
{{hc|1=~/.config/mpv/mpv.conf|2=<br />
profile=opengl-hq<br />
deband=no}}<br />
<br />
=== Automatically resuming from where you left off ===<br />
<br />
The default key to quit ''mpv'', saving the video's current position and state, is {{ic|Shift+q}}. This key can be changed by adding the {{ic|quit_watch_later}} string in the key bindings configuration file.<br />
<br />
To always automatically save the current playback position on quit, start ''mpv'' with a flag {{ic|--save-position-on-quit}}. To make option permanent, add line {{ic|save-position-on-quit}} to configuration file.<br />
<br />
=== Volume is too low ===<br />
<br />
Set {{ic|1=volume-max=''value''}} in your configuration file to a reasonable amount, such as {{ic|1=volume-max=600}}. Additionally (or alternatively), you can utilize [[Wikipedia:Dynamic range compression|dynamic range compression]] with {{ic|1=af=drc}}.<br />
<br />
=== Quickly cycle between multiple aspect ratio ===<br />
<br />
You can cycle between aspect ratios using {{ic|Shift+a}} from version 0.8.0 onwards.<br />
<br />
=== Ignoring aspect ratio ===<br />
<br />
You can ignore aspect ratio using {{ic|1=--keepaspect=''no''}}. To make option permanent, add line {{ic|1=keepaspect=''no''}} to configuration file.<br />
<br />
=== Drawing to a root window ===<br />
<br />
Run ''mpv'' with {{ic|1=--wid=0}}. This tells ''mpv'' to draw onto a window with a window ID of 0.<br />
<br />
=== Always show GUI ===<br />
<br />
It may be useful to always show the GUI window, even for audio files, especially when ''mpv'' is not started from terminal. This can be done by using {{ic|--force-window}} option.<br />
<br />
=== Hide GUI for video files ===<br />
<br />
It may be useful to hide the GUI window for video files. This can be done by using {{ic|--no-video}} option.<br />
<br />
=== Restoring old OSC ===<br />
<br />
Since version 0.21.0, mpv has replaced the on-screen controls by a bottombar. In case you want on-screen controls back, you can edit the mpv configuration [https://github.com/mpv-player/mpv/wiki/FAQ#i-want-the-old-osc-back as described here].<br />
<br />
=== Use as a browser plugin ===<br />
<br />
With the help of {{AUR|mozplugger}}, ''mpv'' can be used in a supported browser to play video. See [[Browser plugins#MozPlugger]] for configuration details. This coupled with a user script such as [http://isebaro.com/viewtube/?ln=en ViewTube], allows you to use ''mpv'' in place of a site's integrated video player.<br />
<br />
It may be needed to specify a valid user agent for HTTP streaming, e.g. {{ic|1=user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0"}}.<br />
<br />
[[Browser plugins#Video players workarounds]] page shows other easy ways to watch videos.<br />
<br />
=== Improving mpv as a music player with Lua scripts ===<br />
<br />
The development of mpv's Lua scripts are documented in [https://github.com/mpv-player/mpv/blob/master/DOCS/man/lua.rst DOCS/man/lua.rst]<br />
and examples are shown in [https://github.com/mpv-player/mpv/tree/master/TOOLS/lua TOOLS/lua]<br />
of the [https://github.com/mpv-player/mpv mpv repository].<br />
[https://web.archive.org/web/20160320001546/http://bamos.github.io/2014/07/05/mpv-lua-scripting/ This blog post] introduces the<br />
[https://github.com/bamos/dotfiles/blob/master/.mpv/scripts/music.lua music.lua] script,<br />
which shows how Lua scripts can be used to improve mpv as a music player.<br />
<br />
=== Twitch.tv streaming over mpv ===<br />
<br />
If {{Pkg|youtube-dl}} is installed, mpv can directly open a Twitch livestream.<br />
<br />
Alternatively, {{Pkg|livestreamer}} can be used to stream Twitch. See [[Livestreamer#Twitch]].<br />
<br />
Another alternative based on Livestreamer is this Lua script: https://gist.github.com/ChrisK2/8701184fe3ea7701c9cc<br />
<br />
=== youtube-dl and choosing formats ===<br />
<br />
The default {{ic|--ytdl-format}} is {{ic|bestvideo+bestaudio/best}}. For youtube videos that have 4K resolutions available, this may mean that your device will struggle to decode 4K VP9 encoded video in software even if the attached monitor is much lower resolution.<br />
<br />
Setting the right youtube-dl format selectors can fix this easily though. In the following configuration example, only videos with a vertical resolution of 1080 pixels or less will be considered.<br />
<br />
ytdl-format=bestvideo[height<=?1080]+bestaudio/best<br />
<br />
If you wish to avoid a certain codec altogether because you cannot hardware-decode it, you can add this to the format selector. For example, we can additionally choose to ignore VP9 as follows:<br />
<br />
ytdl-format=bestvideo[height<=?1080][vcodec!=vp9]+bestaudio/best<br />
<br />
=== youtube-dl audio with search ===<br />
<br />
To find and play audio straight from your terminal with {{ic|mm "''search terms''"}} put the following function in your {{ic|.bashrc}}:<br />
<br />
function mm() {<br />
mpv --no-video --ytdl-format=bestaudio ytdl://ytsearch10:"$@"<br />
}<br />
<br />
=== Use mpv with a compositor ===<br />
<br />
If you're using a compositor (e.g. in KDE Plasma 5) and find that composition is disabled (e.g. in Plasma this would make you unable to present windows or see window thumbnails in the default app switcher) when mpv is playing a video, try {{ic|1=x11-bypass-compositor=no}}<br />
<br />
=== Creating a single screenshot ===<br />
An example of creating a single screenshot, by using a start time ({{ic|HH:MM:SS}}):<br />
<br />
$ mpv --no-audio --vo=image --start=00:01:30 --frames=1 /path/to/video/file<br />
<br />
Screenshots will be saved as 00000001.jpg in the current directory.<br />
<br />
== Vapoursynth ==<br />
<br />
Vapoursynth is an alternative to AviSynth that can be used on Linux and allows for Video manipulation via python scripts. Vapoursynths python scripts can be used as video filters for ''mpv''.<br />
<br />
To use vapoursynth filters you have to install the {{Pkg|vapoursynth}} package and compile ''mpv'' with the {{ic|--enable-vapoursynth}} build flag. <br />
<br />
=== Debanding (flash3kyuu) ===<br />
<br />
{{Note|Mpv already include a debanding shader which is enabled by default with the [[Mpv#High_quality_video_output|opengl-hq profile]]. Refer to the manual for more information on how to tune it.}}<br />
<br />
To use the {{ic|f3k_db}} debanding filter install {{Pkg|vapoursynth-plugin-f3kdb}} and write a python script that uses the ''vapoursynth'' extension.<br />
<br />
The following sample script can be used to enable debanding in ''mpv''.<br />
<br />
import vapoursynth as vs<br />
core = vs.get_core()<br />
<br />
clip = video_in<br />
clip = core.std.Trim(clip, first=0, length=500000)<br />
clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=16)<br />
clip.set_output()<br />
<br />
Finally specify the python script in the config file or use a command line argument when executing mpv.<br />
$ mpv --vf=vapoursynth=f3k_db.py <video_file><br />
<br />
== Troubleshooting ==<br />
<br />
=== Fix jerky playback and tearing ===<br />
<br />
mpv defaults to using the OpenGL video output device setting on hardware that supports it. In cases such as trying to play video back on a 4K display using a Intel HD4XXX series card or similar, you will find video playback unreliable, jerky to the point of stopping entirely at times and with major tearing when using any opengl output setting. If you experience any of these issues, using the XV (XVideo) video output device may help:<br />
<br />
{{hc|1=~/.config/mpv/mpv.conf|2=vo=xv}}<br />
This VO is deprecated and will cause issues in recent versions of mpv, most noticeably is the osd looking very blurry.<br />
<br />
It is possible to increase playback performance even more (especially on lower hardware), but this decreases the video quality dramatically in most cases.<br />
<br />
The following [[Mpv#Configuration|options]] may be considered to increase the video playback performance:<br />
{{hc|~/.config/mpv/mpv.conf|2=<br />
vd-lavc-fast<br />
vd-lavc-skiploopfilter=<skipvalue><br />
vd-lavc-skipframe=<skipvalue><br />
vd-lavc-framedrop=<skipvalue><br />
vd-lavc-threads=<threads><br />
}}</div>Rakuhttps://wiki.archlinux.org/index.php?title=Gamepad&diff=449659Gamepad2016-09-06T20:30:30Z<p>Raku: Added alternative config to xboxdrv in case it isn't working.</p>
<hr />
<div>[[Category:Input devices]]<br />
[[Category:Gaming]]<br />
[[ja:ゲームパッド]]<br />
[[ru:Gamepad]]<br />
Joysticks can be a bit of a hassle to get working in Linux. Not because they are poorly supported, but simply because you need to determine which modules to load to get your joystick working, and it's not always very obvious!<br />
<br />
== Joystick Input Systems ==<br />
Linux actually has 2 different input systems for Joysticks. The original 'Joystick' interface and the newer 'evdev' based one.<br />
<br />
{{ic|1=/dev/input/jsX}} maps to the 'Joystick' API interface and {{ic|/dev/input/event*}} maps to the 'evdev' ones (this also includes other input devices such as mice and keyboards). Symbolic links to those devices are also available in {{ic|/dev/input/by-id/}} and {{ic|/dev/input/by-path/}} where the legacy 'Joystick' API has names ending with {{ic|-joystick}} while the 'evdev' have names ending with {{ic|-event-joystick}}.<br />
<br />
Most new games will default to the 'evdev' interface as it gives more detailed information about the buttons and axes available and also adds support for force feedback.<br />
<br />
While SDL1.x defaults to 'evdev' interface you can force it to use the old 'Joystick' API by setting the environment variable {{ic|1=SDL_JOYSTICK_DEVICE=/dev/input/js0}}. This can help many games such as X3. SDL2.x supports only the new 'evdev' interface.<br />
<br />
It's also worth mentioning that there is also a xorg driver {{ic|xf86-input-joystick}}. It just allows you to control the mouse/keyboard in xorg using a joystick, for most people this will be undesirable. Disabling this behaviour is described below in [[#Disable Joystick From Controlling Mouse|Disable Joystick From Controlling Mouse]], in most cases you can just remove this package though.<br />
<br />
== Determining which modules you need ==<br />
<br />
Unless you're using very old joystick that uses gameport or proprietary USB protocol, you will need just the generic USB human interface device (HID) modules.<br />
<br />
For an extensive overview of all joystick related modules in Linux, you will need access to the Linux kernel sources -- specifically the Documentation section. Unfortunately, pacman kernel packages do not include what we need. If you have the kernel sources downloaded, have a look at {{ic|Documentation/input/joystick.txt}}. You can browse the kernel source tree at [https://kernel.org/ kernel.org] by clicking the "browse" (cgit - the git frontend) link for the kernel that you're using, then clicking the "tree" link near the top. Here's a link to the [https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/input/joystick.txt documentation from the latest kernel].<br />
<br />
Some joysticks need specific modules, such as the Microsoft Sidewinder controllers ({{ic|sidewinder}}), or the Logitech digital controllers ({{ic|adi}}). Many older joysticks will work with the simple {{ic|analog}} module. If your joystick is plugging in to a gameport provided by your soundcard, you will need your soundcard drivers loaded - however, some cards, like the Soundblaster Live, have a specific gameport driver ({{ic|emu10k1-gp}}). Older ISA soundcards may need the {{ic|ns558}} module, which is a standard gameport module.<br />
<br />
As you can see, there are many different modules related to getting your joystick working in Linux, so I couldn't possibly cover everything here. Please have a look at the documentation mentioned above for details.<br />
<br />
=== Loading the modules for analogue devices ===<br />
<br />
You need to load a module for your gameport ({{ic|ns558}}, {{ic|emu10k1-gp}}, {{ic|cs461x}}, etc...), a module for your joystick ({{ic|analog}}, {{ic|sidewinder}}, {{ic|adi}}, etc...), and finally the kernel joystick device driver ({{ic|joydev}}). Add these to a new file in {{ic|/etc/modules-load.d/}}, or simply modprobe them. The {{ic|gameport}} module should load automatically, as this is a dependency of the other modules.<br />
<br />
=== USB joysticks ===<br />
<br />
You need to get USB working, and then modprobe your joystick driver, which is {{ic|usbhid}}, as well as {{ic|joydev}}. <br />
If you use a usb mouse or keyboard, {{ic|usbhid}} will be loaded already and you just have to load the {{ic|joydev}} module.<br />
<br />
== Testing Your Configuration ==<br />
<br />
Once the modules are loaded, you should be able to find a new device: {{ic|/dev/input/js0}} and a file ending with {{ic|-event-joystick}} in {{ic|/dev/input/by-id}} directory. You can simply {{ic|cat}} those devices to see if the joystick works - move the stick around, press all the buttons - you should see mojibake printed when you move the sticks or press buttons.<br />
<br />
Both interfaces are also supported in wine and reported as separate devices. You can test them with {{ic|1=wine control joy.cpl}}.<br />
<br />
=== Joystick API ===<br />
There are a lot of applications that can test this old API, {{ic|jstest}} from the {{Pkg|joyutils}} package is the simplest one. If the output is unreadable because the line printed is too long you can also use graphical tools. KDE4 has a built in one in Input Devices panel in System Settings or {{AUR|jstest-gtk-git}} is an alternative.<br />
<br />
Use of {{ic|jstest}} is fairly simple, you just run {{ic|jstest /dev/input/js0}} and it will print a line with state of all the axes (normalised to {-32767,32767}) and buttons.<br />
<br />
After you start {{ic|jstest-gtk}}, it will just show you a list of joysticks available, you just need to select one and press Properties.<br />
<br />
=== evdev API ===<br />
<br />
The new 'evdev' API can be tested using the SDL2 joystick test application or using {{ic|evtest}} from community repository. Install {{AUR|sdl2-jstest-git}} and then run {{ic|sdl2-jstest --test 0}}. Use {{ic|sdl2-jstest --list}} to get IDs of other controllers if you have multiple ones connected.<br />
<br />
To test force feedback on the device, use {{ic|fftest}} from {{ic|linuxconsole}} package:<br />
$ fftest /dev/input/by-id/usb-*event-joystick<br />
<br />
==Setting up deadzones and calibration==<br />
If you want to set up the deadzones (or remove them completely) of your analog input you have to do it separately for the xorg (for mouse and keyboard emulation), Joystick API and evdev API.<br />
<br />
===Wine deadzones===<br />
Add the following registry entry and set it to a string from 0 to 10000 (affects all axes):<br />
HKEY_CURRENT_USER\Software\Wine\DirectInput\DefaultDeadZone<br />
Source: [http://wiki.winehq.org/UsefulRegistryKeys UsefulRegistryKeys]<br />
<br />
===Xorg deadzones===<br />
Add a similar line into your {{ic|/etc/X11/xorg.conf.d/50-joystick.conf}} before the {{ic|EndSection}}:<br />
Option "MapAxis1" "deadzone=1000"<br />
1000 is the default value, but you can set anything between 0 and 30 000. To get the axis number see the "Testing Your Configuration" section of this article.<br />
If you already have an option with a specific axis just type in the {{ic|1=deadzone=value}} at the end of the parameter separated by a space.<br />
<br />
===Joystick API deadzones===<br />
The easiest way is using {{ic|jstest-gtk}} from {{AUR|jstest-gtk-git}}. Select the controller you want to edit, then click the Calibration button at the bottom of the dialog ('''don't''' click Start Calibration there). You can then set the CenterMin and CenterMax values (which control the center deadzone), RangeMin and RangeMax which control the end of throw deadzones. Note that the calibration settings are applied when the application opens the device, so you need to restart your game or test application to see updated calibration settings.<br />
<br />
After you set the deadzones use {{ic|jscal}} to dump the new values into a shell script:<br />
$ jscal -p /dev/input/jsX > jscal.sh # replace X with your joystick's number <br />
$ chmod +x jscal.sh<br />
<br />
Now you need to make a [[udev]] rule (for example {{ic|/etc/udev/rules.d and name it 85-jscal.rules}}) so the script will automatically run when you connect the controller:<br />
SUBSYSTEM=="input", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="c268", ACTION=="add", RUN+="/usr/bin/jscal.sh"<br />
To get the idVendor and idProduct use {{ic|udevadm info --attribute-walk --name /dev/input/jsX}}<br />
<br />
Use the `/dev/input/by-id/*-joystick` device names in case you use multiple controllers.<br />
<br />
===evdev API deadzones===<br />
Currently there is no standalone application that allows changing calibration for {{ic|evdev}} API, but there is {{ic|G25manage}} distributed together with VDrift game that can change the center deadzone.<br />
<br />
The easiest way to get it is to go to VDrift [https://github.com/VDrift/vdrift/tree/master/tools/G25manage github], download all files in the folder and build them using {{ic|make}}.<br />
<br />
After that, you should be able to see your device configuration by using:<br />
$ ./G25manage --showcalibration /dev/input/by-id/usb-*-event-joystick<br />
<br />
To change deadzones of any of the axes, you use the following command:<br />
$ ./G25manage --evdev /dev/input/by-id/usb-*-event-joystick --axis 0 --deadzone 0<br />
<br />
Use udev rules file to set them automatically when the controller is connected.<br />
<br />
Note that inside the kernel, the value is called {{ic|flatness}} and is set using the {{ic|EVIOCSABS}} {{ic|ioctl}}.<br />
<br />
Default configuration will look like similar to this:<br />
{{hc|$ ./G25manage --showcalibration /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick|2= Supported Absolute axes:<br />
Absolute axis 0x00 (0) (X Axis) (min: 0, max: 65535, flatness: 4095 (=6.25%), fuzz: 255)<br />
Absolute axis 0x01 (1) (Y Axis) (min: 0, max: 65535, flatness: 4095 (=6.25%), fuzz: 255)<br />
Absolute axis 0x05 (5) (Z Rate Axis) (min: 0, max: 4095, flatness: 255 (=6.23%), fuzz: 15)<br />
Absolute axis 0x10 (16) (Hat zero, x axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)<br />
Absolute axis 0x11 (17) (Hat zero, y axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)}}<br />
<br />
While a more reasonable setting would be achieved with something like this (repeat for other axes):<br />
{{hc|$ ./G25manage --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick --axis 0 --deadzone 512|2= Event device file: /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick<br />
Axis index to deal with: 0<br />
New dead zone value: 512<br />
Trying to set axis 0 deadzone to: 512<br />
Absolute axis 0x00 (0) (X Axis) Setting deadzone value to : 512<br />
(min: 0, max: 65535, flatness: 512 (=0.78%), fuzz: 255)}}<br />
<br />
===Configuring curves and responsivness===<br />
In case your game requires just limited amount of buttons or has good support for multiple controllers, you may have good results with using {{ic|xboxdrv}} to change response curves of the joystick.<br />
<br />
Below are the setups I use for Saitek X-55 HOTAS:<br />
$ xboxdrv --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Throttle_G0000021-event-joystick \<br />
--evdev-no-grab --evdev-absmap 'ABS_#40=x1,ABS_#41=y1,ABS_X=x2,ABS_Y=y2' --device-name 'Hat and throttle' \<br />
--ui-axismap 'x2^cal:-32000:0:32000=,y2^cal:-32000:0:32000=' --silent<br />
<br />
this maps the EV_ABS event with id of 40 and 41 (use xboxdrv with --evdev-debug to see the events registered), which is the normally inaccessible "mouse pointer" on the throttle, to first gamepad joystick and throttles to second joystick, it also clamps the top and lower ranges as they not always register fully.<br />
<br />
A bit more interesting is the setup for the stick:<br />
$ xboxdrv --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick \<br />
--evdev-no-grab --evdev-absmap 'ABS_X=x1' --evdev-absmap 'ABS_Y=y1' --device-name 'Joystick' \<br />
--ui-axismap 'x1^cal:-32537:-455:32561=,x1^dead:-900:700:1=,x1^resp:-32768:-21845:-2000:0:2000:21485:32767=' \<br />
--ui-axismap 'y1^cal:-32539:-177:32532=,y1^dead:-700:2500:1=,y1^resp:-32768:-21845:-2000:0:2000:21485:32767=' \<br />
--evdev-absmap 'ABS_RZ=x2' --ui-axismap 'x2^cal:-32000:-100:32000,x2^dead:-1500:1000:1=,x2^resp:-32768:-21845:-2000:0:2000:21485:32767=' \<br />
--silent<br />
<br />
this maps the 3 joystick axes to gamepad axes and changes the calibration (min value, centre value, max value), dead zones (negative side, positive side, flag to turn smoothing) and finally change of response curve to a more flat one in the middle.<br />
<br />
You can also modify the responsiveness by setting the 'sen' (sensitivity). Setting it to value of 0 will give you a linear sensitivity, value of -1 will give very insensitive axis while value of 1 will give very sensitive axis. You can use intermediate values to make it less or more sensitive. Internally xboxdrv uses a quadratic formula to calculate the resulting value, so this setting gives a more smooth result than 'resp' shown above.<br />
<br />
Nice thing about xboxdrv is that it exports resulting device as both old Joystick API and new style evdev API so it should be compatible with basically any application.<br />
<br />
== Disable Joystick From Controlling Mouse ==<br />
If you want to play games with your controller, you might want to disable joystick control over mouse cursor. To do this, edit /etc/X11/xorg.conf.d/50-joystick.conf so that it looks like this:<br />
{{hc|/etc/X11/xorg.conf.d/50-joystick.conf |<br />
Section "InputClass"<br />
Identifier "joystick catchall"<br />
MatchIsJoystick "on"<br />
MatchDevicePath "/dev/input/event*"<br />
Driver "joystick"<br />
Option "StartKeysEnabled" "False" #Disable mouse<br />
Option "StartMouseEnabled" "False" #support<br />
EndSection}}<br />
<br />
== Using Joystick to send keystrokes ==<br />
<br />
A couple joystick to keystroke programs exist like {{AUR|rejoystick}}{{Broken package link|{{aur-mirror|rejoystick}}}}, {{AUR|qjoypad}} or {{AUR|antimicro}}, all work well without the need for X.org configuration.<br />
<br />
=== Xorg configuration example ===<br />
<br />
This is a good solution for systems where restarting Xorg is a rare event because it is a static configuration loaded only on X startup. The example runs on a [[Kodi]] media PC, controlled with a Logitech Cordless RumblePad 2. Due to a problem with the d-pad (a.k.a. "hat") being recognized as another axis, [[Joy2key]] was used as a workaround. Since upgrade to Kodi version 11.0 and joy2key 1.6.3-1, this setup no longer worked and the following was created for letting Xorg handle joystick events.<br />
<br />
First, make sure you have {{Pkg|xf86-input-joystick}} installed. Then, create {{ic|/etc/X11/xorg.conf.d/51-joystick.conf}} like so:<br />
{{bc|<nowiki><br />
Section "InputClass"<br />
Identifier "Joystick hat mapping"<br />
Option "StartKeysEnabled" "True"<br />
#MatchIsJoystick "on"<br />
Option "MapAxis5" "keylow=113 keyhigh=114"<br />
Option "MapAxis6" "keylow=111 keyhigh=116"<br />
EndSection<br />
</nowiki>}}<br />
{{Note|The {{ic|MatchIsJoystick "on"}} line does not seem to be required for the setup to work, but you may want to uncomment it.}}<br />
<br />
== Specific devices ==<br />
<br />
While most joysticks, especially USB based ones should just work, some may require (or give better results) if you use alternative drivers. If it doesn't work the first time, do not give up, and read those docs thoroughly!<br />
<br />
=== Dance pads ===<br />
Most dance pads should work. However some pads, especially those used from a video game console via an adapter, have a tendency to map the directional buttons as axis buttons. This prevents hitting left-right or up-down simultaneously. This behavior can be fixed for devices recognized by xpad via a module option:<br />
<br />
# modprobe -r xpad<br />
# modprobe xpad dpad_to_buttons=1<br />
<br />
=== Logitech Thunderpad Digital ===<br />
<br />
Logitech Thunderpad Digital won't show all the buttons if you use the {{ic|analog}} module. Use the device specific {{ic|adi}} module for this controller.<br />
<br />
=== Nintendo Gamecube Controller ===<br />
<br />
Dolphin Emulator has a [https://wiki.dolphin-emu.org/index.php?title=How_to_use_the_Official_GameCube_Controller_Adapter_for_Wii_U_in_Dolphin page on their wiki] that explains how to use the official Nintendo USB adapter with a Gamecube controller. This configuration also works with the Mayflash Controller Adapter if the switch is set to "Wii U".<br />
<br />
By default, the controller will register with [[udev]], but will only be readable by the root user. You can fix this by adding a udev device rule, like the below. <br />
<br />
{{hc<br />
|head=/etc/udev/rules.d/51-gcadapter.rules<br />
|output=<nowiki>SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666"</nowiki><br />
}}<br />
<br />
This only matches the USB device with the specified vendor and product IDs, which match those of the official USB adapter. It sets the permissions of the device file to 0666 so that programs that aren't running as root can read the device's input. <br />
<br />
udev can be reloaded with the new configuration by executing<br />
<br />
# udevadm control --reload-rules<br />
<br />
=== PlayStation 3/4 controller ===<br />
<br />
The DualShock 3, DualShock 4 and Sixaxis controllers work out of the box when plugged in via USB (the PS button will need to be pushed to begin). They can also be used wirelessly via Bluetooth.<br />
<br />
Steam properly recognizes it as a PS3 pad and Big Picture can be launched with the PS button. Big Picture and some games may act as if it was a 360 controller. Gamepad control over mouse is on by default. You may want to turn it off before playing games, see [[#Joystick moving mouse]].<br />
<br />
=====Connecting via Bluetooth=====<br />
<br />
Install the {{Pkg|bluez-plugins}} and {{Pkg|bluez-utils}} packages, which includes the ''sixaxis'' plugin. Then [[start]] {{ic|bluetooth.service}}, plug the controller in via USB, and the plugin should program your PC's bluetooth address into the controller automatically.<br />
<br />
You can now disconnect your controller. The next time you hit the PlayStation button it will connect without asking anything else.<br />
<br />
Remember to disconnect the controller when you are done as the controller will stay on when connected and drain the battery.<br />
<br />
=== Steam Controller ===<br />
<br />
The {{pkg|steam}} package (starting from version 1.0.0.51-1) will recognize the controller and provide keyboard/mouse/gamepad emulation while Steam is running. The in-game Steam overlay needs to be enabled and working in order for gamepad emulation to work. You may need to run {{ic|udevadm trigger}} with root privileges or plug the dongle out and in again, if the controller doesn't work immediately after installing and running steam. If all else fails, try restarting the computer while the dongle is plugged in.<br />
<br />
If you can't get the Steam Controller to work, see [[#Steam Controller Not Pairing]].<br />
<br />
Alternatively you can install {{AUR|python-steamcontroller-git}} to have controller and mouse emulation without Steam.<br />
<br />
==== Wine ====<br />
<br />
{{Accuracy|Binaries from questionable hoster. There is also [https://github.com/x360ce/x360ce x360ce], but it is most likely different project.}}<br />
<br />
{{AUR|python-steamcontroller-git}} can also be used to make the Steam Controller work for games running under Wine. You need to find and download the file {{ic|xbox360cemu.v.3.0.rar}} (e.g. from here: [http://www.2shared.com/file/wcq8xuPf/xbox360cemuv30.html Download Link from 2shared]). Then copy the files {{ic|dinput8.dll}}, {{ic|xbox360cemu.ini}}, {{ic|xinput1_3.dll}} and {{ic|xinput_9_1_0.dll}} to the directory that contains your game executable. Edit {{ic|xbox360cemu.ini}} and only change the following values under {{ic|[PAD1]}} to remap the Steam Controller correctly to a XBox Controller.<br />
<br />
{{hc|xbox360cemu.ini|2= Right Analog X=4<br />
Right Analog Y=-5<br />
A=1<br />
B=2<br />
X=3<br />
Y=4<br />
Back=7<br />
Start=8<br />
Left Thumb=10<br />
Right Thumb=11<br />
Left Trigger=a3<br />
Right Trigger=a6}}<br />
<br />
Now start python-steamcontroller in Xbox360 mode ({{ic|sc-xbox.py start}}). You might also want to copy {{ic|XInputTest.exe}} from {{ic|xbox360cemu.v.3.0.rar}} to the same directory and run it with Wine in order to test if it works. However neither mouse nor keyboard emulation work with this method.<br />
<br />
=== Xbox 360 controller ===<br />
<br />
Both the wired and wireless (with the ''Xbox 360 Wireless Receiver for Windows'') controllers are supported by the {{ic|xpad}} kernel module and should work without additional packages.<br />
<br />
It has been reported that the default xpad driver has some issues with a few newer wired and wireless controllers, such as:<br />
* incorrect button mapping. ([https://github.com/ValveSoftware/steam-for-linux/issues/95#issuecomment-14009081 discussion in Steam bugtracker])<br />
* not-working sync. All four leds keep blinking, but controller works. ([https://bbs.archlinux.org/viewtopic.php?id=156028 discussion in Arch Forum])<br />
<br />
If you experience such issues, you can use either [[#SteamOS xpad]] or [[#xboxdrv]] instead of the default {{ic|xpad}} driver.<br />
<br />
If you wish to use the controller for controlling the mouse, or mapping buttons to keys, etc. you should use the {{Pkg|xf86-input-joystick}} package (configuration help can be found using {{ic|man joystick}}). If the mouse locks itself in a corner, it might help changing the {{ic|MatchDevicePath}} in {{ic|/etc/X11/xorg.conf.d/50-joystick.conf}} from {{ic|/dev/input/event*}} to {{ic|/dev/input/js*}}.<br />
<br />
{{Tip|If you use the [[TLP]] power management tool, you may experience connection issues with your Microsoft wireless adapter (e.g. the indicator LED will go out after the adapter has been connected for a few seconds, and controller connection attempts fail). This is due to TLP's USB autosuspend functionality, and the solution is to add the Microsoft wireless adapter's device ID to this feature's blacklist (USB_BLACKLIST, check [http://linrunner.de/en/tlp/docs/tlp-configuration.html#usb TLP configuration] for more details).}}<br />
<br />
==== SteamOS xpad ====<br />
<br />
If you have issues with the default {{ic|xpad}} kernel module, you can install the SteamOS version. There is still a known issue with compatibility between wireless Xbox360 controllers and games made in GameMaker Studio. If you encounter this problem, the only known workaround is to use xboxdrv. YoYo Games has refused to acknowledge this as a bug with their product and it is unlikely to ever be fixed.<br />
<br />
First make sure you have [[DKMS]] installed and running, then install the modified kernel module {{AUR|steamos-xpad-dkms}}. During the installation you'll see that new xpad kernel module is strapped to your current kernel:<br />
<br />
Creating symlink /var/lib/dkms/steamos-xpad-dkms/0.1/source -&gt;<br />
/usr/src/steamos-xpad-dkms-0.1<br />
<br />
DKMS: add completed.<br />
<br />
Kernel preparation unnecessary for this kernel. Skipping...<br />
<br />
Building module:<br />
cleaning build area....<br />
make KERNELRELEASE=3.12.8-1-ARCH KVERSION=3.12.8-1-ARCH....<br />
cleaning build area....<br />
<br />
Then unload the old xpad module and load new one:<br />
<br />
# rmmod xpad<br />
# modprobe steamos-xpad<br />
<br />
Or just restart your computer.<br />
<br />
==== xboxdrv ====<br />
<br />
xboxdrv is an alternative to {{ic|xpad}} which provides more functionality and might work better with certain controllers. It works in userspace and can be launched as system service. <br />
<br />
Install it with the {{AUR|xboxdrv}} package. Then [[start]]/[[enable]] {{ic|xboxdrv.service}}.<br />
<br />
If you have issues with the controller being recognized but not working in steam games or working but with incorrect mappings, it may be required to modify you config as such:<br />
{{hc<br />
|/etc/default/xboxdrv/|2=<br />
[xboxdrv]<br />
silent = true<br />
device-name = "Xbox 360 Wireless Receiver"<br />
mimic-xpad = true<br />
deadzone = 4000<br />
<br />
[xboxdrv-daemon]<br />
dbus = disabled<br />
}}<br />
<br />
Then [[restart]] {{ic|xboxdrv.service}}.<br />
<br />
===== Multiple controllers =====<br />
<br />
xboxdrv supports a multitude of controllers, but they need to be set up in {{ic|/etc/default/xboxdrv}}. For each extra controller, add an {{ic|1=next-controller = true}} line. For example, when using 4 controllers, add it 3 times:<br />
<br />
{{bc|<nowiki><br />
[xboxdrv]<br />
silent = true<br />
next-controller = true<br />
next-controller = true<br />
next-controller = true<br />
[xboxdrv-daemon]<br />
dbus = disabled<br />
</nowiki>}}<br />
<br />
Then [[restart]] {{ic|xboxdrv.service}}.<br />
<br />
===== Mimic Xbox 360 controller with other controllers =====<br />
<br />
xboxdrv can be used to make any controller register as an Xbox 360 controller with the {{ic|--mimic-xpad}} switch. This may be desirable for games that support Xbox 360 controllers out of the box, but have trouble detecting or working with other gamepads.<br />
<br />
First, you need to find out what each button and axis on the controller is called. You can use {{Pkg|evtest}} for this. Run {{ic|evtest}} and select the device event ID number ({{ic|/dev/input/event*}}) that corresponds to your controller. Press the buttons on the controller and move the axes to read the names of each button and axis.<br />
<br />
Here is an example of the output:<br />
{{bc|<nowiki><br />
<br />
Event: time 1380985017.964843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003<br />
Event: time 1380985017.964843, type 1 (EV_KEY), code 290 (BTN_THUMB2), value 1<br />
Event: time 1380985017.964843, -------------- SYN_REPORT ------------<br />
Event: time 1380985018.076843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003<br />
Event: time 1380985018.076843, type 1 (EV_KEY), code 290 (BTN_THUMB2), value 0<br />
Event: time 1380985018.076843, -------------- SYN_REPORT ------------<br />
Event: time 1380985018.460841, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002<br />
Event: time 1380985018.460841, type 1 (EV_KEY), code 289 (BTN_THUMB), value 1<br />
Event: time 1380985018.460841, -------------- SYN_REPORT ------------<br />
Event: time 1380985018.572835, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002<br />
Event: time 1380985018.572835, type 1 (EV_KEY), code 289 (BTN_THUMB), value 0<br />
Event: time 1380985018.572835, -------------- SYN_REPORT ------------<br />
Event: time 1380985019.980824, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006<br />
Event: time 1380985019.980824, type 1 (EV_KEY), code 293 (BTN_PINKIE), value 1<br />
Event: time 1380985019.980824, -------------- SYN_REPORT ------------<br />
Event: time 1380985020.092835, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006<br />
Event: time 1380985020.092835, type 1 (EV_KEY), code 293 (BTN_PINKIE), value 0<br />
Event: time 1380985020.092835, -------------- SYN_REPORT ------------<br />
Event: time 1380985023.596806, type 3 (EV_ABS), code 3 (ABS_RX), value 18<br />
Event: time 1380985023.596806, -------------- SYN_REPORT ------------<br />
Event: time 1380985023.612811, type 3 (EV_ABS), code 3 (ABS_RX), value 0<br />
Event: time 1380985023.612811, -------------- SYN_REPORT ------------<br />
Event: time 1380985023.708768, type 3 (EV_ABS), code 3 (ABS_RX), value 14<br />
Event: time 1380985023.708768, -------------- SYN_REPORT ------------<br />
Event: time 1380985023.724772, type 3 (EV_ABS), code 3 (ABS_RX), value 128<br />
Event: time 1380985023.724772, -------------- SYN_REPORT ------------<br />
</nowiki>}}<br />
<br />
In this case, {{ic|BTN_THUMB}}, {{ic|BTN_THUMB2}} and {{ic|BTN_PINKIE}} are buttons and {{ic|ABS_RX}} is the X axis of the right analogue stick.<br />
You can now mimic an Xbox 360 controller with the following command:<br />
<br />
$ xboxdrv --evdev /dev/input/event* --evdev-absmap ABS_RX=X2 --evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_PINKIE=rt --mimic-xpad<br />
<br />
The above example is incomplete. It only maps one axis and 3 buttons for demonstration purposes. Use {{ic|xboxdrv --help-button}} to see the names of the Xbox controller buttons and axes and bind them accordingly by expanding the command above. Axes mappings should go after {{ic|--evdev-absmap}} and button mappings follow {{ic|--evdev-keymap}} (comma separated list; no spaces).<br />
<br />
By default, xboxdrv outputs all events to the terminal. You can use this to test that the mappings are correct. Append the {{ic|--silent}} option to keep it quiet.<br />
<br />
======Logitech Dual Action======<br />
<br />
The Logitech Dual Action gamepad has a very similar mapping to the PS2 pad, but some buttons and triggers need to be swapped to mimic the Xbox controller.<br />
<br />
# xboxdrv --evdev /dev/input/event* \<br />
--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \<br />
--axismap -Y1=Y1,-Y2=Y2 \<br />
--evdev-keymap BTN_TRIGGER=x,BTN_TOP=y,BTN_THUMB=a,BTN_THUMB2=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lt,BTN_BASE2=rt,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr \<br />
--mimic-xpad --silent<br />
<br />
======PlayStation 2 controller via USB adapter======<br />
<br />
To fix the button mapping of PS2 dual adapters and mimic the Xbox controller you can run the following command:<br />
<br />
# xboxdrv --evdev /dev/input/event* \<br />
--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \<br />
--axismap -Y1=Y1,-Y2=Y2 \<br />
--evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lb,BTN_BASE2=rb,BTN_TOP2=lt,BTN_PINKIE=rt,BTN_BASE5=tl,BTN_BASE6=tr \<br />
--mimic-xpad --silent<br />
<br />
======PlayStation 3 controller via USB======<br />
<br />
If you own a PS3 controller and can connect with USB, xboxdrv has the mappings built in. Just run the program (and detach the running driver) and it works! <br />
<br />
# xboxdrv --silent --detach-kernel-driver<br />
<br />
======PlayStation 3 controller via Bluetooth======<br />
<br />
With your controller connected via Bluetooth, find the device address with {{ic|bluetoothctl}}. Then create a new udev rule with the following content:<br />
<br />
{{hc|1=/etc/udev/rules.d/99-dualshock.rules|2=<br />
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{uniq}=="<device_addr_you_got_on_pairing>", SYMLINK+="input/dualshock3"<br />
}}<br />
<br />
The address must be in lowercase, like {{ic|06:9a:b4:c8:ef:8b}}.<br />
<br />
Now run xboxdrv over the new device:<br />
<br />
$ xboxdrv --evdev /dev/input/dualshock3 --mimic-xpad<br />
<br />
======PlayStation 4 controller======<br />
<br />
To fix the button mapping of PS4 controller you can use the following command with xboxdrv (or try with the [https://github.com/chrippa/ds4drv ds4drv] program):<br />
<br />
# xboxdrv \<br />
--evdev /dev/input/by-id/usb-Sony_Computer_Entertainment_Wireless_Controller-event-joystick\<br />
--evdev-absmap ABS_X=x1,ABS_Y=y1 \<br />
--evdev-absmap ABS_Z=x2,ABS_RZ=y2 \<br />
--evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \<br />
--evdev-keymap BTN_A=x,BTN_B=a \<br />
--evdev-keymap BTN_C=b,BTN_X=y \<br />
--evdev-keymap BTN_Y=lb,BTN_Z=rb \<br />
--evdev-keymap BTN_TL=lt,BTN_TR=rt \<br />
--evdev-keymap BTN_SELECT=tl,BTN_START=tr \<br />
--evdev-keymap BTN_TL2=back,BTN_TR2=start \<br />
--evdev-keymap BTN_MODE=guide \<br />
--axismap -y1=y1,-y2=y2 \<br />
--mimic-xpad \<br />
--silent<br />
<br />
== Troubleshooting ==<br />
<br />
=== Joystick moving mouse ===<br />
<br />
Sometimes USB joystick can be recognized as HID mouse (only in X, it is still being installed as {{ic|/dev/input/js0}} as well). Known issue is cursor being moved by the joystick, or escaping to en edge of a screen right after plugin. If your application can detect joystick by it self, you can remove xf86-input-joystick package.<br />
<br />
More gentle solution is to [[#Disable Joystick From Controlling Mouse|Disable Joystick From Controlling Mouse]].<br />
<br />
=== Joystick not working in FNA/SDL based games ===<br />
If you are using a generic non-widely used gamepad you may encounter issues getting the gamepad recognized in games based on SDL. Since [https://github.com/flibitijibibo/FNA/commit/e55742cfe7e38b778a21ed8a12cb2f2081490d8d May the 14th 2015], FNA supports dropping a {{ic|gamecontrollerdb.txt }} into the executable folder of the game, for example the [https://github.com/gabomdq/SDL_GameControllerDB SDL_GameControllerDB].<br />
<br />
As an alternative and for older versions of FNA or for SDL you can generate a mapping yourself by downloading the SDL source code via http://libsdl.org/, navigating to {{ic|/test/}}, compile the {{ic|controllermap.c}} program (alternatively install {{AUR|controllermap}}) and run the test. After completing the controllermap test, a guid will be generated that you can put in the {{ic|SDL_GAMECONTROLLERCONFIG}} environment variable which will then be picked up by SDL/FNA games. For example:<br />
<br />
$ export SDL_GAMECONTROLLERCONFIG="030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,"<br />
<br />
=== Joystick not recognized by all programs ===<br />
<br />
Some software, Steam for example, will only recognize the first joystick it encounters. Due to a bug in the driver for Microsoft wireless periphery devices this can in fact be the bluetooth dongle. If you find you have a {{ic|/dev/input/js*}} and {{ic|/dev/input/event*}} belonging to you keyboard's bluetooth transceiver you can get automatically get rid of it by creating according udev rules.<br />
Create a {{ic|/}}:<br />
{{hc|/etc/udev/rules.d/99-btcleanup.rules|<nowiki><br />
ACTION=="add", KERNEL=="js[0-9]*", SUBSYSTEM=="input", KERNELS=="...", ATTRS{bInterfaceSubClass}=="00", ATTRS{bInterfaceProtocol}=="00", ATTRS{bInterfaceNumber}=="02", RUN+="/usr/bin/rm /dev/input/js%n"<br />
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", KERNELS=="...", ATTRS{bInterfaceSubClass}=="00", ATTRS{bInterfaceProtocol}=="00", ATTRS{bInterfaceNumber}=="02", RUN+="/usr/bin/rm /dev/input/event%n"<br />
</nowiki>}}<br />
Correct the {{ic|<nowiki>KERNELS=="..."</nowiki>}} to match your device. The correct value can be found by running<br />
<br />
# udevadm info -an /dev/input/js0<br />
<br />
Assuming the device in question is {{ic|/dev/input/js0}}. After you placed the rule reload the rules with<br />
<br />
# udevadm control --reload<br />
<br />
Then replug the device making you trouble. The joystick and event devices should be gone, although their number will still be reserved. But the files are out of the way.<br />
<br />
=== Steam Controller Not Pairing ===<br />
<br />
If you want your system to be able to recognise Steam controller after hot swapping between wireless and wired connection, and also want system to recognise Steam controller if connected via micro-usb cable while wireless dongle is plugged in, you need to do instructions below. Otherwise, Steam controller will behave just as keyboard/mouse devise after hot swapping or unrecognised at all by steam and games.<br />
<br />
If the Steam Controller will not pair wirelessly but works when wired make you may need to create the following udev rule, suggested by Valve[https://steamcommunity.com/app/353370/discussions/0/490123197956024380/].<br />
<br />
{{ic|/lib/udev/rules.d/99-steam-controller-perms.rules}}<br />
<br />
# This rule is needed for basic functionality of the controller in Steam and keyboard/mouse emulation<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"<br />
<br />
# This rule is necessary for gamepad emulation; make sure you add yourself to 'steamcontroller' group<br />
KERNEL=="uinput", MODE="0660", GROUP="steamcontroller", OPTIONS+="static_node=uinput"<br />
<br />
Create a group of steam controller users.<br />
<br />
# groupadd steamcontroller<br />
<br />
And add your user to that group.<br />
<br />
# gpasswd -a $USER steamcontroller</div>Rakuhttps://wiki.archlinux.org/index.php?title=Talk:Gamepad&diff=449455Talk:Gamepad2016-09-04T22:59:36Z<p>Raku: /* Xbox 360 controllers */ Ask about adding xboxdrv config</p>
<hr />
<div>==Playstation 3 Controllers via Bluetooth==<br />
<br />
when creating the udev rule, what the address is supposed to be is unclear, as one can confuse the address of the bluetooth dongle and ps3 controller, so I feel this should be specified. <br />
<br />
Additionally, simply putting in the bluetooth address for the udev rule for the ps3 controller does not appear to work. --[[User:Ase1590|Ase1590]] ([[User talk:Ase1590|talk]]) 20:21, 16 February 2015 (UTC)<br />
<br />
== Xbox 360 controllers ==<br />
<br />
I own an Xbox 360 wired controller. A year ago I had no success with using only the xpad module and had to use the userspace xboxdrv driver with mixed success.<br />
<br />
I am now pleasantly surprised to see that the Xbox 360 wired controller works with the xpad module only, without any other configuration. In particular, [[Gamepad#Xbox_360_controllers|the issues that we list]], "incorrect button mapping. ([https://github.com/ValveSoftware/steam-for-linux/issues/95#issuecomment-14009081 discussion in Steam bugtracker])" and "not-working sync. All four leds keep blinking, but controller works. ([https://bbs.archlinux.org/viewtopic.php?id=156028 discussion in Arch Forum])", seem to be fixed, at least for a single-controller setup.<br />
<br />
Should we update the text to reflect that? [[User:Suridaj|Suridaj]] ([[User talk:Suridaj|talk]]) 22:52, 6 June 2015 (UTC)<br />
: Sure, just preserve old texts as a "if you encounter problems, you can fix them as follows" [[User:Tomato|Tomato]] ([[User talk:Tomato|talk]]) 07:52, 7 June 2015 (UTC)<br />
<br />
<br />
Recently spent a couple days getting my wireless controller to work, specifically with steam games. It was acting real wonky, but after much searching I found a reddit post with a configuration that worked:<br />
{{hc<br />
|/etc/default/xboxdrv/|2=<br />
[xboxdrv]<br />
silent = true<br />
device-name = "Xbox 360 Wireless Receiver"<br />
mimic-xpad = true<br />
deadzone = 4000<br />
<br />
[xboxdrv-daemon]<br />
dbus = disabled<br />
}}<br />
<br />
Should this be added under the xboxdrv section? [[User:Raku|Raku]] ([[User talk:Raku|talk]]) 22:58, 4 September 2016 (UTC)<br />
<br />
== iPEGA PG-9017S ==<br />
I made a config[https://gist.github.com/NeoTheFox/b3984d3e0a5371618e61] for bluetooth gamepad. This can be used as example. [[User:NeoTheFox|NeoTheFox]] ([[User talk:NeoTheFox|talk]]) 09:39, 11 November 2015 (UTC)<br />
<br />
== Steam controller udev rules ==<br />
<br />
{{Note|Related bug report: {{bug|47330}}}}<br />
<br />
I've just undone [https://wiki.archlinux.org/index.php?title=Gamepad&diff=411356&oldid=411355 these edits] which add different udev rules for the Steam controller. This shouldn't be necessary because it should work with the rules provided by the {{Pkg|steam}} package.<br />
<br />
To the editor: are you absolutely sure they don't work for you? Could you try again by reinstalling the {{Pkg|steam}} package, and making sure the rule is as follows:<br />
<br />
{{hc|/usr/lib/udev/rules.d/80-steam-controller-permission.rules|2=<br />
#USB devices<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0660", TAG+="uaccess"<br />
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"<br />
}}<br />
<br />
Also make sure there are no other rules in either {{ic|/etc/udev/rules.d/}} or {{ic|/usr/lib/udev/rules.d/}} that might conflict with the one above. You might need to restart your computer before it works.<br />
<br />
This rule really should work. It is also used by Ubuntu and other Linux distro's. Please let me know the results.<br />
<br />
-- [[User:Lonaowna|Lonaowna]] ([[User talk:Lonaowna|talk]]) 23:27, 9 December 2015 (UTC)<br />
<br />
: The rule is there in {{ic|/usr/lib/udev/rules.d}}, however it seems some games don't recognize the controller with it. TokiTori 2+ worked before I removed my custom rule (and restarted) now it doesn't get see the controller at all.<br />
<br />
: If I look at /dev/uinput it's {{ic|root:root}} only. Do I need to be in some group for this to work?<br />
<br />
: -- [[User:Almindor|Almindor]] ([[User talk:Almindor|talk]]) 23:27, 10 December 2015 (UTC)<br />
<br />
:: The {{ic|uaccess}} tag should automate this, and give everyone who is locally logged in permission to the controller (similar to how you can run {{ic|poweroff}} as a regular user, when logged in locally, but not when logged in via e.g. SSH).<br />
:: You can see if this works by running {{ic|getfacl /dev/uinput}}: your user should show up with {{ic|rw-}} permissions.<br />
:: It seems to work well on my machine, and all controller-enabled games seem to work. Unfortunately I can't test TokiTori 2+ as I don't have it (and the demo doesn't support Linux for some reason?). Are there any more games you are having issues with?<br />
:: If you're absolutely sure that it doesn't work with the rule provided by the {{Pkg|steam}} package but it does with the other one, we can keep it on this page as a backup, but I rather have everything works out-of-the-box. :)<br />
:: -- [[User:Lonaowna|Lonaowna]] ([[User talk:Lonaowna|talk]]) 12:24, 13 December 2015 (UTC)<br />
<br />
::: I've done some more digging using {{ic|strace}} on Toki Tori and using {{ic|getfacl}}<br />
::: It seems {{ic|getfacl}} gives mostly identical results, only difference is the {{ic|group}} section has no permissions when using the steam package rules only. But my user has {{ic|rw}} in both cases.<br />
::: What is more interesting is that by using {{ic|strace}} I've compared all {{ic|open}} syscalls when running Toki Tori and I found out that {{ic|/dev/js0}} and {{ic|/dev/input21}} are missing when using steam package rules only! I think that's the main issue. <br />
::: NO idea why, however one thing that comes to mind is that my vendorid line in the custom rules has mode {{ic|0666}} with users group, whereas the package has {{ic|0660}} with the {{ic|1=TAG+="uaccess"}}<br />
::: [[User:Almindor|Almindor]] ([[User talk:Almindor|talk]]) 23:51, 14 December 2015 (UTC)<br />
<br />
:::: Tried {{ic|0666}} and it seems to work... But is that the suggested thing to do?<br />
:::: [[User:Tesfabpel|Tesfabpel]] ([[User talk:Tesfabpel|talk]]) 09:09, 15 December 2015 (UTC)</div>Raku