VOGONS


Joystick = No go (Linux)

Topic actions

First post, by TeaRex

User metadata
Rank Member
Rank
Member

Hello,

I'm trying to get an USB joystick working with DOSBox in openSUSE 10.2. It's the retro-style SpeedLink Competion Pro.

The module joydev.ko is loaded, /dev/input/js0 file is there and Linux-native games work with it.

In DOSBox I'm using the following minimal QuickBASIC program to test joystick functionality (but it does not work with games either):

DO
PRINT STICK(0),STICK(1),STRIG(1),STRIG(5)
LOOP WHILE INKEY$=''

This will always print rows of "128 128 0 0" no matter what I do with the stick.

I'm attaching my dosbox.conf here and the strace in the next post. From the strace it seems that dosbox opens the joystick device a few times early on and sends a couple of IOCTLs to it, but then always closes it again right away.

My SDL packages are these:

SDL-devel-1.2.11-22
SDL_perl-1.20.0-395
SDL_net-1.2.5-260
SDL_Pango-0.1.2-10
SDL-1.2.11-22
SDL_mixer-1.2.7-23
SDL_image-1.2.5-24
SDL_ttf-2.0.8-25

and ldd $(which dosbox) gives this:

linux-gate.so.1 => (0xffffe000)
libSDL_sound-1.0.so.1 => /usr/lib/libSDL_sound-1.0.so.1 (0x4f3dc000)
libasound.so.2 => /usr/lib/libasound.so.2 (0xb7e3c000)
libdl.so.2 => /lib/libdl.so.2 (0xb7e38000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7e20000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7d8c000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7d68000)
libz.so.1 => /lib/libz.so.1 (0xb7d55000)
libSDL_net-1.2.so.0 => /usr/lib/libSDL_net-1.2.so.0 (0xb7d50000)
libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0xb7cbb000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7bd6000)
libm.so.6 => /lib/libm.so.6 (0xb7bb0000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7ba4000)
libc.so.6 => /lib/libc.so.6 (0xb7a76000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb7a67000)
libaa.so.1 => /usr/lib/libaa.so.1 (0xb7a4c000)
libslang.so.2 => /usr/lib/libslang.so.2 (0xb7994000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7876000)
libgpm.so.1 => /usr/lib/libgpm.so.1 (0xb786f000)
libmikmod.so.2 => /usr/lib/libmikmod.so.2 (0xb7826000)
libogg.so.0 => /usr/lib/libogg.so.0 (0xb7820000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb77f7000)
libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0xb77ef000)
/lib/ld-linux.so.2 (0xb7f1e000)
libGLcore.so.1 => /usr/X11R6/lib/libGLcore.so.1 (0xb6e56000)
libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0xb6e54000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6e4e000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb6e4a000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb6e02000)

[/code]

Last edited by TeaRex on 2007-08-15, 18:48. Edited 1 time in total.

tearex

Reply 1 of 19, by TeaRex

User metadata
Rank Member
Rank
Member

Here's the strace:

tearex

Reply 2 of 19, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

1) Do you see anything in the DOSBox console about the joystick being recognized? I guess console output is going to stdout and stderr on Linux?

2) Do other SDL-dependent program recognize the joystick?

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 3 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
MiniMax wrote:

1) Do you see anything in the DOSBox console about the joystick being recognized? I guess console output is going to stdout and stderr on Linux?

It says "One joystick reported, initializing with 4axis. Using joystick MOSIC SPEED-LINK Competition Pro with 2 axes, 4 buttons and 0 hat(s)", which is all correct.

EDIT: I should add that setting "2axis" instead of "auto" in dosbox.conf does not help.

2) Do other SDL-dependent program recognize the joystick?

Frozen-Bubble does recognize it, which is SDL based Perl. I don't think I have a binary SDL-based game that supports Joysticks. Do you know one I could test?

tearex

Reply 4 of 19, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Sorry - I don't have, and don't use Linux.

Edit: Some searching and guessing tells me that the SDLMAME thing should do? http://rbelmont.mameworld.info/?page_id=163

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 5 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

