Commit graph

112 commits

Author SHA1 Message Date
Sam Lantinga
968ccf93b1 Fixed iOS joystick support for new API 2012-11-26 21:11:28 -08:00
Sam Lantinga
3765f3223a Fixed joystick attached API call on Linux 2012-11-26 17:31:49 -08:00
Sam Lantinga
34b88dfaae Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds 2012-11-26 16:37:54 -08:00
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Ryan C. Gordon
8912814135 Removed some unused variables that gcc 4.6.1 complains about. 2012-08-09 14:14:41 -04:00
Ryan C. Gordon
110c52e2b4 Fix from 1.2 branch: ignore bogus Linux evdev joystick axes. 2012-06-03 05:05:34 -04:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Ryan C. Gordon
c4348f44f7 Linux: Search a smaller set of potential joystick axes.
Newer kernels seem to report bogus axes in the higher ranges, for example
 with a standard PlayStation 3 controller plugged in via USB.
2011-07-13 17:38:09 -07:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
c2204a539c Fixed bug #1121 (More than one device through SDL_JOYSTICK_DEVICE)
Chusslove Illich      2011-02-13 04:30:28 PST

Currently SDL_JOYSTICK_DEVICE environment variable can be used to add
exactly one topmost device. I think it would be nice if one could also set
several devices (e.g. a stick and a throttle) in this way, as a colon-
separated list. The attached patch implements this
2011-02-16 04:51:13 -08:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
b33881a48e Fixed compile error 2011-01-24 15:10:16 -08:00
Sam Lantinga
c330005880 Fixed bug #1080
Markus Rathgeb      2011-01-23 14:34:23 PST

With kernel 2.6.31 the struct input_absinfo defined in linux/input.h changed.
A field "__s32 resolution" was added at the end of the struct.

Because the macro EVIOCGABS(abs) is using the struct input_absinfo, it would be
better (IMHO) to change the declaration of variable values to
"int values[sizeof(struct input_absinfo) / sizeof(int)];" or using "struct
input_absinfo" directly.
2011-01-24 14:36:12 -08:00
Sam Lantinga
4d3df8b3e3 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404453
2010-01-24 21:10:53 +00:00
Sam Lantinga
a9012609d3 Fixed crash in joystick handling code. Newer 2.6 kernels add an additional 'resolution' field to input_absinfo. Note that we don't use that structure since we want to have enough space for the values even when building with an older kernel.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404339
2009-12-17 07:22:48 +00:00
Sam Lantinga
410baa467e Fixed bug #853
Ludwig Nussel      2009-10-18 05:34:18 PDT

src/joystick/linux/SDL_sysjoystick.c has some problems:

- test_bit() might break with strict aliasing
- test_bit() assumes array is Uint32 but its actually "unsigned long"
  on 64bit systems sizeof(long) != sizeof(Uint32).
- the keybit array is too small
- the arrays are unitialized so the number of
  detected buttons is quite random

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404108
2009-10-18 16:14:35 +00:00
Sam Lantinga
efc7893227 Temporary band-aid for bug #575
It looks like newer kernels do the logical device mapping in the driver,
so this code crashes.  I don't have one of these nor do I have remote
access to debug this, so I'm disabling the logical mapping for now.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403937
2009-09-29 00:42:21 +00:00
Sam Lantinga
5c172c5af8 Fixed type size for test_bit()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403731
2009-08-02 20:45:11 +00:00
Sam Lantinga
17406a3e50 Fixed potential double-free crash
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403555
2009-03-06 05:53:33 +00:00
Edgar Simo
dd682a6489 Fixed haptic subsystem on linux 2.6.28 by lowering the EV_IsJoystick check (seems like some stuff was changed). Shouldn't break anything with earlier versions. Might need to be more robust if false positives show up.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403545
2009-02-21 18:02:55 +00:00
Couriersud
3e968cec07 Fix a 64bit issue in linux/SDL_sysjoystick (int != long on 64bit)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403484
2009-01-11 23:39:11 +00:00
Sam Lantinga
d123950aa3 Reverted Bob's indent checkin
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403475
2009-01-10 21:50:26 +00:00
Bob Pendleton
44fa7675c8 I ran a global "make indent" it modified the following files.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403473
2009-01-09 20:43:30 +00:00
Sam Lantinga
0c30a927ed Updated copyright date
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403321
2008-12-08 00:27:32 +00:00
Sam Lantinga
ede44c4b85 Final merge of Google Summer of Code 2008 work...
Port SDL 1.3 to the Nintendo DS
by Darren Alton, mentored by Sam Lantinga

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403188
2008-08-27 15:10:03 +00:00
Sam Lantinga
4fd9c25fe6 Final merge of Google Summer of Code 2008 work...
Force Feedback for SDL
by Edgar Simo, mentored by Ryan C. Gordon

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403159
2008-08-25 09:55:03 +00:00
Sam Lantinga
42495af337 Fixed bug #497
Check all joysticks instead of stopping if one has been removed.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402670
2007-12-29 06:17:31 +00:00
Sam Lantinga
554147b6c7 make indent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402345
2007-06-14 13:21:29 +00:00
Ryan C. Gordon
dd603b02a7 Added id of another buggy Microsoft SideWinder to the Linux joystick driver.
Fixes Bugzilla #395.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402279
2007-02-20 22:54:25 +00:00
Sam Lantinga
0f030a1802 SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401938
2006-07-10 21:04:37 +00:00
Sam Lantinga
6eed3898de Date: Thu, 11 May 2006 19:08:05 -0400
From: Mike Frysinger
Subject: [SDL] [patch] remove limits.h hack from linux joystick code

there is a small hack in the current linux joystick code to work around broken
cross-compilers by including more than one limits.h ... at the very least,
this is not arm-specific by any means

i'm of the opinion that libsdl should not contain such things ... people
should be fixing their cross-compilers, not bloating other's source trees

patch attached to clean the cruft
-mike

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401782
2006-05-11 23:32:11 +00:00
Sam Lantinga
27fdaa8880 SDL_sysjoystick.c:983: warning: 'return' with a value, in function returning void
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401710
2006-05-01 06:40:00 +00:00
Sam Lantinga
2072cdd857 Make sure code is only compiled if the appropriate subsystem is enabled
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401642
2006-04-14 04:46:47 +00:00
Sam Lantinga
9b2bff0381 Fixed bug #4
[Note: I'm applying this patch since it's a cleaner version of what's already implemented, and supports this controller on older kernels.  I'll ask to make sure this doesn't break on the new kernels where it's no longer necessary]

Date: Mon, 21 Mar 2005 09:41:11 -0500
From: Chris Nelson
Subject: SDL Patch

Hey, Ryan.

I submitted the following patch about a year ago. It's just a simple
patch for the linux port, to make multiple joysticks each appear to SDL
as their own device, if they are on the same USB port (specifically,
these guys
<http://www.consoleplus.co.uk/product_info.php?pName=super-joybox-5-quad-joypad-converter>,

which allow 4 Playstation2 controllers to be accessed via a single USB
port). Without this patch, SDL pretty much drops the ball, and reports
that there are 4 joysticks available when less than that number  are
plugged in.

My work built upon the work of another person with the same device. When
I submitted the patch to the list, he tested it, but it didn't work for
him, so the patch was never accepted. Maybe about 3 times in the past
year, I've tried to email the guy, to see if he couldn't run my new
version, complete with debug code to diagnose the problem he was having.
He never got back  to me.

So, I'm attaching the patch. I wish I knew why it didn't work for him,
but I've been using it for the last year with no problems. Let me know
if you need any more information, or have any ideas as to how I could
test it. I'd like to see it in the tree, but I want to make sure it works.

-Chris

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401555
2006-03-19 06:31:34 +00:00
Sam Lantinga
c36118165e Use consistent identifiers for the various platforms we support.
Make sure every source file includes SDL_config.h, so the proper system
headers are chosen.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401406
2006-02-21 08:46:50 +00:00
Sam Lantinga
1da8cb0143 Use only safe string functions
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401383
2006-02-19 23:46:34 +00:00
Sam Lantinga
d3805eef09 New configure-based build system. Still work in progress, but much improved
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401365
2006-02-16 10:11:48 +00:00
Sam Lantinga
684909fae2 More header massaging... works great on Windows. ;-)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401362
2006-02-10 06:48:43 +00:00
Sam Lantinga
09cd73f1b5 Removed uses of stdlib.h and string.h
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401342
2006-02-07 09:29:18 +00:00
Sam Lantinga
5d53175e4d Use SDL_ prefixed versions of C library functions.
FIXME:
Change #include <stdlib.h> to #include "SDL_stdlib.h"
Change #include <string.h> to #include "SDL_string.h"
Make sure nothing else broke because of this...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401340
2006-02-07 06:59:48 +00:00
Sam Lantinga
eea4857268 Updated copyright information and removed rcs id lines (problematic in branch merges)
I batch edited these files, so please let me know if I've accidentally removed anybody's
credit here.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401315
2006-02-01 06:32:25 +00:00
Sam Lantinga
1310074b9a Reverted in favor of this one:
https://bugzilla.libsdl.org/attachment.cgi?id=3

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401308
2006-01-31 18:08:33 +00:00
Sam Lantinga
dd7245a17c Date: Sat, 14 Jan 2006 15:16:01 -0500
From: Andrew Fuller
Subject: [SDL] [PATCH] ML-8866 PS2->USB converter

