Skip to content

Commit

Permalink
Merge pull request #7 from verberktstan/master
Browse files Browse the repository at this point in the history
Check for kIOReturnError instead of Success
  • Loading branch information
jackhumbert authored May 14, 2020
2 parents 34fff2c + 91faae5 commit 38c9346
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Binary file modified FreeTheWheel
Binary file not shown.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Free The Wheel for OS X

Logitech driving wheel enabler based on [Feral Interactive's FreeTheWheel](http://support.feralinteractive.com/en/faqs/free_the_wheel/)

## OS X Catalina

This is a fork of [jackhumbert's FreeTheWheel](https://github.com/jackhumbert/FreeTheWheel).
I just made it to work on OS X Catalina. As far is I know, it works for the following wheels. Please let me know if your wheel works!

* G27
* Driving Force GT

## Features for the G27

* Full 900˚ Rotation
Expand Down
31 changes: 25 additions & 6 deletions WheelSupports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#include <CoreFoundation/CFString.h>
#include <string>
#include "WheelSupports.h"

//=============================================================================
Expand Down Expand Up @@ -116,12 +117,30 @@ bool ConfigDevice(IOHIDDeviceRef hidDevice, DeviceID deviceID, const DeviceMode
IOReturn OpenDevice(IOHIDDeviceRef hidDevice)
{
IOReturn result = IOHIDDeviceOpen(hidDevice, kIOHIDOptionsTypeSeizeDevice);
if(result != kIOReturnSuccess)
{
printf("ERROR: OpenDevice failed with result: %x\n", result);
return result;
}
return kIOReturnSuccess;
std::string msg = "";

switch(result) {
case kIOReturnError: msg = "general error"; break;
case kIOReturnNoMemory: msg = "can't allocate memory"; break;
case kIOReturnNoResources: msg = "resource shortage"; break;
case kIOReturnIPCError: msg = "error during IPC"; break;
case kIOReturnNoDevice: msg = "no such device"; break;
case kIOReturnNotPrivileged: msg = "privilege violation"; break;
case kIOReturnBadArgument: msg = "invalid argument"; break;
case kIOReturnLockedRead: msg = "device read locked"; break;
case kIOReturnLockedWrite: msg = "device write locked"; break;
//case kIOReturnExclusiveAccess: msg = "exclusive access and device already open"; break; // Common error on macOS Catalina with DFGT
case kIOReturnBadMessageID: msg = "sent/received messages had different msg_id"; break;
case kIOReturnUnsupported: msg = "unsupported function"; break;
case kIOReturnVMError: msg = "misc. VM failure"; break;
}

if(msg != "") {
printf("Error: OpenDevice failed - %s - (%x)\n", msg.c_str(), result);
return result;

}
return kIOReturnSuccess;
}


Expand Down

0 comments on commit 38c9346

Please sign in to comment.