Commit graph

63 commits

Author SHA1 Message Date
Philipp Wiesemann
fc24a2d81e Fixed typo in internal joystick documentation comments. 2015-04-15 21:29:55 +02:00
Ryan C. Gordon
3ff618a9c7 Cleanups in the joystick code.
Removed some redundant state and other confusions.

Fixes Bugzilla #2738.

--HG--
extra : rebase_source : 35dd561553379e00eb8d169ce12ecc99393b2f84
2015-03-24 13:52:01 -04:00
Ryan C. Gordon
fbdde501ba Removed SDL_SYS_JoystickNeedsPolling().
It was simpler to just have the polling (actually: hotplug detection)
 functions return immediately if it's not an appropriate time to poll.

Note that previously, if any joystick/controller was opened, we would poll
 every time anyhow, skipping this function.
2014-06-14 23:31:23 -04:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
82edee6971 Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
8d1d55e8fc Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Ryan C. Gordon
4f438b70a2 Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Sam Lantinga
979239e130 Fixed bug 1553 - Fix USB joystick input for FreeBSD 9.0+
Marcus von Appen

Receiving input from USB joysticks on FreeBSD 9.0 or newer is broken at the moment. The attached patch fixes this.
2013-03-04 20:27:51 -08:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
5f53c47559 Fixed joystick GUID renaming for other platforms 2012-12-11 12:16:28 -08:00
Sam Lantinga
03e08a6a79 Organized joystick hotplug code a bit.
Cleaned up names, return types, etc.
2012-11-27 00:58:12 -08:00
Sam Lantinga
27d81d93e4 Hopefully fixed BSD joystick code 2012-11-26 23:41:50 -08:00
Sam Lantinga
c9f59a287d Completed adding new hotplug stubs for the joystick implementations 2012-11-26 22:27:49 -08:00
Sam Lantinga
a8966c167e Updated BSD joystick code for the new API 2012-11-26 22:09:58 -08:00
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
488a27f1b9 Fixed bug 1561 - BSD joystick: Increase the number of uhid devices to scan
Brad Smith 2012-08-01 20:10:19 PDT

The attached patch from the OpenBSD ports tree is to increase the number of
uhid devices to scan for joysticks. It's somewhat easy to exhaust the default
number of devices which are scanned.
2012-08-24 10:03:05 -07:00
Sam Lantinga
d0a7e39c3b FreeBSD compile fix
Robert Millan

