Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for kIOReturnError instead of Success #7

Merged
merged 4 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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