Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: initially connected joysticks may not be detected #1572

Closed
alemart opened this issue Aug 11, 2024 · 0 comments · Fixed by #1573
Closed

Linux: initially connected joysticks may not be detected #1572

alemart opened this issue Aug 11, 2024 · 0 comments · Fixed by #1573

Comments

@alemart
Copy link
Contributor

alemart commented Aug 11, 2024

On Linux, Allegro may not detect initially connected joysticks if al_install_joystick() is called after changing the filesystem interface.

Example

#include <stdio.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_physfs.h>
#include <physfs.h>

int main(int argc, char **argv)
{
    al_init();
    PHYSFS_init(argv[0]);

    al_set_physfs_file_interface(); // comment this line
    al_install_joystick();

    int num_joysticks = al_get_num_joysticks();
    printf("num_joysticks: %d\n", num_joysticks);

    PHYSFS_deinit();
    return 0;
}

Actual output (start the app with a connected joystick)

num_joysticks: 0

Expected output

num_joysticks: 1
alemart added a commit to alemart/allegro5 that referenced this issue Aug 11, 2024
Make sure that we're using the stdio filesystem when scanning /dev/input.

Fixes liballeg#1572.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant