comparison src/joystick/bsd/SDL_sysjoystick.c @ 358:1f148809d972

Wilbern Cobb fixed joystick code on FreeBSD
author Sam Lantinga <slouken@libsdl.org>
date Tue, 16 Apr 2002 16:45:23 +0000
parents 0185452e9f83
children bc1401311390
comparison
equal deleted inserted replaced
357:5868b0f832f2 358:1f148809d972
39 #include <string.h> 39 #include <string.h>
40 #include <errno.h> 40 #include <errno.h>
41 41
42 #include <dev/usb/usb.h> 42 #include <dev/usb/usb.h>
43 #include <dev/usb/usbhid.h> 43 #include <dev/usb/usbhid.h>
44 #include <usbhid.h> 44
45 #if defined(__FreeBSD__)
46 # include <libusb.h>
47 #else
48 # include <usbhid.h>
49 #endif
45 50
46 #include "SDL_error.h" 51 #include "SDL_error.h"
47 #include "SDL_joystick.h" 52 #include "SDL_joystick.h"
48 #include "SDL_sysjoystick.h" 53 #include "SDL_sysjoystick.h"
49 #include "SDL_joystick_c.h" 54 #include "SDL_joystick_c.h"
203 joy->nbuttons = 0; 208 joy->nbuttons = 0;
204 joy->nhats = 0; 209 joy->nhats = 0;
205 joy->nballs = 0; 210 joy->nballs = 0;
206 211
207 while (hid_get_item(hdata, &hitem) > 0) { 212 while (hid_get_item(hdata, &hitem) > 0) {
208 char *s, *sp; 213 char *sp;
214 const char *s;
209 215
210 switch (hitem.kind) { 216 switch (hitem.kind) {
211 case hid_collection: 217 case hid_collection:
212 switch (HID_PAGE(hitem.usage)) { 218 switch (HID_PAGE(hitem.usage)) {
213 case HUP_GENERIC_DESKTOP: 219 case HUP_GENERIC_DESKTOP:
269 SDL_SYS_JoystickUpdate(SDL_Joystick *joy) 275 SDL_SYS_JoystickUpdate(SDL_Joystick *joy)
270 { 276 {
271 static struct hid_item hitem; 277 static struct hid_item hitem;
272 static struct hid_data *hdata; 278 static struct hid_data *hdata;
273 static struct report *rep; 279 static struct report *rep;
274 int nbutton, naxe; 280 int nbutton, naxe = -1;
275 Sint32 v; 281 Sint32 v;
276 282
277 rep = &joy->hwdata->inreport; 283 rep = &joy->hwdata->inreport;
278 if (read(joy->hwdata->fd, rep->buf->data, rep->size) != rep->size) { 284 if (read(joy->hwdata->fd, rep->buf->data, rep->size) != rep->size) {
279 return; 285 return;