Skip to content

Commit

Permalink
feat: introduce the ability to disable auto-centering
Browse files Browse the repository at this point in the history
WARNING: This change only works with G29 due to lack of implementation.

Signed-off-by: 1halon <[email protected]>
  • Loading branch information
1halon committed Dec 3, 2024
1 parent a209f8f commit 1c9a8d6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Binary file modified FreeTheWheel
Binary file not shown.
32 changes: 32 additions & 0 deletions WheelSupports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ bool ConfigLogitechWheels(IOHIDDeviceRef hidDevice, DeviceID deviceID,

printf("Calibrated 900 degree wheel movement. (VendorID/DeviceID %x)\n",
deviceID);

usleep(DELAY_BETWEEN_COMMANDS);
GetCmdLogitechWheelAutoCenter(&commands, deviceID);
SendCommands(hidDevice, &commands);
printf("Disabled auto-centering. (VendorID/DeviceID %x)\n", deviceID);
changed = true;
} else {
// We don't know how to go back to restricted mode, but we can set the
Expand Down Expand Up @@ -505,3 +510,30 @@ void GetCmdLogitechWheelRange(CCommands *c, const DeviceID deviceID,
break;
}
}

//=============================================================================
// GetCmdLogitechWheelAutoCenter : Deactivate auto-centering for given device ID
// WARNING: G29 is the only wheel that is implemented.
//-----------------------------------------------------------------------------
void GetCmdLogitechWheelAutoCenter(CCommands *c, const DeviceID deviceID) {
// Fill the command array with null
memset(c->cmds, 0, kGPCommandsDataSize);

// Fill in the command value according to target deviceID
switch (deviceID) {
case kGPLogitechG29Native:
c->cmds[0][0] = 0xf5;
c->cmds[0][1] = 0x00;
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;
}
}
1 change: 1 addition & 0 deletions WheelSupports.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ bool ConfigLogitechWheels(IOHIDDeviceRef hidDevice, DeviceID deviceID,

void GetCmdLogitechWheelNative(CCommands *c, const DeviceID deviceID);
void GetCmdLogitechWheelRange(CCommands *c, const DeviceID deviceID, int range);
void GetCmdLogitechWheelAutoCenter(CCommands *c, const DeviceID deviceID);

#endif /* defined(__WheelSupportTools__WheelSupports__) */

0 comments on commit 1c9a8d6

Please sign in to comment.