This converter seems to go by several names --  Super Dual Box, Dual
USB Joypad, and who knows what else.  Also branded differently with
different colour cases, etc.  But it seems to all be the same
internals.  It is a common converter used for StepMania, with several
posts Googleable trying to make it work in Linux.  I got mine
yesterday and wanted to play stepmania, so I went ahead and made a
crude patch for libsdl to split this baby into two logical joysticks.

A couple notes about the patch:

This patch works well for two dance mats hooked up and playing
stepmania, however the mapping of the other buttons may be off.  I
have no joystick which uses all the buttons the converter reports, so
I have no way of testing them.

The name I used 0925:8866 which is the USB ID, and what SDLjoytest-GL
reported is the name, even though lsusb shows Wisegroup, Ltd MP-8866
Dual USB Joypad, and the existing virtual joystick mapping uses the
Wisegroup... name.  Not sure why the discrepency.

I'm not subscribed to this mailing list, so please CC me on any
comments to this.

-Andrew

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401305
2006-01-31 14:59:43 +00:00
Sam Lantinga
33f5989f5a Fixed to match the docs
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401278
2006-01-27 06:36:33 +00:00
Sam Lantinga
31f22de807 Backing out new changes, at Chris Nelson's request.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40954
2004-09-11 17:48:41 +00:00
Sam Lantinga
a69bbd4764 Date: Wed, 23 Jun 2004 17:05:33 -0400
From: Chris Nelson
Subject: [SDL] [Patch] WiseGroup MP-8800 / MP-8866 (PS2 Joystick)

In the current cvs version, SDL doesn't handle these Playstation2
controller => USB adapters correctly, in linux.

It will always assume that the maximum number of joysticks (2 in the
case of the MP-8866, 4 in the case of the 8800) are plugged in. This is
bad not only because it allows SDL to exaggerate the number of logical
joysticks, but primarily because the joystick axes are mapped
incorrectly, all over the place, such that the devices are effectively
unusable unless you have the maximum number of joysticks plugged in.

My changes to src/joystick/linux/SDL_sysjoystick.c build on another's
previous work (which was a special case for this very joystick,
actually), and fix both of these problems, as well as making the current
code a little more general, to allow for others to more easily drop in
code for quirky joysticks such as these.

I've tested this code under 2.6.7 as well as 2.4.24... Both work as
advertised (provided you load the JOYDEV linux code as a module,
otherwise they won't work at all, new code or old, but that's another
issue entirely).

Though this sounds horribly formal, you have my permission to distribute
all of my work on this issue under the LGPL. So there.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40915
2004-07-25 18:31:50 +00:00
Sam Lantinga
77e3c78bf3 Date: Tue, 16 Mar 2004 12:40:33 +0000
From: Alan Swanson
Subject: [SDL] [PATCH] Linux joystick evdev axis count fix

The event device configuration under Linux does not check the returned
ioctl value when reading the axis information. This means extra
undefined axes are returned.

Note, in EV_HandleEvents, the default for case EV_ABS is to return any
axis information which is fine as we have already checked for all valid
absolute axes. No new axes should be returned after opening the device.

(Unless, of course, the evdev allows closing and reassigning a new
device while in use and I can't believe that happens.)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40897
2004-05-16 22:48:06 +00:00
Sam Lantinga
01baa89827 Date: Sun, 18 Apr 2004 16:09:53 -0400 (EDT)
From: David MacCormack
Subject: [SDL] Linux joystick patch

I recently got myself a PS2 -> USB converter (a super joybox 5).  It
accepts 4 PSX/PS2 controllers.  It's implemented as a HID, which is nice
because it doesn't require its own driver, but the problem is that it's
implemented as a *single* HID -- that is, it shows up as a single
joystick with 19 axes, 4 hats, and 48 buttons.  This poses a problem for a
number of apps which use SDL (stella, fce ultra, zsnes, to name a few) and
see only a single (physical) joystick even though there are really 4
(logical) joysticks.  There are a number of these types of devices on the
market, and I've seen others post messages (in the zsnes forum, for
example) with the same problem, so I came up with what I think is a pretty
generic solution.

I patched src/joystick/linux/SDL_sysjoystic.c to include support for
logical joysticks; basically, it's a static array and supporting functions
that map a single physical joystick to multiple logical joysticks.  The
attached patch has the new code.  It's wrapped inside #ifndef
statements so that you can get the old behavior if you want.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40893
2004-05-16 18:46:24 +00:00
Sam Lantinga
561b81add3 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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40873
2004-03-06 02:58:06 +00:00
Sam Lantinga
ea8c53b7fe Avoid FPE with Linux 2.6
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40872
2004-03-05 15:09:18 +00:00