Skip to content

Commit

Permalink
Remove isLegacy option for I2C
Browse files Browse the repository at this point in the history
  • Loading branch information
1Revenger1 committed Oct 18, 2024
1 parent 5f96475 commit 9461db4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
2 changes: 0 additions & 2 deletions VoodooRMI/Transports/I2C/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<string>VoodooI2CDeviceNub</string>
<key>IOClass</key>
<string>RMII2C</string>
<key>Legacy</key>
<false/>
<key>CFBundleIdentifier</key>
<string>com.1Revenger1.RMII2C</string>
</dict>
Expand Down
25 changes: 4 additions & 21 deletions VoodooRMI/Transports/I2C/RMII2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ RMII2C *RMII2C::probe(IOService *provider, SInt32 *score) {
name = provider->getName();
IOLogDebug("%s::%s probing", getName(), name);

OSBoolean *isLegacy= OSDynamicCast(OSBoolean, getProperty("Legacy"));
if (isLegacy == nullptr) {
IOLogInfo("%s::%s Legacy mode not set, default to false", getName(), name);
} else if (isLegacy->getValue()) {
reportMode = RMI_MODE_ATTN_REPORTS;
IOLogInfo("%s::%s running in legacy mode", getName(), name);
}

device_nub = OSDynamicCast(VoodooI2CDeviceNub, provider);
if (!device_nub) {
IOLogError("%s::%s Could not cast nub", getName(), name);
Expand All @@ -57,7 +49,7 @@ RMII2C *RMII2C::probe(IOService *provider, SInt32 *score) {

do {
IOLogDebug("%s::%s Trying to set mode, attempt %d", getName(), name, attempts);
error = rmi_set_mode(reportMode);
error = rmi_set_mode(RMI_MODE_ATTN_REPORTS);
IOSleep(500);
} while (error < 0 && attempts++ < 5);

Expand Down Expand Up @@ -271,7 +263,7 @@ int RMII2C::rmi_set_mode(UInt8 mode) {
}

int RMII2C::reset() {
int retval = rmi_set_mode(reportMode);
int retval = rmi_set_mode(RMI_MODE_ATTN_REPORTS);

if (retval < 0)
return retval;
Expand Down Expand Up @@ -341,16 +333,7 @@ int RMII2C::readBlock(UInt16 rmiaddr, UInt8 *databuff, size_t len) {
goto exit;
}

// FIXME: whether to rebuild packet
if (reportMode == RMI_MODE_ATTN_REPORTS && len == 68) {
memcpy(databuff, i2cInput+4, 16);
device_nub->readI2C(i2cInput, len+4);
memcpy(databuff+16, i2cInput+4, 16);
device_nub->readI2C(i2cInput, len+4);
memcpy(databuff+32, i2cInput+4, 16);
} else {
memcpy(databuff, i2cInput+4, len);
}
memcpy(databuff, i2cInput+4, len);
exit:
delete[] i2cInput;
IOLockUnlock(page_mutex);
Expand Down Expand Up @@ -430,7 +413,7 @@ IOReturn RMII2C::setPowerStateGated() {
// FIXME: Hardcode 1s sleep delay because device will otherwise time out during reconfig
IOSleep(1000);

int retval = rmi_set_mode(reportMode);
int retval = rmi_set_mode(RMI_MODE_ATTN_REPORTS);
if (retval < 0) {
IOLogError("Failed to config trackpad!");
return kIOPMAckImplied;
Expand Down
1 change: 0 additions & 1 deletion VoodooRMI/Transports/I2C/RMII2C.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class RMII2C : public RMITransport {
bool ready {false};
unsigned long currentPowerState {1};
int page {0};
int reportMode {RMI_MODE_ATTN_REPORTS};
UInt8 *inputBuffer {nullptr};

VoodooI2CDeviceNub *device_nub {nullptr};
Expand Down

0 comments on commit 9461db4

Please sign in to comment.