sdl.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. $FreeBSD: ports/devel/sdl12/files/patch-src::joystick::bsd::SDL_sysjoystick.c,v 1.2 2002/04/18 08:10:01 sobomax Exp $
  2. --- src/joystick/bsd/SDL_sysjoystick.c.orig Sun Mar 10 05:49:25 2002
  3. +++ src/joystick/bsd/SDL_sysjoystick.c Thu Apr 18 10:48:00 2002
  4. @@ -41,7 +41,11 @@
  5. #include <dev/usb/usb.h>
  6. #include <dev/usb/usbhid.h>
  7. -#include <usbhid.h>
  8. +#if !defined(HAVE_LIBUSBHID_H)
  9. +#include <libusb.h>
  10. +#else
  11. +#include <libusbhid.h>
  12. +#endif
  13. #include "SDL_error.h"
  14. #include "SDL_joystick.h"
  15. @@ -205,7 +209,8 @@
  16. joy->nballs = 0;
  17. while (hid_get_item(hdata, &hitem) > 0) {
  18. - char *s, *sp;
  19. + const char *s;
  20. + char *sp;
  21. switch (hitem.kind) {
  22. case hid_collection:
  23. @@ -275,7 +280,7 @@
  24. Sint32 v;
  25. rep = &joy->hwdata->inreport;
  26. - if (read(joy->hwdata->fd, rep->buf->data, rep->size) != rep->size) {
  27. + if (read(joy->hwdata->fd, rep->buf->ucr_data, rep->size) != rep->size) {
  28. return;
  29. }
  30. hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
  31. @@ -310,7 +315,7 @@
  32. goto scaleaxe;
  33. }
  34. scaleaxe:
  35. - v = (Sint32)hid_get_data(rep->buf->data, &hitem);
  36. + v = (Sint32)hid_get_data(rep->buf->ucr_data, &hitem);
  37. if (v != 127) {
  38. if (v < 127) {
  39. v = -(256 - v);
  40. @@ -329,7 +334,7 @@
  41. }
  42. break;
  43. case HUP_BUTTON:
  44. - v = (Sint32)hid_get_data(rep->buf->data,
  45. + v = (Sint32)hid_get_data(rep->buf->ucr_data,
  46. &hitem);
  47. if (joy->buttons[nbutton] != v) {
  48. SDL_PrivateJoystickButton(joy,
  49. @@ -381,7 +386,12 @@
  50. {
  51. int len;
  52. +#if !defined(HAVE_LIBUSBHID_H)
  53. len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
  54. +#else
  55. + len = hid_report_size(rd, r->rid, repinfo[repind].kind);
  56. +#endif
  57. +
  58. if (len < 0) {
  59. SDL_SetError("Negative HID report size");
  60. return (-1);
  61. @@ -389,7 +399,7 @@
  62. r->size = len;
  63. if (r->size > 0) {
  64. - r->buf = malloc(sizeof(*r->buf) - sizeof(r->buf->data) +
  65. + r->buf = malloc(sizeof(*r->buf) - sizeof(r->buf->ucr_data) +
  66. r->size);
  67. if (r->buf == NULL) {
  68. SDL_OutOfMemory();