src/joystick/bsd/SDL_sysjoystick.c makes the invalid assumption that
__FreeBSD_kernel__ implies presence of "ucr_data" struct member.  This
breaks recent versions of FreeBSD 10-CURRENT, FreeBSD 9-STABLE and
Debian GNU/kFreeBSD "wheezy/sid".
2012-02-15 21:06:45 -05:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Ryan C. Gordon
82db09310f Patched to compile on newer FreeBSD releases.
Thanks to Marcus von Appen for the patch!
2011-11-16 05:13:40 -05:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
124315bff4 I am using SDL 1.3 on FreeBSD. I found two problems.
(1) SDL_atomic dummy version in SDL 1.3 is not used.
Because src/atomic/dummy/*.c are not used.

(2) Typo in src/joystick/bsd/SDL_sysjoystick.c.

Thanks,
IWATSUKI Hiroyuki
2011-01-01 19:50:50 -08:00
Sam Lantinga
ce200fdf85 Debian patch: 215_kfreebsd_gnu.diff 2010-07-18 08:12:28 -07:00
Ryan C. Gordon
2570f36a05 Merged r5547:5548 from branches/SDL-1.2: FreeBSD joystick uninit'd var fix.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404462
2010-02-05 19:23:59 +00: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
344d83f986 Joystick patch from FreeBSD ports system
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404061
2009-10-12 09:42:50 +00:00
Sam Lantinga
a1d457ae81 Whoops, FreeBSD 6.2 doesn't define __FreeBSD_kernel_version
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404027
2009-10-10 09:44:04 +00:00
Sam Lantinga
abf5cb8c2f Adapted from Debian patch: 215_kfreebsd_gnu.diff
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404023
2009-10-10 09:36:12 +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
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
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
de8aa2291c Fixed bug #52
Integrated most of the NetBSD and DragonFly patches at:
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/SDL/patches/

Thanks to Thomas Klausner for defailed information on the patches

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401569
2006-03-21 08:54:50 +00:00
Sam Lantinga
625655e271 ------- Comment #8 From Sergey Svishchev 2006-03-19 12:35 [reply] -------
I've made a similar patch to BSD-specific USB driver, please review it too.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401563
2006-03-20 08:00:07 +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
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
Ryan C. Gordon
e94a4e9464 Apparently some bits of the BSD joystick code are x86 only...joystick.h
only exists at /usr/sys/arch/i386/include/joystick.h, for example.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401188
2005-11-22 15:10:41 +00:00
Sam Lantinga
4cf94e336e Fix from Alfred Perlstein
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40966
2004-11-12 21:24:46 +00:00
Sam Lantinga
5c66c75895 Added support for /dev/joy* on Free/Net/OpenBSD (thanks Christian!)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40777
2004-01-06 04:07:12 +00:00
Sam Lantinga
cb9c2efd17 Updated copyright information for 2004 (Happy New Year!)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40770
2004-01-04 16:49:27 +00:00
Sam Lantinga
94c8f99de6 Date: Mon, 01 Sep 2003 15:37:52 +0900
From: SUGIMOTO Sadahiro
Subject: [SDL] [PATCH] bsd joystick

Hi,
on FreeBSD systems, I had troubles using a USB joystick with SDL.
There are two problems in src/joystick/bsd/SDL_sysjoystick.c .

1. The macro __FreeBSD_version is compared to inappropriate numbers.

According to
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/usbhid.h
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/Attic/libusb.h
http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libusbhid/Attic/libusbhid.h
the APIs of USB HID are common in each following groups of OS versions,
a. 4.1-4.5
b. 4.6-4.8, and 5.0
c. 5.1

2. open() error

$ uname -sr
FreeBSD 5.1-RELEASE
$ ls -l /dev/uhid0
crw-r--r--  1 root  operator  122,   0  8  3 14:06 /dev/uhid0

Then, open("/dev/uhid0", O_RDWR) fails.
It seems that this device file does not need to be writable, so O_RDONLY
may be suitable.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40716
2003-09-05 15:20:47 +00:00
Sam Lantinga
e83605f1b4 Date: Sun, 1 Jun 2003 15:38:45 -0700 (PDT)
From: Jeff Brown <jabrown@caida.org>
Subject: [patch] SDL-1.2.5 + FreeBSD joystick axes, hat fixes

Hello again!  When I sent in some SDL fixes last December, I found out
they'd already been fixed in the CVS version.  This time, I checked the
repository before bugging you.  =)

I'm using SDL-1.2.5 on a FreeBSD 4.6.2-RELEASE system, and in the course
of getting my multi-analog-axis USB controller (with a hat switch!)
working with d2x-sdl -- the SDL port of the Descent 2 engine -- I came
across a few problems:

1) The second analog stick is reported as a slider in one direction, and
"Rz" in the other.  SDL was ignoring the Rz axis, so I added Rx/Ry/Rz to
the set of things SDL considers to be axes.

2) After the above change, the set of JOYAXE_* axes for my gamepad was
{0,1,3,7}; however, d2x-sdl expects the axes to be contiguously numbered
from 0, which seems like a pretty reasonable expectation, rather than
having to scan the entire space of axes that SDL may or may not have.
So, I added a table lookup which maps the JOYAXE_* axis numbers to 0,1,...
in the order they're detected by SDL_SYS_JoystickOpen(), when reporting
them to the application.  I also added a function "usage_to_joyaxe()"
which maps the USB HUG_* usage values to JOYAXE_values, since the repeated
case statements testing for HUG_* were getting out of hand.

3) The BSD joystick driver had no hat support, so I added it.  It looks
like our USB library can only support one hat switch per device, which
makes life easy.

The patch against SDL-1.2.5 which implements these changes is at:

        http://www.caida.org/~jabrown/patches/sdl-1.2.5-bsdhat.diff

After applying, SDL's "testjoystick" reports all activity from my gamepad
correctly, and d2x works too (though it needed some other fixes).

Moving on...

There is also a problem with slightly different USBHID library interfaces
on different versions of FreeBSD. I wasn't going to mention this since the
FreeBSD port for SDL-1.2.5 (and not SDL itself) was doing the FreeBSD
version-specific patching, so I e-mailed the port maintainer with this
change.  However, I see that you've incorporated the FreeBSD
version-checking stuff into the CVS version of SDL, so now it's relevant
for you too.

The problem is, the FreeBSD #if tests don't work right for FreeBSD
4.6.2-RELEASE.  There may be other versions with this problem, but I've
only tested 4.6.2-R.  The following patch against your latest CVS version
fixes this:

--- SDL_sysjoystick.c-1.16      Tue Apr 15 09:02:08 2003
+++ SDL_sysjoystick.c   Sun Jun  1 15:10:28 2003
@@ -420,6 +420,8 @@
 #  else
        len = hid_report_size(rd, repinfo[repind].kind, r->rid);
 #  endif
+# elif (__FreeBSD_version == 460002)
+       len = hid_report_size(rd, r->rid, repinfo[repind].kind);
 # else
        len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
 #endif


I hope this is all useful to you.  I've been getting myself dizzy playing
Descent 2 with it, all morning!

        -Jeff Brown


P.S. My USB controller is a Thrustmaster Firestorm Dual Analog 2.  That's
probably irrelevant, but I threw it in for completeness.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40633
2003-06-02 14:50:22 +00:00
Sam Lantinga
1d8cdd5504 Date: Wed, 9 Apr 2003 01:03:25 -0400 (EDT)
From: "Matthew N. Dodd"
Subject: SDL patch: FreeBSD joystick support.

This patch deals with the recent changes in FreeBSD.

We're making an effort not to diverge our libusbhid from NetBSD's.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40612
2003-04-15 16:02:08 +00:00
Sam Lantinga
180f7d626c *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40553
2002-12-02 02:35:58 +00:00
Sam Lantinga
9f15e5f2c2 Fixed bsd joystick detection ... again (thanks Wilbern)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40545
2002-11-17 19:03:05 +00:00