equal
deleted
inserted
replaced
27 * Maintainer: <vedge at csoft.org> |
27 * Maintainer: <vedge at csoft.org> |
28 */ |
28 */ |
29 |
29 |
30 #ifdef SAVE_RCSID |
30 #ifdef SAVE_RCSID |
31 static char rcsid = |
31 static char rcsid = |
32 "@(#) $Id $"; |
32 "@(#) $Id$"; |
33 #endif |
33 #endif |
34 |
34 |
35 #include <stdio.h> |
35 #include <stdio.h> |
36 #include <stdlib.h> |
36 #include <stdlib.h> |
37 #include <unistd.h> |
37 #include <unistd.h> |
208 SDL_SetError("%s: Input report descriptor has invalid length", |
208 SDL_SetError("%s: Input report descriptor has invalid length", |
209 hw->path); |
209 hw->path); |
210 goto usberr; |
210 goto usberr; |
211 } |
211 } |
212 |
212 |
|
213 #ifdef USBHID_NEW |
|
214 hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); |
|
215 #else |
213 hdata = hid_start_parse(hw->repdesc, 1 << hid_input); |
216 hdata = hid_start_parse(hw->repdesc, 1 << hid_input); |
|
217 #endif |
214 if (hdata == NULL) { |
218 if (hdata == NULL) { |
215 SDL_SetError("%s: Cannot start HID parser", hw->path); |
219 SDL_SetError("%s: Cannot start HID parser", hw->path); |
216 goto usberr; |
220 goto usberr; |
217 } |
221 } |
218 joy->naxes = 0; |
222 joy->naxes = 0; |
294 rep = &joy->hwdata->inreport; |
298 rep = &joy->hwdata->inreport; |
295 |
299 |
296 if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) { |
300 if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) { |
297 return; |
301 return; |
298 } |
302 } |
|
303 #ifdef USBHID_NEW |
|
304 hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid); |
|
305 #else |
299 hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); |
306 hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); |
|
307 #endif |
300 if (hdata == NULL) { |
308 if (hdata == NULL) { |
301 fprintf(stderr, "%s: Cannot start HID parser\n", |
309 fprintf(stderr, "%s: Cannot start HID parser\n", |
302 joy->hwdata->path); |
310 joy->hwdata->path); |
303 return; |
311 return; |
304 } |
312 } |
398 static int |
406 static int |
399 report_alloc(struct report *r, struct report_desc *rd, int repind) |
407 report_alloc(struct report *r, struct report_desc *rd, int repind) |
400 { |
408 { |
401 int len; |
409 int len; |
402 |
410 |
|
411 #ifdef USBHID_NEW |
|
412 len = hid_report_size(rd, repinfo[repind].kind, r->rid); |
|
413 #else |
403 len = hid_report_size(rd, repinfo[repind].kind, &r->rid); |
414 len = hid_report_size(rd, repinfo[repind].kind, &r->rid); |
|
415 #endif |
404 if (len < 0) { |
416 if (len < 0) { |
405 SDL_SetError("Negative HID report size"); |
417 SDL_SetError("Negative HID report size"); |
406 return (-1); |
418 return (-1); |
407 } |
419 } |
408 r->size = len; |
420 r->size = len; |