can you attach a compiled exe of your sample code ?

Water flows down the stream
How to ask questions the smart way!

Reply 6 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
Qbix wrote:

can you attach a compiled exe of your sample code ?

Sure, here it is.

tearex

Reply 7 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
MiniMax wrote:

Some searching and guessing tells me that the SDLMAME thing should do?

Thanks for your help! I'll try setting that up when I find some time for it. Might be the week-end.

tearex

Reply 8 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Works fine here
except pressing a button generates -1 instead of 1

I'm using linux kernel version 2.6.22.1
sdl 1.2.11

Could you try the cvs of dosbox ?

Water flows down the stream
How to ask questions the smart way!

Reply 9 of 19, by TeaRex

User metadata
Rank Member
Rank
Member

Well, it's BASIC, so TRUE is supposed to be represented as -1 (all bits set).

I'm using kernel 2.6.18.8 and SDL 1.2.11

And I'm running the newest CVS of DOSBox (without any patches), compiled on my own machine yesterday.

Maybe I could try running an official release instead? I'll see if that helps.

Thanks for your help by the way!

tearex

Reply 10 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

try the following:
include/video.h
#define REDUCE_JOYSTICK_POLLING
remove that line and recompile.

Water flows down the stream
How to ask questions the smart way!

Reply 11 of 19, by TeaRex

User metadata
Rank Member
Rank
Member

I did remove that #define, then I got an error about "numsticks" being undefined in sdl_mapper.cpp, after I fixed this by commenting out "if (numsticks)" (only the if, not the "then" part) it is unfortunately still not working.

However, the strace now shows that /dev/input/js0 is being kept open, and bytes are regularly being read from it, which looks better than before.

When I get around to it I'll try recompiling DOSBox with a pristine SDL-1.2 built from source, I wouldn't be surprised if SuSE has botched their version in some way.

tearex

Reply 12 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
TeaRex wrote:

When I get around to it I'll try recompiling DOSBox with a pristine SDL-1.2 built from source.

Did this now, unfortunately still no improvement.

I'll do some more debugging when I have a bit more time.

tearex

Reply 13 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Please try it with the 0.70 release sources as well.
I can post some locations where to put LOG_MSGs if you want.

Reply 14 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
wd wrote:

Please try it with the 0.70 release sources as well.

I tried both 0.70 and 0.71, no improvement. In 0.65 it does work however. Time for a regression hunt in between 0.65 and 0.70 I guess... I don't really have time for this now, as I'm going on vacation tomorrow, but I can try the week after next.

I can post some locations where to put LOG_MSGs if you want.

Might be a good idea.

tearex

Reply 15 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

0.65 polls the joystick using the SDL event loop (that is very often),
0.70 doesn't but directly polls the SDL joystick in larger intervals.

In sdlmain.cpp, GFX_Events() there's the start of the polling, check
that it reaches the block with SDL_JoystickUpdate and that this
function itself is called, too.

In sdl_mapper.cpp, assure that UpdateJoystick() is called (there are
four implementations for the various joysticktype= settings, just one
will be called). See if ActivateJoystickBoundEvents() is called and if
it reaches the SDL_ functions like SDL_JoystickGetButton().

Reply 16 of 19, by TeaRex

User metadata
Rank Member
Rank
Member

It seems like all of the things you mentioned do indeed get called (except SDL_JoystickGetHats, since my stick has no hats).

Strange...

tearex

Reply 17 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Ok, try logging the output of the calls to SDL functions like SDL_JoystickGetButton()
and see if they report the respective state correctly. If they don't then
something with the SDL installation/interfacing is off, if they ARE fine then
something in the mapper code doesn't forward them (in this case be sure
there's no mapper.txt around and play a bit with the mapper, like mapping
one of the physical joystick buttons to produce some letters).

Reply 18 of 19, by TeaRex

User metadata
Rank Member
Rank
Member
wd wrote:

be sure there's no mapper.txt around

😊

There was one, probably very old, and it was the culprit. d'oh!

Thanks for everybody's help!!

tearex

Reply 19 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Hehe saves some debugging then 😉

Thanks for looking into it though!