Share

Fuse - the Free Unix Spectrum Emulator

Tracker: Bugs

5 Only one joystick button works in gtk - ID: 2863656
Last Update: Settings changed ( fredm )

I recently bought a joystick and found that only the 10th of the 11 buttons
actually worked. Having checked recent bugs and tried trunk (4094), I think
I know why this problem exists, but not how to fix it.

The event interface should be read in order to make ten of the buttons
work. With fewer than 10, the last one will be the only one working at
present.


Phil Reynolds ( pmrtvcom ) - 2009-09-21 17:13

5

Closed

Fixed

Nobody/Anonymous

None

None

Public


Comments ( 8 )

Date: 2009-10-05 18:14
Sender: pmrtvcom

4095 fixes this.


Date: 2009-10-05 13:08
Sender: fredm

I've checked in what I think the correct fix is under revision 4095, please
add a followup to this issue if I've made a mistake with the checked in
code.


Date: 2009-10-05 13:03
Sender: pmrtvcom

Obviously, meant the right way earlier (very Dvorak typo). I have a fixed
copy of the patch but don't know what to do about uploading it.


Date: 2009-10-05 06:25
Sender: pmrtvcom

Actually, it does work if you take the size_t out of those for loops.
Tested with 8 out of 10 buttons set to "fire", it works, so, with that
minor fix, this may well be the light way to fix it, unless someone knows
different.


Date: 2009-10-05 05:44
Sender: pmrtvcom

Patch does not work. Once patched, the following errors occur on
compiling:

In file included from gtkjoystick.c:40:
../uijoystick.c: In function ‘ui_joystick_init’:
../uijoystick.c:164: error: redeclaration of ‘i’ with no linkage
../uijoystick.c:149: error: previous declaration of ‘i’ was here
../uijoystick.c:164: error: ‘for’ loop initial declaration used
outside C99 mode
../uijoystick.c:165: error: ‘for’ loop initial declaration used
outside C99 mode
../uijoystick.c:149: warning: unused variable ‘j’

Perhaps line 149 is unnecessary - that cancels any errors relating to it -
but the for loop. errors still occur and I don't understand the reason.


Date: 2009-10-05 02:06
Sender: fredm

Could you try the untested patch attached to see if it resolves the issue
for you? I don't have the hardware to test this issue.


Date: 2009-10-04 11:53
Sender: fredm

This makes sense, what is happening is that in the routines for polling for
joystick state, we check the state for all buttons and send a "press" or
"release" event for each depending on whether the button is pressed or not.
If two buttons are mapped to the same action and one is pressed and one is
not, we end up sending a press and release event for the same key at the
same time so it appears not to be pressed. We should keep track of the
state of all buttons and only send events when there is a transition in the
state of a given button off->on or on->off.


Date: 2009-10-04 11:31
Sender: pmrtvcom

It turns out I was wrong about the actual effect. All 10 buttons do work,
but if two of them are bound to the same function in fuse, only the higher
numbered one works... so, still a bug, but workable around.


Attached File ( 1 )

Filename Description Download
poll_joy_button.patch Untested patch Download

Changes ( 9 )

Field Old Value Date By
status_id Open 2009-10-06 11:21 fredm
close_date - 2009-10-06 11:21 fredm
allow_comments 1 2009-10-06 11:21 fredm
status_id Pending 2009-10-05 18:14 pmrtvcom
close_date 2009-10-05 13:08 2009-10-05 18:14 pmrtvcom
status_id Open 2009-10-05 13:08 fredm
close_date - 2009-10-05 13:08 fredm
resolution_id None 2009-10-05 13:08 fredm
File Added 345346: poll_joy_button.patch 2009-10-05 02:05 fredm