Skip to content

Commit

Permalink
Use MacbookAir10,1 ID instead of SPI touchpad ID on macOS 12+ (#26)
Browse files Browse the repository at this point in the history
macOS Sequoia dropped the IOKit personalities for all the SPI touchpads, including the one used by VoodooInput.
  • Loading branch information
1Revenger1 authored Jul 13, 2024
1 parent 3de53b0 commit f8f8b65
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
4 changes: 4 additions & 0 deletions VoodooInput.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
7BBAB21922E3AD0E00B2941A /* VoodooInputActuatorDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7BBAB21322E3AD0D00B2941A /* VoodooInputActuatorDevice.cpp */; };
7BBAB21B22E3AD0E00B2941A /* VoodooInputActuatorDevice.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 7BBAB21522E3AD0E00B2941A /* VoodooInputActuatorDevice.hpp */; };
CE8DA19D2518354A008C44E8 /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8DA19C2518354A008C44E8 /* libkmod.a */; };
EEC13CEB2C1DFD300080F2D1 /* VoodooInputIDs.hpp in Headers */ = {isa = PBXBuildFile; fileRef = EEC13CEA2C1DFD270080F2D1 /* VoodooInputIDs.hpp */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -37,6 +38,7 @@
CEFB081B239658DB00215B0B /* Changelog.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Changelog.md; sourceTree = SOURCE_ROOT; };
CEFB081D2397003600215B0B /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
CEFB081E2397003600215B0B /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE.txt; sourceTree = SOURCE_ROOT; };
EEC13CEA2C1DFD270080F2D1 /* VoodooInputIDs.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = VoodooInputIDs.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -87,6 +89,7 @@
7BBAB20F22E3AC7E00B2941A /* VoodooInputSimulator */,
7BBAB1FC22E3A2F800B2941A /* VoodooInput.hpp */,
7BBAB1FE22E3A2F800B2941A /* VoodooInput.cpp */,
EEC13CEA2C1DFD270080F2D1 /* VoodooInputIDs.hpp */,
7BBAB20022E3A2F800B2941A /* Info.plist */,
);
path = VoodooInput;
Expand Down Expand Up @@ -144,6 +147,7 @@
358914F425798FA5007A0B58 /* TrackpointDevice.hpp in Headers */,
7BBAB21B22E3AD0E00B2941A /* VoodooInputActuatorDevice.hpp in Headers */,
7BBAB1FD22E3A2F800B2941A /* VoodooInput.hpp in Headers */,
EEC13CEB2C1DFD300080F2D1 /* VoodooInputIDs.hpp in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
11 changes: 11 additions & 0 deletions VoodooInput/VoodooInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
//

#include "VoodooInput.hpp"
#include "VoodooInputIDs.hpp"
#include "VoodooInputMultitouch/VoodooInputMessages.h"
#include "VoodooInputSimulator/VoodooInputActuatorDevice.hpp"
#include "VoodooInputSimulator/VoodooInputSimulatorDevice.hpp"
#include "Trackpoint/TrackpointDevice.hpp"

#include "libkern/version.h"

#define super IOService
OSDefineMetaClassAndStructors(VoodooInput, IOService);

Expand Down Expand Up @@ -205,3 +208,11 @@ IOReturn VoodooInput::message(UInt32 type, IOService *provider, void *argument)

return super::message(type, provider, argument);
}

int VoodooInputGetProductId() {
if (version_major >= kVoodooInputVersionMonterey) {
return kVoodooInputProductMacbookAir10_1;
}

return kVoodooInputProductMacbook8_1;
}
21 changes: 21 additions & 0 deletions VoodooInput/VoodooInputIDs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// VoodooInputIDs.hpp
//
// Created by Avery Black on 6/15/24.
// Copyright © 2024 Kishor Prins. All rights reserved.
//

#ifndef VOODOO_INPUT_IDS_HPP
#define VOODOO_INPUT_IDS_HPP

// macOS 10.10-14
constexpr int kVoodooInputProductMacbook8_1 = 0x272;
// macOS 12+
constexpr int kVoodooInputProductMacbookAir10_1 = 0x281;
constexpr int kVoodooInputVendorApple = 0x5ac;

constexpr int kVoodooInputVersionMonterey = 21;

int VoodooInputGetProductId();

#endif // VOODOO_INPUT_IDS_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

#include "VoodooInputActuatorDevice.hpp"
#include "VoodooInputIDs.hpp"

#define super IOHIDDevice
OSDefineMetaClassAndStructors(VoodooInputActuatorDevice, IOHIDDevice);
Expand Down Expand Up @@ -43,7 +44,7 @@ OSNumber* VoodooInputActuatorDevice::newPrimaryUsagePageNumber() const {
}

OSNumber* VoodooInputActuatorDevice::newProductIDNumber() const {
return OSNumber::withNumber(0x272, 32);
return OSNumber::withNumber(VoodooInputGetProductId(), 32);
}

OSString* VoodooInputActuatorDevice::newProductString() const {
Expand All @@ -59,7 +60,7 @@ OSString* VoodooInputActuatorDevice::newTransportString() const {
}

OSNumber* VoodooInputActuatorDevice::newVendorIDNumber() const {
return OSNumber::withNumber(0x5ac, 16);
return OSNumber::withNumber(kVoodooInputVendorApple, 16);
}

OSNumber* VoodooInputActuatorDevice::newLocationIDNumber() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "VoodooInput.hpp"
#include "VoodooInputSimulatorDevice.hpp"
#include "../VoodooInputMultitouch/MultitouchHelpers.h"
#include "VoodooInputIDs.hpp"

#include <IOKit/IOWorkLoop.h>
#include <IOKit/IOCommandGate.h>
Expand Down Expand Up @@ -501,7 +502,7 @@ OSNumber* VoodooInputSimulatorDevice::newPrimaryUsagePageNumber() const {
}

OSNumber* VoodooInputSimulatorDevice::newProductIDNumber() const {
return OSNumber::withNumber(0x272, 32);
return OSNumber::withNumber(VoodooInputGetProductId(), 32);
}

OSString* VoodooInputSimulatorDevice::newProductString() const {
Expand All @@ -517,7 +518,7 @@ OSString* VoodooInputSimulatorDevice::newTransportString() const {
}

OSNumber* VoodooInputSimulatorDevice::newVendorIDNumber() const {
return OSNumber::withNumber(0x5ac, 16);
return OSNumber::withNumber(kVoodooInputVendorApple, 16);
}

OSNumber* VoodooInputSimulatorDevice::newLocationIDNumber() const {
Expand Down

0 comments on commit f8f8b65

Please sign in to comment.