diff --git a/VoodooRMI/Transports/I2C/Info.plist b/VoodooRMI/Transports/I2C/Info.plist index fbd438c..e7289a3 100644 --- a/VoodooRMI/Transports/I2C/Info.plist +++ b/VoodooRMI/Transports/I2C/Info.plist @@ -49,6 +49,8 @@ 2.5 com.1Revenger1.VoodooRMI 1.0 + com.apple.iokit.IOACPIFamily + 1.0.0d1 com.apple.kpi.iokit 15 com.apple.kpi.libkern diff --git a/VoodooRMI/Transports/I2C/RMII2C.hpp b/VoodooRMI/Transports/I2C/RMII2C.hpp index ecbf7e9..ae6c797 100644 --- a/VoodooRMI/Transports/I2C/RMII2C.hpp +++ b/VoodooRMI/Transports/I2C/RMII2C.hpp @@ -86,7 +86,7 @@ class RMII2C : public RMITransport { int reset() APPLE_KEXT_OVERRIDE; int readBlock(u16 rmiaddr, u8 *databuff, size_t len) APPLE_KEXT_OVERRIDE; int blockWrite(u16 rmiaddr, u8 *buf, size_t len) APPLE_KEXT_OVERRIDE; - OSDictionary *createConfig() APPLE_KEXT_OVERRIDE; + virtual OSDictionary *createConfig() APPLE_KEXT_OVERRIDE; private: bool ready {false}; diff --git a/VoodooRMI/Transports/SMBus/Info.plist b/VoodooRMI/Transports/SMBus/Info.plist index e933ecc..615497f 100644 --- a/VoodooRMI/Transports/SMBus/Info.plist +++ b/VoodooRMI/Transports/SMBus/Info.plist @@ -45,6 +45,8 @@ 3.0 com.1Revenger1.VoodooRMI 1.0 + com.apple.iokit.IOACPIFamily + 1.0.0d1 com.apple.kpi.iokit 15 com.apple.kpi.libkern diff --git a/VoodooRMI/Transports/SMBus/RMISMBus.cpp b/VoodooRMI/Transports/SMBus/RMISMBus.cpp index 56717ef..8e49ca6 100644 --- a/VoodooRMI/Transports/SMBus/RMISMBus.cpp +++ b/VoodooRMI/Transports/SMBus/RMISMBus.cpp @@ -8,6 +8,8 @@ */ #include "RMISMBus.hpp" +#include "Configuration.hpp" +#include OSDefineMetaClassAndStructors(RMISMBus, RMITransport) #define super IOService @@ -341,3 +343,35 @@ IOReturn RMISMBus::setPowerState(unsigned long whichState, IOService* whatDevice return kIOPMAckImplied; } + +OSDictionary *RMISMBus::createConfig() { + OSDictionary *config = nullptr; + OSArray *acpiArray = nullptr; + OSObject *acpiReturn = nullptr; + + // Unlike VoodooI2C, VoodooSMBusNubs are not ACPI Devices directly. Grab the device that the controller is attached too + IORegistryEntry *controller = device_nub->getParentEntry(gIOServicePlane); + if (controller == nullptr) return nullptr; + + IORegistryEntry *pciNub = controller->getParentEntry(gIOServicePlane); + if (pciNub == nullptr || pciNub->getProperty("acpi-device") == nullptr) { + IOLogError("%s Could not retrieve controller for config", getName()); + return nullptr; + } + + IOACPIPlatformDevice *acpi_device = OSDynamicCast(IOACPIPlatformDevice, pciNub->getProperty("acpi-device")); + if (!acpi_device) { + IOLogError("%s Could not retrieve acpi device", getName()); + return nullptr; + }; + + if (acpi_device->evaluateObject("RCFG", &acpiReturn) != kIOReturnSuccess) { + return nullptr; + } + + acpiArray = OSDynamicCast(OSArray, acpiReturn); + config = Configuration::mapArrayToDict(acpiArray); + OSSafeReleaseNULL(acpiReturn); + + return config; +} diff --git a/VoodooRMI/Transports/SMBus/RMISMBus.hpp b/VoodooRMI/Transports/SMBus/RMISMBus.hpp index 94d2cef..edc6422 100644 --- a/VoodooRMI/Transports/SMBus/RMISMBus.hpp +++ b/VoodooRMI/Transports/SMBus/RMISMBus.hpp @@ -41,6 +41,7 @@ class RMISMBus : public RMITransport { int blockWrite(u16 rmiaddr, u8 *buf, size_t len) override; int reset() override; + virtual OSDictionary *createConfig() APPLE_KEXT_OVERRIDE; private: VoodooSMBusDeviceNub *device_nub; IOLock *page_mutex; diff --git a/docs/Acpi_Examples/SSDT-VRMI-SBUS.dsl b/docs/Acpi_Examples/SSDT-VRMI-SBUS.dsl new file mode 100644 index 0000000..4c0d264 --- /dev/null +++ b/docs/Acpi_Examples/SSDT-VRMI-SBUS.dsl @@ -0,0 +1,21 @@ +/* + * Example of how to configure VoodooRMI when using + * an SMBus trackpad. + * + * Configuration values can be found in the README + */ + +#define SBUS_DEVICE \_SB.PCI0.SBUS + +DefinitionBlock ("", "SSDT", 2, "GWYD", "Set", 0) { + External (SBUS_DEVICE, DeviceObj) + Scope (SBUS_DEVICE) { + Name (RCFG, Package() { + // Disable force touch + // 0 = Disabled + // 1 = Clickpad button + Size threshold + // 2 = Size threshold + "ForceTouchType", 0, + }) + } +}