jellyfin / jellyfin-media-player

Jellyfin Desktop Client
GNU General Public License v2.0
3.25k stars 322 forks source link

JMP accepts input from xbox gamepad #325

Open thisisnotmyrealname opened 2 years ago

thisisnotmyrealname commented 2 years ago

2022-10-25 15:54:16 [ INFO ] JS: Received KeepAlive from server. 2022-10-25 15:54:36 [ DEBUG ] InputComponent.cpp @ 160 - Input received: source: "Xbox One S Controller" keycode: "KEY_BUTTON_4" : InputBase::KeyDown 2022-10-25 15:54:36 [ DEBUG ] InputComponent.cpp @ 230 - Emit input action: ("seek_backward") 2022-10-25 15:54:36 [ INFO ] JS: Uncaught TypeError: Cannot read property 'rewind' of null 2022-10-25 15:54:36 [ DEBUG ] InputComponent.cpp @ 160 - Input received: source: "Xbox One S Controller" keycode: "KEY_BUTTON_4" : InputBase::KeyUp 2022-10-25 15:54:40 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 3 191 2022-10-25 15:54:40 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 2 2179 2022-10-25 15:54:40 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 2 2118

Describe the bug Jellyfin Media Player on a fresh install of Ubuntu 22.04.01 64bit will accept input from an Xbox One S Controller even if the "Enable Gamepad" option is UNCHECKED.

To Reproduce

Install Jellyfin Media Player Pair Xbox One S Controller Play media in Jellyfin Try to play a game in Steam

Expected behavior Jellyfin Media Player should ignore input from a gamepad if the "Enable Gamepad" option is unchecked

Desktop (please complete the following information):

Additional context Originally had the flatpak installed, happened there as well. uninstalled flatpak, used the deb, issue persists. Also Does not occur if using the Web player inside of firefox.

Seems to happen only when Steam is open. Otherwise the SDL input is ignored, or maybe steam is loading a module to make the gamepad work.

Workaround Copy xbox-controller-linux.json into the ~/.local/share/jellyfinmediaplayer/inputmaps directory, and map all the controller inputs to nothing.

{
  "name": "Xbox Controller",
  "idmatcher": "Xbox One",
  "mapping": 
  {
    // A
    "KEY_BUTTON_0": "",

    // B
    "KEY_BUTTON_1": {
      "short": "",
      "long": ""
    },

    // X
    "KEY_BUTTON_2": "",

    // Y
    "KEY_BUTTON_3": "",
    "KEY_BUTTON_3": "",

    // LB
    "KEY_BUTTON_4": "",

    // RB
    "KEY_BUTTON_5": "",

    // left thumbstick press
    "KEY_BUTTON_6": "",

    // right thumbstick press
    "KEY_BUTTON_7": "",

    // start
    "KEY_BUTTON_8": "",

    // back
    "KEY_BUTTON_9": "",

    // Windows button
    "KEY_BUTTON_10": {
      "short": "",
      "long": ""
    },

    // D-PAD
    "KEY_BUTTON_11": "",
    "KEY_BUTTON_12": "",
    "KEY_BUTTON_13": "",
    "KEY_BUTTON_14": "",

    // left thumbstick axis
    "KEY_AXIS_0_UP": "",
    "KEY_AXIS_0_DOWN": "",
    "KEY_AXIS_1_UP": "",
    "KEY_AXIS_1_DOWN": "",

    // right thumbstick axis
    "KEY_AXIS_4_UP": "",
    "KEY_AXIS_4_DOWN": "",
    "KEY_AXIS_3_UP": "",
    "KEY_AXIS_3_DOWN": "",

    // left trigger
    "KEY_AXIS_2_UP": "",

    // right trigger
    "KEY_AXIS_5_UP": "",

    // D-Pad with JoyHat events
    "KEY_HAT_DOWN": "",
    "KEY_HAT_UP": "",
    "KEY_HAT_RIGHT": "",
    "KEY_HAT_LEFT": ""

  }
}
iwalton3 commented 1 year ago

The Enable Gamepad option is provided by the web client and only controls gamepad mapping in web browsers. (I believe QT WebEngine also supports some degree of controller binding too, which further complicates these issues.)

I believe you can also disable this by editing the sdlEnabled option in the jellyfinmediaplayer.conf file.

gnometsunami commented 1 year ago

I am also seeing this bug with the linux native app. And I can confirm that editing the conf file successfully disables gamepad input.

If you installed jellyfin using flatpak, the path to the conf file is ~/.var/app/com.github.iwalton3.jellyfin-media-player/data/jellyfinmediaplayer/jellyfinmediaplayer.conf

m-GDEV commented 11 months ago

In case you used a different installation method: https://github.com/jellyfin/jellyfin-media-player#config-file-location

sevenrats commented 11 months ago

any objections to closing this resolved issue?

JeremiahFaust commented 7 months ago

I am also seeing this bug with the linux native app. And I can confirm that editing the conf file successfully disables gamepad input.

If you installed jellyfin using flatpak, the path to the conf file is ~/.var/app/com.github.iwalton3.jellyfin-media-player/data/jellyfinmediaplayer/jellyfinmediaplayer.conf

For the Arch Linux user's like myself who installed the AUR package, the jellyfinmediaplayer.conf can be found here instead: /.local/share/jellyfinmediaplayer/jellyfinmediaplayer.conf