Commit graph

48 commits

Author SHA1 Message Date
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
Sam Lantinga
f4d9f8e59f Fixed memory overwrite in BSD joystick driver (thanks SUGIMOTO Sadahiro!)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40504
2002-10-05 05:32:49 +00:00
Sam Lantinga
fae7d836a8 Date: Thu, 18 Jul 2002 23:51:40 +0200 (MEST)
From: Krister Walfridsson
Subject: [SDL] src/joystick/bsd/SDL_sysjoystick.c patch

The *BSD USB HID joystick code has two serious bugs:

1. If a joystick reports unhandled hid_input usage (for example HUG_RZ or
   HUG_DIAL), then the last handled value will be overwritten with an
   arbitrary value. (Fixed in the patch below by adding a default case.)

2. The current code does only handle logical coordinates in the range 0-255,
   while a big part of available joysticks report -128 - 127. (This is solved
   in the patch below by first center the range around 0, and then stretch
   it to the correct range.)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40462
2002-08-20 06:08:42 +00:00
Ryan C. Gordon
fd6a9a929b Fix for USB HID API. Fixes build on NetBSD and FreeBSD, but maybe causes
trouble on OpenBSD?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40427
2002-07-26 17:13:17 +00:00
Sam Lantinga
f794e9e37c API changes on OpenBSD and FreeBSD...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40408
2002-06-12 03:32:01 +00:00
Sam Lantinga
c37f7658ad *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40406
2002-06-11 20:11:30 +00:00
Sam Lantinga
3ae1a7a53a *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40405
2002-06-11 20:06:42 +00:00
Sam Lantinga
05049da4bb *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40404
2002-06-11 19:56:41 +00:00
Sam Lantinga
2d3904c3e4 *** empty log message ***
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40403
2002-06-11 19:43:04 +00:00
Sam Lantinga
922e3fe2c4 Wilbern Cobb submitted a fix for building BSD joystick support that should work on all BSD flavors.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40382
2002-05-28 20:01:29 +00:00
Sam Lantinga
9295a9bec1 Wilbern Cobb fixed joystick code on FreeBSD
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40359
2002-04-16 16:45:23 +00:00
Sam Lantinga
d45cd06f89 This properly scales axes, and adds support for sliders/wheels
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40308
2002-03-10 03:49:25 +00:00
Sam Lantinga
ea5d630479 Updated copyright information for 2002
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40298
2002-03-06 11:23:08 +00:00
Sam Lantinga
7dffe66c0f Added support for joysticks on *BSD (thanks Wilbern!)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40279
2002-02-14 01:24:08 +00:00