Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable building on modern macOS; add missing vendor matching for macOS #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions commandline/hiddata_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ int usbhidEnumDevices(int vendor, int product,
mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
if (!mgr)
return USBHID_ERR_IO_HID;
// *** TODO: match by vendor/product right here ***
IOHIDManagerSetDeviceMatching(mgr, NULL);

// Create dictionary to match devices by vendor 0x16c0
int c_vendorid = 0x16c0;
CFMutableDictionaryRef dictionary = CFDictionaryCreateMutable(kCFAllocatorDefault,1,&kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks);
CFNumberRef vendorid = CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &c_vendorid );
CFDictionarySetValue( dictionary, CFSTR( kIOHIDVendorIDKey ), vendorid );

IOHIDManagerSetDeviceMatching(mgr, dictionary);
IOReturn ir = IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);
if (ir != kIOReturnSuccess)
return USBHID_ERR_IO_HID;
Expand Down
35 changes: 18 additions & 17 deletions commandline/hidusb-relay-cmd.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
E91AC6D01A5B4717009E1022 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E91AC6CF1A5B4717009E1022 /* IOKit.framework */; };
E9BA23AE1A60A5DF00AC9E85 /* hiddata-OSX.c in Sources */ = {isa = PBXBuildFile; fileRef = E9BA23AD1A60A5DF00AC9E85 /* hiddata_osx.c */; };
9D3288AA2A3C896200DE2C7B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E91AC6CF1A5B4717009E1022 /* IOKit.framework */; };
E9BA23AE1A60A5DF00AC9E85 /* hiddata_osx.c in Sources */ = {isa = PBXBuildFile; fileRef = E9BA23AD1A60A5DF00AC9E85 /* hiddata_osx.c */; };
E9CBC75F1A5F4DE0008CEC54 /* usbrelay-cmd.c in Sources */ = {isa = PBXBuildFile; fileRef = E9CBC75E1A5F4DE0008CEC54 /* usbrelay-cmd.c */; };
/* End PBXBuildFile section */

Expand All @@ -25,9 +25,9 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
E91AC6CF1A5B4717009E1022 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework; sourceTree = DEVELOPER_DIR; };
E91AC6CF1A5B4717009E1022 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework; sourceTree = DEVELOPER_DIR; };
E99FE4AD1A5981FD00F14CF4 /* hidusb-relay-cmd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "hidusb-relay-cmd"; sourceTree = BUILT_PRODUCTS_DIR; };
E9BA23AD1A60A5DF00AC9E85 /* hiddata_OSX.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "hiddata_osx.c"; sourceTree = "<group>"; };
E9BA23AD1A60A5DF00AC9E85 /* hiddata_osx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hiddata_osx.c; sourceTree = "<group>"; };
E9CBC75E1A5F4DE0008CEC54 /* usbrelay-cmd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "usbrelay-cmd.c"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -36,7 +36,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E91AC6D01A5B4717009E1022 /* IOKit.framework in Frameworks */,
9D3288AA2A3C896200DE2C7B /* IOKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -46,7 +46,7 @@
E99FE4A41A5981FD00F14CF4 = {
isa = PBXGroup;
children = (
E9BA23AD1A60A5DF00AC9E85 /* hiddata_OSX.c */,
E9BA23AD1A60A5DF00AC9E85 /* hiddata_osx.c */,
E9CBC75E1A5F4DE0008CEC54 /* usbrelay-cmd.c */,
E91AC6CF1A5B4717009E1022 /* IOKit.framework */,
E99FE4AE1A5981FD00F14CF4 /* Products */,
Expand Down Expand Up @@ -100,6 +100,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = E99FE4A41A5981FD00F14CF4;
Expand All @@ -117,7 +118,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E9BA23AE1A60A5DF00AC9E85 /* hiddata_OSX.c in Sources */,
E9BA23AE1A60A5DF00AC9E85 /* hiddata_osx.c in Sources */,
E9CBC75F1A5F4DE0008CEC54 /* usbrelay-cmd.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -158,7 +159,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -193,7 +194,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
Expand All @@ -202,28 +203,28 @@
E99FE4B51A5981FD00F14CF4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_PASCAL_STRINGS = NO;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 13.3;
PRODUCT_NAME = "$(TARGET_NAME)";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
SDKROOT = macosx10.9;
"SDKROOT[arch=*]" = macosx10.9;
SDKROOT = macosx13.3;
"SDKROOT[arch=*]" = macosx13.3;
};
name = Debug;
};
E99FE4B61A5981FD00F14CF4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD)";
DEAD_CODE_STRIPPING = YES;
GCC_ENABLE_PASCAL_STRINGS = NO;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 13.3;
PRODUCT_NAME = "$(TARGET_NAME)";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
SDKROOT = macosx10.9;
"SDKROOT[arch=*]" = macosx10.9;
SDKROOT = macosx13.3;
"SDKROOT[arch=*]" = macosx13.3;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E99FE4AC1A5981FD00F14CF4"
BuildableName = "hidusb-relay-cmd"
BlueprintName = "hidusb-relay-cmd"
ReferencedContainer = "container:hidusb-relay-cmd.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
viewDebuggingEnabled = "No">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E99FE4AC1A5981FD00F14CF4"
BuildableName = "hidusb-relay-cmd"
BlueprintName = "hidusb-relay-cmd"
ReferencedContainer = "container:hidusb-relay-cmd.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "enum"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E99FE4AC1A5981FD00F14CF4"
BuildableName = "hidusb-relay-cmd"
BlueprintName = "hidusb-relay-cmd"
ReferencedContainer = "container:hidusb-relay-cmd.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "594FDB79-54AF-4144-95D7-75F8EFA6CAAD"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "03AFD72D-14B7-478E-A791-5D8C7D2CC06E"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "usbrelay-cmd.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "315"
endingLineNumber = "315"
landmarkName = "show_relays()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "CBC103C3-C025-416E-920B-A3B3CAADA45C"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "hiddata_osx.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "107"
endingLineNumber = "107"
landmarkName = "usbhidEnumDevices(vendor, product, context)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>hidusb-relay-cmd.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>E99FE4AC1A5981FD00F14CF4</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Empty file modified make_release_osx.sh
100644 → 100755
Empty file.