comparison src/joystick/darwin/SDL_sysjoystick.c @ 2637:2f826c229d77 gsoc2008_force_feedback

First draft of darwin haptic<->joystick stuff.
author Edgar Simo <bobbens@gmail.com>
date Sun, 10 Aug 2008 19:45:38 +0000
parents 9e7f58b1b255
children db93456d4b26
comparison
equal deleted inserted replaced
2636:57ac1594164e 2637:2f826c229d77
543 recDevice *pDeviceNext = NULL; 543 recDevice *pDeviceNext = NULL;
544 if (*ppDevice) { 544 if (*ppDevice) {
545 /* save next device prior to disposing of this device */ 545 /* save next device prior to disposing of this device */
546 pDeviceNext = (*ppDevice)->pNext; 546 pDeviceNext = (*ppDevice)->pNext;
547 547
548 /* free posible io_service_t */
549 if ((*ppDevice)->ffservice) {
550 IOObjectRelease((*ppDevice)->ffservice);
551 (*ppDevice)->ffservice = 0;
552 }
553
548 /* free element lists */ 554 /* free element lists */
549 HIDDisposeElementList(&(*ppDevice)->firstAxis); 555 HIDDisposeElementList(&(*ppDevice)->firstAxis);
550 HIDDisposeElementList(&(*ppDevice)->firstButton); 556 HIDDisposeElementList(&(*ppDevice)->firstButton);
551 HIDDisposeElementList(&(*ppDevice)->firstHat); 557 HIDDisposeElementList(&(*ppDevice)->firstHat);
552 558
635 /* build a device record */ 641 /* build a device record */
636 device = HIDBuildDevice(ioHIDDeviceObject); 642 device = HIDBuildDevice(ioHIDDeviceObject);
637 if (!device) 643 if (!device)
638 continue; 644 continue;
639 645
640 /* dump device object, it is no longer needed */ 646 /* We have to do some storage of the io_service_t for
641 result = IOObjectRelease(ioHIDDeviceObject); 647 * SDL_HapticOpenFromJoystick */
648 if (FFIsForceFeedback(device) == FF_OK) {
649 device->ffservice = ioHIDDeviceObject;
650 }
651 else {
652 device->ffservice = 0;
653 /* dump device object, it is no longer needed */
654 result = IOObjectRelease(ioHIDDeviceObject);
655 }
642 /* if (KERN_SUCCESS != result) 656 /* if (KERN_SUCCESS != result)
643 HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result); 657 HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result);
644 */ 658 */
645 659
646 /* Filter device list to non-keyboard/mouse stuff */ 660 /* Filter device list to non-keyboard/mouse stuff */