Mercurial > sdl-ios-xcode
comparison src/joystick/linux/SDL_sysjoystick.c @ 872:e7be95d758e8
Date: Fri, 05 Mar 2004 16:08:01 +0000
From: Alan Swanson
Subject: Re: [SDL] Fatal signal when initiaize with USB joystick on 2.6.2 kern
On Fri, 2004-03-05 at 15:09, Sam Lantinga wrote:
> > Fred, how does the attached patch work for you? Do all your axes work?
>
> I think you meant the two lines to be reversed.
> I checked a more robust version of this into CVS. Fred, can you see if
> it works?
You've misread the code. :-/
For coef[0] and coef[1], it is (values[2]+values[1]) / 2 and then add
or subtract values[4] to the answer.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 06 Mar 2004 02:58:06 +0000 |
parents | 9cc9e2462d9a |
children | dc29e5907694 |
comparison
equal
deleted
inserted
replaced
871:9cc9e2462d9a | 872:e7be95d758e8 |
---|---|
434 joystick->hwdata->abs_map[i] = joystick->naxes; | 434 joystick->hwdata->abs_map[i] = joystick->naxes; |
435 if ( values[1] == values[2] ) { | 435 if ( values[1] == values[2] ) { |
436 joystick->hwdata->abs_correct[i].used = 0; | 436 joystick->hwdata->abs_correct[i].used = 0; |
437 } else { | 437 } else { |
438 joystick->hwdata->abs_correct[i].used = 1; | 438 joystick->hwdata->abs_correct[i].used = 1; |
439 t = (2 - values[4]); | 439 joystick->hwdata->abs_correct[i].coef[0] = |
440 if ( t != 0 ) { | 440 (values[2] + values[1]) / 2 - values[4]; |
441 joystick->hwdata->abs_correct[i].coef[0] = (values[2] + values[1]) / t; | 441 joystick->hwdata->abs_correct[i].coef[1] = |
442 } | 442 (values[2] + values[1]) / 2 + values[4]; |
443 t = (2 + values[4]); | |
444 if ( t != 0 ) { | |
445 joystick->hwdata->abs_correct[i].coef[1] = (values[2] + values[1]) / t; | |
446 } | |
447 t = ((values[2] - values[1]) / 2 - 2 * values[4]); | 443 t = ((values[2] - values[1]) / 2 - 2 * values[4]); |
448 if ( t != 0 ) { | 444 if ( t != 0 ) { |
449 joystick->hwdata->abs_correct[i].coef[2] = (1 << 29) / t; | 445 joystick->hwdata->abs_correct[i].coef[2] = (1 << 29) / t; |
446 } else { | |
447 joystick->hwdata->abs_correct[i].coef[2] = 0; | |
450 } | 448 } |
451 } | 449 } |
452 ++joystick->naxes; | 450 ++joystick->naxes; |
453 } | 451 } |
454 } | 452 } |