diddlesnaps / supertuxkart

MIT License
11 stars 6 forks source link

Missing permission to access gamepad #16

Closed janstarke closed 1 year ago

janstarke commented 3 years ago

Description

When trying to run STK in Raspberry OS, my game conrollers are not detected by STK. When I run STK, I got the following error message:

InputManager: Failed to init SDL game controller: Could not initialize UDEV

Because I was not sure if something is wrong with my system configuration, I tried to access the controllers via SDL using a simple python script, which works without problems. So, I think there may be a problem with STK itself.

Steps to reproduce

# installation
sudo apt update
sudo apt install snapd
sudo reboot
sudo snap install supertuxkart

# run
supertuxkart

When runnning, no controllers are displayed in the controls list. Also, the error message above is displayed in the console.

Configuration

STK release version: 1.2

STK Source (PPA, distribution package, official binary, etc.): snapcraft.io

System: Linux raspberrypi 5.4.79-v7l+ #1373 SMP armv7l GNU/Linux

Graphics card: VideoCore VI

CPU: BCM2711

Gamepads/keyboards models if related to the issue: Microsoft Xbox 360 Controller, nacon PC Gaming Controlller BB5022Gry

Additional information

stdout.log:

[info   ] [FileManager]: Data files will be fetched from: '/snap/supertuxkart/487/usr/share/supertuxkart/data/'
[info   ] [FileManager]: User directory is '/home/pi/snap/supertuxkart/487/.config/supertuxkart/config-0.10/'.
[info   ] [FileManager]: Addons files will be stored in '/home/pi/snap/supertuxkart/487/.local/share/supertuxkart/addons/'.
[info   ] [FileManager]: Screenshots will be stored in '/home/pi/snap/supertuxkart/487/.local/share/supertuxkart/screenshots/'.
[info   ] [FileManager]: User-defined grand prix will be stored in '/home/pi/snap/supertuxkart/487/.local/share/supertuxkart/grandprix/'.
[info   ] [FileManager]: Asset 0 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/challenges/'.
[info   ] [FileManager]: Asset 1 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/gfx/'.
[info   ] [FileManager]: Asset 2 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/grandprix/'.
[info   ] [FileManager]: Asset 3 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/gui/icons/'.
[info   ] [FileManager]: Asset 4 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/gui/screens/'.
[info   ] [FileManager]: Asset 5 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/gui/dialogs/'.
[info   ] [FileManager]: Asset 6 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/replay/'.
[info   ] [FileManager]: Asset 7 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/'.
[info   ] [FileManager]: Asset 8 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/skins/'.
[info   ] [FileManager]: Asset 9 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/ttf/'.
[info   ] [FileManager]: Asset 10 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/po/'.
[info   ] [FileManager]: Asset 11 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/library/'.
[info   ] [FileManager]: Asset 12 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/models/'.
[info   ] [FileManager]: Asset 13 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/music/'.
[info   ] [FileManager]: Asset 14 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/sfx/'.
[info   ] [FileManager]: Asset 15 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/textures/'.
[info   ] [FileManager]: Asset 16 will be loaded from '/snap/supertuxkart/487/usr/share/supertuxkart/data/tracks/'.
[verbose  ] translation: Env var LANGUAGE = 'de_DE.UTF-8'.
[verbose  ] translation: Language 'German (Germany)'.
[info   ] tinygettext: Adding language fallback de

