Skip to content

Commit

Permalink
Add G920 Support (#4)
Browse files Browse the repository at this point in the history
* Add initial G920 support

* Fix typo

* Add debugging printouts

* Make debug printouts hex

* Change G920 Wheel Range Command

* Remove debug and clean up whitespace
  • Loading branch information
FranticRain authored and jackhumbert committed Aug 20, 2016
1 parent 6c2e3c3 commit 85f3e02
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions WheelSupports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions WheelSupports.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85f3e02

Please sign in to comment.