From 85f3e0286b226926cb8b3cb3196a211dd78d3195 Mon Sep 17 00:00:00 2001 From: Drew Mills Date: Sat, 20 Aug 2016 11:11:52 -0700 Subject: [PATCH] Add G920 Support (#4) * Add initial G920 support * Fix typo * Add debugging printouts * Make debug printouts hex * Change G920 Wheel Range Command * Remove debug and clean up whitespace --- WheelSupports.cpp | 31 +++++++++++++++++++++++++++++++ WheelSupports.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/WheelSupports.cpp b/WheelSupports.cpp index 771103e..139f590 100644 --- a/WheelSupports.cpp +++ b/WheelSupports.cpp @@ -97,6 +97,9 @@ bool ConfigDevice(IOHIDDeviceRef hidDevice, DeviceID deviceID, const DeviceMode case kGPLogitechDFPNative: printf("Logitech Driving Force Pro Native mode enabled.\n"); return ConfigLogitechWheels(hidDevice, deviceID, true, mode); + case kGPLogitechG920Native: + printf("Logitech G920 Native mode enabled.\n"); + return ConfigLogitechWheels(hidDevice, deviceID, true, mode); default: return false; } @@ -229,6 +232,11 @@ bool ConfigLogitechWheels(IOHIDDeviceRef hidDevice, DeviceID deviceID, bool nati targetDeviceID = kGPLogitechDFPNative; printf("Logitech Driving Force Pro Native mode enabled.\n"); } + else if(CFStringFind(productID, CFSTR(kGPLogitechG920ProductID), 0).location == 0) + { + targetDeviceID = kGPLogitechG920Native; + printf("Logitech G920 Native mode enabled.\n"); + } else return false; // Activate full native and 900 degree mode @@ -359,6 +367,18 @@ void GetCmdLogitechWheelNative(CCommands *c, const DeviceID deviceID) c->cmds[0][1] = 0x01; c->count = 1; break; + case kGPLogitechG920Native: + c->cmds[0][0] = 0xf8; + c->cmds[0][1] = 0x0a; + c->cmds[0][2] = 0x00; + c->cmds[0][3] = 0x00; + c->cmds[0][4] = 0x00; + c->cmds[0][5] = 0x00; + c->cmds[0][6] = 0x00; + c->cmds[0][7] = 0x00; + + c->count = 2; + break; default: c->count = 0; break; @@ -439,6 +459,17 @@ void GetCmdLogitechWheelRange(CCommands *c, const DeviceID deviceID, int range) } break; } + case kGPLogitechG920Native: + { + c->cmds[0][0] = 0xf8; + c->cmds[0][1] = 0x61; + c->cmds[0][2] = (range & 0x00ff); + c->cmds[0][3] = (range & 0xff00) >> 8; + c->cmds[0][4] = 0x00; + c->cmds[0][5] = 0x00; + c->cmds[0][6] = 0x00; + c->cmds[0][7] = 0x00; + } default: c->count = 0; break; diff --git a/WheelSupports.h b/WheelSupports.h index d8f21b6..3a1b5f1 100644 --- a/WheelSupports.h +++ b/WheelSupports.h @@ -31,12 +31,14 @@ #define kGPLogitechG27Native 0xc29b046d #define kGPLogitechDFGTNative 0xc29a046d #define kGPLogitechDFPNative 0xc298046d +#define kGPLogitechG920Native 0xc261046d // Product IDs #define kGPLogitechG25ProductID "G25" #define kGPLogitechG27ProductID "G27" #define kGPLogitechDFGTProductID "Driving Force GT" #define kGPLogitechDFPProductID "Driving Force Pro" +#define kGPLogitechG920ProductID "G920" // Device properties #define kGPLogitechWheelRangeStandard 240