[info   ] IrrDriver: OpenGL version: 3.1
[info   ] IrrDriver: OpenGL vendor: Broadcom
[info   ] IrrDriver: OpenGL renderer: V3D 4.2
[info   ] IrrDriver: OpenGL version string: OpenGL ES 3.1 Mesa 20.0.8
[info   ] GLDriver: Explicit Attrib Location Present
[info   ] GLDriver: ARB Uniform Buffer Object Present
[info   ] GLDriver: EXT texture format BGRA8888 Present
[info   ] GLDriver: EXT Color Buffer Float Present
[info   ] GLDriver: EXT Texture Compression S3TC Present
[info   ] GLDriver: EXT Texture Compression S3TC sRGB Present
[info   ] SharedGPUObjects: Hardware Skinning enabled, method: 1024 (max bones) * 16 RGBA float texture
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/screenquad.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/motion_blur.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/lightning.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/primitive2dlist.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/transparent.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/texturedquad.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/uniformcolortexturedquad.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/texturedquad.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/coloredquad.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/coloredquad.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/colortexturedquad.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/colortexturedquad.frag
[info   ] irr_driver: GLSL supported.
[error  ] InputManager: Failed to init SDL game controller: Could not initialize UDEV
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_pass.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_solid.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_skinning.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_alpha_test.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_decal.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_grass_pass.vert
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_grass.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_transparent.frag
[info   ] ShaderFilesManager: Compiling shader: /snap/supertuxkart/487/usr/share/supertuxkart/data/shaders/sp_ghost.frag
[info   ] HTTPRequest: Downloading https://online.supertuxkart.net/dl/xml/online_news.xml
[info   ] addons: Downloading updated addons.xml.
[info   ] HTTPRequest: Downloading https://online.supertuxkart.net/dl/xml/online_assets.xml
[info   ] GrandPrixManager: Loading Grand Prix files from /snap/supertuxkart/487/usr/share/supertuxkart/data/grandprix/
[info   ] GrandPrixManager: Loading Grand Prix files from /home/pi/snap/supertuxkart/487/.local/share/supertuxkart/grandprix/
[warn   ] SPMeshBuffer: kartDirt shader is missing, fallback to solid
[warn   ] SPMeshBuffer: kartDirt shader is missing, fallback to solid
[warn   ] SPMeshBuffer: kartDirt shader is missing, fallback to solid
[warn   ] SPMeshBuffer: kartDirt shader is missing, fallback to solid
[warn   ] SPMeshBuffer: kartDirt shader is missing, fallback to solid
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.
[info   ] Singleton: Destroyed singleton.

input.xml:

<input version="1">

<!--
Event 1 : Keyboard button press
    'id' indicates which button, as defined by irrlicht's EKEY_CODE enum
    'character' contains the associated unicode character.
        Only used as fallback when displaying special characters in the UI.
Event 2 : Gamepad stick motion
    'id' indicates which stick, starting from 0
    'direction' 0 means negative, 1 means positive
Event 3 : Gamepad button press
    'id' indicates which button, starting from 0
-->

<keyboard enabled="true" configName="">
     <action name="steerLeft" event="1" id="37" character="48" />
    <action name="steerRight" event="1" id="39" character="48" />
    <action name="accel" event="1" id="38" character="48" />
    <action name="brake" event="1" id="40" character="48" />
    <action name="nitro" event="1" id="78" character="48" />
    <action name="drift" event="1" id="86" character="48" />
    <action name="rescue" event="1" id="8" character="48" />
    <action name="fire" event="1" id="32" character="48" />
    <action name="lookBack" event="1" id="66" character="48" />
    <action name="pauserace" event="1" id="27" character="48" />
    <action name="menuUp" event="1" id="38" character="48" />
    <action name="menuDown" event="1" id="40" character="48" />
    <action name="menuLeft" event="1" id="37" character="48" />
    <action name="menuRight" event="1" id="39" character="48" />
    <action name="menuSelect" event="1" id="13" character="48" />
    <action name="menuCancel" event="1" id="27" character="48" />
</keyboard>

</input>

Error message:

InputManager: Failed to init SDL game controller: Could not initialize UDEV

Python script used to test my SDL config:

import sys
import ctypes
from sdl2 import *

def main():
    error = SDL_Init(SDL_INIT_GAMECONTROLLER)
    if (error != 0):
        print("Unable to initialize SDL: {0}".format(SDL_GetError()))
        SDL_Quit()
        return error
    else:
        print("successfully initialized SDL")

    for i in range(0, SDL_NumJoysticks()):
        if SDL_IsGameController(i):
            controller = SDL_GameControllerOpen(i)
            if controller:
                name = SDL_GameControllerNameForIndex(i)
                print("successfully opened controller '{0}'".format(name.decode('ascii')))
                SDL_GameControllerClose(controller)
            else:
                print("Unable to open controller: {0}".format(SDL_GetError()))
                SDL_Quit()
                return error

    SDL_Quit()
    return 0

if __name__ == "__main__":
    sys.exit(main())

Output:

successfully initialized SDL
successfully opened controller 'X360 Controller'
successfully opened controller 'X360 Controller'
janstarke commented 3 years ago

I already added a custom udev rule:

SUBSYSTEM=="input", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", KERNEL=="event*", ENV{ID_INPUT_JOYSTICK}="1"

to make sure that my gamepads are detected as joysticks. But this didn't help :-(

qwertychouskie commented 1 year ago

Is this still an issue with the latest Snap package (1.4)?

janstarke commented 1 year ago

I'm not able to test this because I don't have access to this computer anymore :-(