Quantcast
Channel: Get a ForceFeedback device in Swift - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Get a ForceFeedback device in Swift

$
0
0

I can get a hid device like this

import ForceFeedbackimport IOKit.hidprivate func createDeviceMatchingDictionary( usagePage: Int, usage: Int) -> CFMutableDictionary {    let dict = [        kIOHIDDeviceUsageKey: usage,        kIOHIDDeviceUsagePageKey: usagePage        ] as NSDictionary    return dict.mutableCopy() as! NSMutableDictionary;}let manager = IOHIDManagerCreate(kCFAllocatorDefault, IOOptionBits(kIOHIDOptionsTypeNone));let trackpad = createDeviceMatchingDictionary(usagePage: kHIDPage_GenericDesktop, usage: kHIDUsage_GD_Mouse)IOHIDManagerOpen(manager, IOOptionBits(kIOHIDOptionsTypeNone) )IOHIDManagerSetDeviceMatching(manager, trackpad)let devices = IOHIDManagerCopyDevices(manager)

However none of this returns either a io_service_t or a UnsafeMutablePointer<FFDeviceObjectReference> required to use FFCreateDevice()

How do I get a forcefeedback device and use FFCreateEffect on it?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images