Joystick on enbedded linux

hi all:

I configure SDL-1.2.7 with qtopia support and also cross-compiled it using arm-cross-compiler.

I port it to arm-based mobile board. and I write a program to test the joystick on the board.
the program is as below:

    SDL_Joystick *joy;

    if (    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)< 0)
            printf("failed to init SDL !!\n") ;

    i = SDL_JoystickEventState(SDL_ENABLE);
    printf("joystickevent state : %d \n",i);

    //if (SDL_NumJoysticks() > 0)
    {
            joy = SDL_JoystickOpen(0);

            if(joy)
            {
                printf("Opened Joystick 0\n");
                printf("Name: %s\n", SDL_JoystickName(0));
                printf("Number of Axes: %d\n", SDL_JoystickNumAxes(joy));
                printf("Number of Buttons: %d\n", SDL_JoystickNumButtons(joy));
                printf("Number of Balls: %d\n", SDL_JoystickNumBalls(joy));

// SDL_JoystickEventState(SDL_ENABLE);
}
else
printf(“Couldn’t open Joystick 0\n”);

    }

but I can’t get any joystick information event the joysticknum is zero.

what can I get the right joystick information?
thanks in advance

dragon

ps: what is “lowlevel.library” used in SDL_SYS_JoystickInit() mean ?========================================================
AOC???----2004 AOC ???http://design.163.com/aocmonitor/index.html

??? ??? VIP??? ??? http://vip.163.com

??? 25???4??? http://mail.163.com

??? ??? http://popo.163.com

higsn wrote:

ps: what is “lowlevel.library” used in SDL_SYS_JoystickInit() mean ?

lowlevel.library is a library to handle AmigaOS/MorphOS digital/analog
joysticks and joypads, obviously it’s only relevant for the AmigaOS
version of SDL so it seems that the SDL_sysjoystick.c you are using in
your build is the “amiga” subfolder one and not the “dummy” one as it
should be.

Maybe there is a bug in the cross-configure script?

Bye,
Gabry

thank gabry!

To use qtopia support in SDL I use this script to configure my SDL-1.2.7.

NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-video-qtopia --enable-joystick --disable-video-dummy --disable-video-fbcon --disable-video-x11 --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-nasm --prefix=/home/sgj/armsdl --target=arm-unknown-linux-gnu --host=arm-unknown-linux-gnu

Do you mean that I shouldn’t use disable-video-dummy?
if I use the “dummy” one. It just return a zero_value with SDL_joysticknums set by zero. Then I can’t get real joysticknum and thus I can’t open this joystick.

In other word, if I configure SDL with enable-video-dummy. Do joystick_related functions will invoke the right functions in the right subdir ?

thanks once again!> higsn wrote:

ps: what is “lowlevel.library” used in SDL_SYS_JoystickInit() mean ?

lowlevel.library is a library to handle AmigaOS/MorphOS digital/analog
joysticks and joypads, obviously it’s only relevant for the AmigaOS
version of SDL so it seems that the SDL_sysjoystick.c you are using in
your build is the “amiga” subfolder one and not the “dummy” one as it
should be.

Maybe there is a bug in the cross-configure script?

Bye,
Gabry


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

========================================================
AOC???----2004 AOC ???http://design.163.com/aocmonitor/index.html

??? ??? VIP??? ??? http://vip.163.com

??? 25???4??? http://mail.163.com

??? ??? http://popo.163.com