Mercurial > sdl-ios-xcode
comparison src/joystick/darwin/SDL_sysjoystick.c @ 2640:e8a54b6fd512 gsoc2008_force_feedback
Fixed force feedback detection of joystick devices
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 11 Aug 2008 02:51:32 +0000 |
parents | 668fee3b268a |
children |
comparison
equal
deleted
inserted
replaced
2639:668fee3b268a | 2640:e8a54b6fd512 |
---|---|
645 /* build a device record */ | 645 /* build a device record */ |
646 device = HIDBuildDevice(ioHIDDeviceObject); | 646 device = HIDBuildDevice(ioHIDDeviceObject); |
647 if (!device) | 647 if (!device) |
648 continue; | 648 continue; |
649 | 649 |
650 /* We have to do some storage of the io_service_t for | |
651 * SDL_HapticOpenFromJoystick */ | |
652 if (FFIsForceFeedback((io_service_t)device) == FF_OK) { | |
653 device->ffservice = ioHIDDeviceObject; | |
654 } | |
655 else { | |
656 device->ffservice = 0; | |
657 /* dump device object, it is no longer needed */ | |
658 result = IOObjectRelease(ioHIDDeviceObject); | |
659 } | |
660 /* if (KERN_SUCCESS != result) | |
661 HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result); | |
662 */ | |
663 | |
664 /* Filter device list to non-keyboard/mouse stuff */ | 650 /* Filter device list to non-keyboard/mouse stuff */ |
665 if ((device->usagePage != kHIDPage_GenericDesktop) || | 651 if ((device->usagePage != kHIDPage_GenericDesktop) || |
666 ((device->usage != kHIDUsage_GD_Joystick && | 652 ((device->usage != kHIDUsage_GD_Joystick && |
667 device->usage != kHIDUsage_GD_GamePad && | 653 device->usage != kHIDUsage_GD_GamePad && |
668 device->usage != kHIDUsage_GD_MultiAxisController))) { | 654 device->usage != kHIDUsage_GD_MultiAxisController))) { |
669 | 655 |
670 /* release memory for the device */ | 656 /* release memory for the device */ |
671 HIDDisposeDevice(&device); | 657 HIDDisposeDevice(&device); |
672 DisposePtr((Ptr) device); | 658 DisposePtr((Ptr) device); |
673 continue; | 659 continue; |
660 } | |
661 | |
662 /* We have to do some storage of the io_service_t for | |
663 * SDL_HapticOpenFromJoystick */ | |
664 if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) { | |
665 device->ffservice = ioHIDDeviceObject; | |
666 } | |
667 else { | |
668 device->ffservice = 0; | |
674 } | 669 } |
675 | 670 |
676 /* Add device to the end of the list */ | 671 /* Add device to the end of the list */ |
677 if (lastDevice) | 672 if (lastDevice) |
678 lastDevice->pNext = device; | 673 lastDevice->pNext = device; |