├── LICENSE
├── MyUserUSBInterfaceDriver
├── Info.plist
├── MyUserUSBInterfaceDriver.cpp
├── MyUserUSBInterfaceDriver.entitlements
└── MyUserUSBInterfaceDriver.iig
├── README.md
├── USBApp.xcodeproj
└── project.pbxproj
└── USBApp
├── AppDelegate.swift
├── Assets.xcassets
├── AppIcon.appiconset
│ └── Contents.json
└── Contents.json
├── Base.lproj
└── Main.storyboard
├── ContentView.swift
├── ExtensionManager.swift
├── Info.plist
├── Preview Content
└── Preview Assets.xcassets
│ └── Contents.json
└── USBApp.entitlements
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Scott Knight
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MyUserUSBInterfaceDriver/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | IOKitPersonalities
22 |
23 | MyUserUSBInterfaceDriver
24 |
25 | CFBundleIdentifier
26 | $(PRODUCT_BUNDLE_IDENTIFIER)
27 | IOClass
28 | IOUserService
29 | IOProviderClass
30 | IOUSBHostInterface
31 | IOUserClass
32 | MyUserUSBInterfaceDriver
33 | IOUserServerName
34 | sc.knight.MyUserUSBInterfaceDriver
35 | bConfigurationValue
36 | 0x1
37 | bInterfaceNumber
38 | 0x0
39 |
40 | idVendor
41 | 0x781
42 | idProduct
43 | 0x5530
44 |
45 |
46 | OSBundleUsageDescription
47 | Example user space USB driver
48 |
49 |
50 |
--------------------------------------------------------------------------------
/MyUserUSBInterfaceDriver/MyUserUSBInterfaceDriver.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // MyUserUSBInterfaceDriver.cpp
3 | // MyUserUSBInterfaceDriver
4 | //
5 | // Created by Scott Knight on 6/13/19.
6 | // Copyright © 2019 Scott Knight. All rights reserved.
7 | //
8 |
9 | #include
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #include "MyUserUSBInterfaceDriver.h"
17 |
18 | #define __Require(assertion, exceptionLabel) \
19 | do \
20 | { \
21 | if ( __builtin_expect(!(assertion), 0) ) \
22 | { \
23 | goto exceptionLabel; \
24 | } \
25 | } while ( 0 )
26 |
27 | #define __Require_Action(assertion, exceptionLabel, action) \
28 | do \
29 | { \
30 | if ( __builtin_expect(!(assertion), 0) ) \
31 | { \
32 | { \
33 | action; \
34 | } \
35 | goto exceptionLabel; \
36 | } \
37 | } while ( 0 )
38 |
39 | static const uint32_t kMyEndpointAddress = 1;
40 |
41 | struct MyUserUSBInterfaceDriver_IVars
42 | {
43 | IOUSBHostInterface *interface;
44 | IOUSBHostPipe *inPipe;
45 | OSAction *ioCompleteCallback;
46 | IOBufferMemoryDescriptor *inData;
47 | uint16_t maxPacketSize;
48 | };
49 |
50 | bool
51 | MyUserUSBInterfaceDriver::init()
52 | {
53 | bool result = false;
54 |
55 | os_log(OS_LOG_DEFAULT, "%s", __FUNCTION__);
56 |
57 | result = super::init();
58 | __Require(true == result, Exit);
59 |
60 | ivars = IONewZero(MyUserUSBInterfaceDriver_IVars, 1);
61 | __Require_Action(NULL != ivars, Exit, result = false);
62 |
63 | Exit:
64 | return result;
65 | }
66 |
67 | kern_return_t
68 | IMPL(MyUserUSBInterfaceDriver, Start)
69 | {
70 | kern_return_t ret;
71 | IOUSBStandardEndpointDescriptors descriptors;
72 |
73 | os_log(OS_LOG_DEFAULT, "%s", __FUNCTION__);
74 |
75 | ret = Start(provider, SUPERDISPATCH);
76 | __Require(kIOReturnSuccess == ret, Exit);
77 |
78 | ivars->interface = OSDynamicCast(IOUSBHostInterface, provider);
79 | __Require_Action(NULL != ivars->interface, Exit, ret = kIOReturnNoDevice);
80 |
81 | ret = ivars->interface->Open(this, 0, NULL);
82 | __Require(kIOReturnSuccess == ret, Exit);
83 |
84 | ret = ivars->interface->CopyPipe(kMyEndpointAddress, &ivars->inPipe);
85 | __Require(kIOReturnSuccess == ret, Exit);
86 |
87 | ret = ivars->interface->CreateIOBuffer(kIOMemoryDirectionIn,
88 | ivars->maxPacketSize,
89 | &ivars->inData);
90 | __Require(kIOReturnSuccess == ret, Exit);
91 |
92 | ret = OSAction::Create(this,
93 | MyUserUSBInterfaceDriver_ReadComplete_ID,
94 | IOUSBHostPipe_CompleteAsyncIO_ID,
95 | 0,
96 | &ivars->ioCompleteCallback);
97 | __Require(kIOReturnSuccess == ret, Exit);
98 |
99 | ret = ivars->inPipe->AsyncIO(ivars->inData,
100 | ivars->maxPacketSize,
101 | ivars->ioCompleteCallback,
102 | 0);
103 | __Require(kIOReturnSuccess == ret, Exit);
104 |
105 | // WWDC slides don't show the full function
106 | // i.e. this is still unfinished
107 |
108 | Exit:
109 | return ret;
110 | }
111 |
112 | kern_return_t
113 | IMPL(MyUserUSBInterfaceDriver, Stop)
114 | {
115 | kern_return_t ret = kIOReturnSuccess;
116 |
117 | os_log(OS_LOG_DEFAULT, "%s", __FUNCTION__);
118 |
119 | return ret;
120 | }
121 |
122 | void
123 | MyUserUSBInterfaceDriver::free()
124 | {
125 | os_log(OS_LOG_DEFAULT, "%s", __FUNCTION__);
126 | }
127 |
128 | void
129 | IMPL(MyUserUSBInterfaceDriver, ReadComplete)
130 | {
131 | os_log(OS_LOG_DEFAULT, "%s", __FUNCTION__);
132 | }
133 |
--------------------------------------------------------------------------------
/MyUserUSBInterfaceDriver/MyUserUSBInterfaceDriver.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.driverkit
6 |
7 | com.apple.developer.driverkit.transport.usb
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MyUserUSBInterfaceDriver/MyUserUSBInterfaceDriver.iig:
--------------------------------------------------------------------------------
1 | //
2 | // MyUserUSBInterfaceDriver.iig
3 | // MyUserUSBInterfaceDriver
4 | //
5 | // Created by Scott Knight on 6/13/19.
6 | // Copyright © 2019 Scott Knight. All rights reserved.
7 | //
8 |
9 | #ifndef MyUserUSBInterfaceDriver_h
10 | #define MyUserUSBInterfaceDriver_h
11 |
12 | #include
13 |
14 | class OSAction;
15 |
16 | class MyUserUSBInterfaceDriver: public IOService
17 | {
18 | public:
19 | virtual bool init() override;
20 | virtual kern_return_t Start(IOService *provider) override;
21 | virtual kern_return_t Stop(IOService *provider) override;
22 | virtual void free() override;
23 |
24 | protected:
25 | virtual void ReadComplete(OSAction *action,
26 | IOReturn status,
27 | uint32_t actualByteCount,
28 | uint64_t completionTimestamp);
29 | };
30 |
31 | #endif /* MyUserUSBInterfaceDriver_h */
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # USBApp
2 | A small test app that tries to load a USBDriverKit system extension
3 |
4 | https://developer.apple.com/videos/play/wwdc2019/702/
5 |
6 | You will want to edit the Info.plist of the DriverKit extension to match the Vendor ID and Product ID of a test device you have. Then after you activate the extension, attach the USB device and your DriverKit application should start on demand.
7 |
--------------------------------------------------------------------------------
/USBApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6F55575622B2C4D900139F6B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F55575522B2C4D900139F6B /* AppDelegate.swift */; };
11 | 6F55575822B2C4D900139F6B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F55575722B2C4D900139F6B /* ContentView.swift */; };
12 | 6F55575A22B2C4DB00139F6B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6F55575922B2C4DB00139F6B /* Assets.xcassets */; };
13 | 6F55575D22B2C4DB00139F6B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6F55575C22B2C4DB00139F6B /* Preview Assets.xcassets */; };
14 | 6F55576022B2C4DB00139F6B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F55575E22B2C4DB00139F6B /* Main.storyboard */; };
15 | 6F55577022B2C52C00139F6B /* DriverKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F55576F22B2C52C00139F6B /* DriverKit.framework */; };
16 | 6F55577322B2C52C00139F6B /* MyUserUSBInterfaceDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6F55577222B2C52C00139F6B /* MyUserUSBInterfaceDriver.cpp */; };
17 | 6F55577522B2C52C00139F6B /* MyUserUSBInterfaceDriver.iig in Sources */ = {isa = PBXBuildFile; fileRef = 6F55577422B2C52C00139F6B /* MyUserUSBInterfaceDriver.iig */; };
18 | 6F55577A22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext in Embed System Extensions */ = {isa = PBXBuildFile; fileRef = 6F55576D22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
19 | 6F55578022B2C54300139F6B /* USBDriverKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F55577F22B2C54300139F6B /* USBDriverKit.framework */; };
20 | 6F55578522B2D42900139F6B /* ExtensionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F55578422B2D42900139F6B /* ExtensionManager.swift */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXContainerItemProxy section */
24 | 6F55577822B2C52C00139F6B /* PBXContainerItemProxy */ = {
25 | isa = PBXContainerItemProxy;
26 | containerPortal = 6F55574A22B2C4D900139F6B /* Project object */;
27 | proxyType = 1;
28 | remoteGlobalIDString = 6F55576C22B2C52C00139F6B;
29 | remoteInfo = MyUserUSBInterfaceDriver;
30 | };
31 | /* End PBXContainerItemProxy section */
32 |
33 | /* Begin PBXCopyFilesBuildPhase section */
34 | 6F55577E22B2C52C00139F6B /* Embed System Extensions */ = {
35 | isa = PBXCopyFilesBuildPhase;
36 | buildActionMask = 2147483647;
37 | dstPath = "$(SYSTEM_EXTENSIONS_FOLDER_PATH)";
38 | dstSubfolderSpec = 16;
39 | files = (
40 | 6F55577A22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext in Embed System Extensions */,
41 | );
42 | name = "Embed System Extensions";
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | 6F55578222B2C54300139F6B /* Embed Frameworks */ = {
46 | isa = PBXCopyFilesBuildPhase;
47 | buildActionMask = 2147483647;
48 | dstPath = "";
49 | dstSubfolderSpec = 10;
50 | files = (
51 | );
52 | name = "Embed Frameworks";
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXCopyFilesBuildPhase section */
56 |
57 | /* Begin PBXFileReference section */
58 | 6F55575222B2C4D900139F6B /* USBApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = USBApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
59 | 6F55575522B2C4D900139F6B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
60 | 6F55575722B2C4D900139F6B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
61 | 6F55575922B2C4DB00139F6B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
62 | 6F55575C22B2C4DB00139F6B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
63 | 6F55575F22B2C4DB00139F6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
64 | 6F55576122B2C4DB00139F6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
65 | 6F55576222B2C4DB00139F6B /* USBApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = USBApp.entitlements; sourceTree = ""; };
66 | 6F55576D22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext */ = {isa = PBXFileReference; explicitFileType = "wrapper.driver-extension"; includeInIndex = 0; path = sc.knight.MyUserUSBInterfaceDriver.dext; sourceTree = BUILT_PRODUCTS_DIR; };
67 | 6F55576F22B2C52C00139F6B /* DriverKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DriverKit.framework; path = System/Library/Frameworks/DriverKit.framework; sourceTree = SDKROOT; };
68 | 6F55577222B2C52C00139F6B /* MyUserUSBInterfaceDriver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MyUserUSBInterfaceDriver.cpp; sourceTree = ""; };
69 | 6F55577422B2C52C00139F6B /* MyUserUSBInterfaceDriver.iig */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.iig; path = MyUserUSBInterfaceDriver.iig; sourceTree = ""; };
70 | 6F55577622B2C52C00139F6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
71 | 6F55577722B2C52C00139F6B /* MyUserUSBInterfaceDriver.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MyUserUSBInterfaceDriver.entitlements; sourceTree = ""; };
72 | 6F55577F22B2C54300139F6B /* USBDriverKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = USBDriverKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk/System/DriverKit/System/Library/Frameworks/USBDriverKit.framework; sourceTree = DEVELOPER_DIR; };
73 | 6F55578422B2D42900139F6B /* ExtensionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionManager.swift; sourceTree = ""; };
74 | /* End PBXFileReference section */
75 |
76 | /* Begin PBXFrameworksBuildPhase section */
77 | 6F55574F22B2C4D900139F6B /* Frameworks */ = {
78 | isa = PBXFrameworksBuildPhase;
79 | buildActionMask = 2147483647;
80 | files = (
81 | );
82 | runOnlyForDeploymentPostprocessing = 0;
83 | };
84 | 6F55576A22B2C52C00139F6B /* Frameworks */ = {
85 | isa = PBXFrameworksBuildPhase;
86 | buildActionMask = 2147483647;
87 | files = (
88 | 6F55578022B2C54300139F6B /* USBDriverKit.framework in Frameworks */,
89 | 6F55577022B2C52C00139F6B /* DriverKit.framework in Frameworks */,
90 | );
91 | runOnlyForDeploymentPostprocessing = 0;
92 | };
93 | /* End PBXFrameworksBuildPhase section */
94 |
95 | /* Begin PBXGroup section */
96 | 6F55574922B2C4D900139F6B = {
97 | isa = PBXGroup;
98 | children = (
99 | 6F55575422B2C4D900139F6B /* USBApp */,
100 | 6F55577122B2C52C00139F6B /* MyUserUSBInterfaceDriver */,
101 | 6F55576E22B2C52C00139F6B /* Frameworks */,
102 | 6F55575322B2C4D900139F6B /* Products */,
103 | );
104 | sourceTree = "";
105 | };
106 | 6F55575322B2C4D900139F6B /* Products */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 6F55575222B2C4D900139F6B /* USBApp.app */,
110 | 6F55576D22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext */,
111 | );
112 | name = Products;
113 | sourceTree = "";
114 | };
115 | 6F55575422B2C4D900139F6B /* USBApp */ = {
116 | isa = PBXGroup;
117 | children = (
118 | 6F55575522B2C4D900139F6B /* AppDelegate.swift */,
119 | 6F55575722B2C4D900139F6B /* ContentView.swift */,
120 | 6F55578422B2D42900139F6B /* ExtensionManager.swift */,
121 | 6F55575922B2C4DB00139F6B /* Assets.xcassets */,
122 | 6F55575E22B2C4DB00139F6B /* Main.storyboard */,
123 | 6F55576122B2C4DB00139F6B /* Info.plist */,
124 | 6F55576222B2C4DB00139F6B /* USBApp.entitlements */,
125 | 6F55575B22B2C4DB00139F6B /* Preview Content */,
126 | );
127 | path = USBApp;
128 | sourceTree = "";
129 | };
130 | 6F55575B22B2C4DB00139F6B /* Preview Content */ = {
131 | isa = PBXGroup;
132 | children = (
133 | 6F55575C22B2C4DB00139F6B /* Preview Assets.xcassets */,
134 | );
135 | path = "Preview Content";
136 | sourceTree = "";
137 | };
138 | 6F55576E22B2C52C00139F6B /* Frameworks */ = {
139 | isa = PBXGroup;
140 | children = (
141 | 6F55577F22B2C54300139F6B /* USBDriverKit.framework */,
142 | 6F55576F22B2C52C00139F6B /* DriverKit.framework */,
143 | );
144 | name = Frameworks;
145 | sourceTree = "";
146 | };
147 | 6F55577122B2C52C00139F6B /* MyUserUSBInterfaceDriver */ = {
148 | isa = PBXGroup;
149 | children = (
150 | 6F55577222B2C52C00139F6B /* MyUserUSBInterfaceDriver.cpp */,
151 | 6F55577422B2C52C00139F6B /* MyUserUSBInterfaceDriver.iig */,
152 | 6F55577622B2C52C00139F6B /* Info.plist */,
153 | 6F55577722B2C52C00139F6B /* MyUserUSBInterfaceDriver.entitlements */,
154 | );
155 | path = MyUserUSBInterfaceDriver;
156 | sourceTree = "";
157 | };
158 | /* End PBXGroup section */
159 |
160 | /* Begin PBXHeadersBuildPhase section */
161 | 6F55576822B2C52C00139F6B /* Headers */ = {
162 | isa = PBXHeadersBuildPhase;
163 | buildActionMask = 2147483647;
164 | files = (
165 | );
166 | runOnlyForDeploymentPostprocessing = 0;
167 | };
168 | /* End PBXHeadersBuildPhase section */
169 |
170 | /* Begin PBXNativeTarget section */
171 | 6F55575122B2C4D900139F6B /* USBApp */ = {
172 | isa = PBXNativeTarget;
173 | buildConfigurationList = 6F55576522B2C4DB00139F6B /* Build configuration list for PBXNativeTarget "USBApp" */;
174 | buildPhases = (
175 | 6F55574E22B2C4D900139F6B /* Sources */,
176 | 6F55574F22B2C4D900139F6B /* Frameworks */,
177 | 6F55575022B2C4D900139F6B /* Resources */,
178 | 6F55577E22B2C52C00139F6B /* Embed System Extensions */,
179 | );
180 | buildRules = (
181 | );
182 | dependencies = (
183 | 6F55577922B2C52C00139F6B /* PBXTargetDependency */,
184 | );
185 | name = USBApp;
186 | productName = USBApp;
187 | productReference = 6F55575222B2C4D900139F6B /* USBApp.app */;
188 | productType = "com.apple.product-type.application";
189 | };
190 | 6F55576C22B2C52C00139F6B /* MyUserUSBInterfaceDriver */ = {
191 | isa = PBXNativeTarget;
192 | buildConfigurationList = 6F55577B22B2C52C00139F6B /* Build configuration list for PBXNativeTarget "MyUserUSBInterfaceDriver" */;
193 | buildPhases = (
194 | 6F55576822B2C52C00139F6B /* Headers */,
195 | 6F55576922B2C52C00139F6B /* Sources */,
196 | 6F55576A22B2C52C00139F6B /* Frameworks */,
197 | 6F55576B22B2C52C00139F6B /* Resources */,
198 | 6F55578222B2C54300139F6B /* Embed Frameworks */,
199 | );
200 | buildRules = (
201 | );
202 | dependencies = (
203 | );
204 | name = MyUserUSBInterfaceDriver;
205 | productName = MyUserUSBInterfaceDriver;
206 | productReference = 6F55576D22B2C52C00139F6B /* sc.knight.MyUserUSBInterfaceDriver.dext */;
207 | productType = "com.apple.product-type.driver-extension";
208 | };
209 | /* End PBXNativeTarget section */
210 |
211 | /* Begin PBXProject section */
212 | 6F55574A22B2C4D900139F6B /* Project object */ = {
213 | isa = PBXProject;
214 | attributes = {
215 | LastSwiftUpdateCheck = 1100;
216 | LastUpgradeCheck = 1100;
217 | ORGANIZATIONNAME = "Scott Knight";
218 | TargetAttributes = {
219 | 6F55575122B2C4D900139F6B = {
220 | CreatedOnToolsVersion = 11.0;
221 | };
222 | 6F55576C22B2C52C00139F6B = {
223 | CreatedOnToolsVersion = 11.0;
224 | };
225 | };
226 | };
227 | buildConfigurationList = 6F55574D22B2C4D900139F6B /* Build configuration list for PBXProject "USBApp" */;
228 | compatibilityVersion = "Xcode 9.3";
229 | developmentRegion = en;
230 | hasScannedForEncodings = 0;
231 | knownRegions = (
232 | en,
233 | Base,
234 | );
235 | mainGroup = 6F55574922B2C4D900139F6B;
236 | productRefGroup = 6F55575322B2C4D900139F6B /* Products */;
237 | projectDirPath = "";
238 | projectRoot = "";
239 | targets = (
240 | 6F55575122B2C4D900139F6B /* USBApp */,
241 | 6F55576C22B2C52C00139F6B /* MyUserUSBInterfaceDriver */,
242 | );
243 | };
244 | /* End PBXProject section */
245 |
246 | /* Begin PBXResourcesBuildPhase section */
247 | 6F55575022B2C4D900139F6B /* Resources */ = {
248 | isa = PBXResourcesBuildPhase;
249 | buildActionMask = 2147483647;
250 | files = (
251 | 6F55576022B2C4DB00139F6B /* Main.storyboard in Resources */,
252 | 6F55575D22B2C4DB00139F6B /* Preview Assets.xcassets in Resources */,
253 | 6F55575A22B2C4DB00139F6B /* Assets.xcassets in Resources */,
254 | );
255 | runOnlyForDeploymentPostprocessing = 0;
256 | };
257 | 6F55576B22B2C52C00139F6B /* Resources */ = {
258 | isa = PBXResourcesBuildPhase;
259 | buildActionMask = 2147483647;
260 | files = (
261 | );
262 | runOnlyForDeploymentPostprocessing = 0;
263 | };
264 | /* End PBXResourcesBuildPhase section */
265 |
266 | /* Begin PBXSourcesBuildPhase section */
267 | 6F55574E22B2C4D900139F6B /* Sources */ = {
268 | isa = PBXSourcesBuildPhase;
269 | buildActionMask = 2147483647;
270 | files = (
271 | 6F55575822B2C4D900139F6B /* ContentView.swift in Sources */,
272 | 6F55575622B2C4D900139F6B /* AppDelegate.swift in Sources */,
273 | 6F55578522B2D42900139F6B /* ExtensionManager.swift in Sources */,
274 | );
275 | runOnlyForDeploymentPostprocessing = 0;
276 | };
277 | 6F55576922B2C52C00139F6B /* Sources */ = {
278 | isa = PBXSourcesBuildPhase;
279 | buildActionMask = 2147483647;
280 | files = (
281 | 6F55577322B2C52C00139F6B /* MyUserUSBInterfaceDriver.cpp in Sources */,
282 | 6F55577522B2C52C00139F6B /* MyUserUSBInterfaceDriver.iig in Sources */,
283 | );
284 | runOnlyForDeploymentPostprocessing = 0;
285 | };
286 | /* End PBXSourcesBuildPhase section */
287 |
288 | /* Begin PBXTargetDependency section */
289 | 6F55577922B2C52C00139F6B /* PBXTargetDependency */ = {
290 | isa = PBXTargetDependency;
291 | target = 6F55576C22B2C52C00139F6B /* MyUserUSBInterfaceDriver */;
292 | targetProxy = 6F55577822B2C52C00139F6B /* PBXContainerItemProxy */;
293 | };
294 | /* End PBXTargetDependency section */
295 |
296 | /* Begin PBXVariantGroup section */
297 | 6F55575E22B2C4DB00139F6B /* Main.storyboard */ = {
298 | isa = PBXVariantGroup;
299 | children = (
300 | 6F55575F22B2C4DB00139F6B /* Base */,
301 | );
302 | name = Main.storyboard;
303 | sourceTree = "";
304 | };
305 | /* End PBXVariantGroup section */
306 |
307 | /* Begin XCBuildConfiguration section */
308 | 6F55576322B2C4DB00139F6B /* Debug */ = {
309 | isa = XCBuildConfiguration;
310 | buildSettings = {
311 | ALWAYS_SEARCH_USER_PATHS = NO;
312 | CLANG_ANALYZER_NONNULL = YES;
313 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
315 | CLANG_CXX_LIBRARY = "libc++";
316 | CLANG_ENABLE_MODULES = YES;
317 | CLANG_ENABLE_OBJC_ARC = YES;
318 | CLANG_ENABLE_OBJC_WEAK = YES;
319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
320 | CLANG_WARN_BOOL_CONVERSION = YES;
321 | CLANG_WARN_COMMA = YES;
322 | CLANG_WARN_CONSTANT_CONVERSION = YES;
323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
326 | CLANG_WARN_EMPTY_BODY = YES;
327 | CLANG_WARN_ENUM_CONVERSION = YES;
328 | CLANG_WARN_INFINITE_RECURSION = YES;
329 | CLANG_WARN_INT_CONVERSION = YES;
330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
335 | CLANG_WARN_STRICT_PROTOTYPES = YES;
336 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
337 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
338 | CLANG_WARN_UNREACHABLE_CODE = YES;
339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
340 | COPY_PHASE_STRIP = NO;
341 | DEBUG_INFORMATION_FORMAT = dwarf;
342 | ENABLE_STRICT_OBJC_MSGSEND = YES;
343 | ENABLE_TESTABILITY = YES;
344 | GCC_C_LANGUAGE_STANDARD = gnu11;
345 | GCC_DYNAMIC_NO_PIC = NO;
346 | GCC_NO_COMMON_BLOCKS = YES;
347 | GCC_OPTIMIZATION_LEVEL = 0;
348 | GCC_PREPROCESSOR_DEFINITIONS = (
349 | "DEBUG=1",
350 | "$(inherited)",
351 | );
352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
354 | GCC_WARN_UNDECLARED_SELECTOR = YES;
355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
356 | GCC_WARN_UNUSED_FUNCTION = YES;
357 | GCC_WARN_UNUSED_VARIABLE = YES;
358 | MACOSX_DEPLOYMENT_TARGET = 10.15;
359 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
360 | MTL_FAST_MATH = YES;
361 | ONLY_ACTIVE_ARCH = YES;
362 | SDKROOT = macosx;
363 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
364 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
365 | };
366 | name = Debug;
367 | };
368 | 6F55576422B2C4DB00139F6B /* Release */ = {
369 | isa = XCBuildConfiguration;
370 | buildSettings = {
371 | ALWAYS_SEARCH_USER_PATHS = NO;
372 | CLANG_ANALYZER_NONNULL = YES;
373 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
375 | CLANG_CXX_LIBRARY = "libc++";
376 | CLANG_ENABLE_MODULES = YES;
377 | CLANG_ENABLE_OBJC_ARC = YES;
378 | CLANG_ENABLE_OBJC_WEAK = YES;
379 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
380 | CLANG_WARN_BOOL_CONVERSION = YES;
381 | CLANG_WARN_COMMA = YES;
382 | CLANG_WARN_CONSTANT_CONVERSION = YES;
383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
385 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
386 | CLANG_WARN_EMPTY_BODY = YES;
387 | CLANG_WARN_ENUM_CONVERSION = YES;
388 | CLANG_WARN_INFINITE_RECURSION = YES;
389 | CLANG_WARN_INT_CONVERSION = YES;
390 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
391 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
392 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
393 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
394 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
395 | CLANG_WARN_STRICT_PROTOTYPES = YES;
396 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
397 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
398 | CLANG_WARN_UNREACHABLE_CODE = YES;
399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
400 | COPY_PHASE_STRIP = NO;
401 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
402 | ENABLE_NS_ASSERTIONS = NO;
403 | ENABLE_STRICT_OBJC_MSGSEND = YES;
404 | GCC_C_LANGUAGE_STANDARD = gnu11;
405 | GCC_NO_COMMON_BLOCKS = YES;
406 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
407 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
408 | GCC_WARN_UNDECLARED_SELECTOR = YES;
409 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
410 | GCC_WARN_UNUSED_FUNCTION = YES;
411 | GCC_WARN_UNUSED_VARIABLE = YES;
412 | MACOSX_DEPLOYMENT_TARGET = 10.15;
413 | MTL_ENABLE_DEBUG_INFO = NO;
414 | MTL_FAST_MATH = YES;
415 | SDKROOT = macosx;
416 | SWIFT_COMPILATION_MODE = wholemodule;
417 | SWIFT_OPTIMIZATION_LEVEL = "-O";
418 | };
419 | name = Release;
420 | };
421 | 6F55576622B2C4DB00139F6B /* Debug */ = {
422 | isa = XCBuildConfiguration;
423 | buildSettings = {
424 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
425 | CODE_SIGN_ENTITLEMENTS = USBApp/USBApp.entitlements;
426 | CODE_SIGN_STYLE = Automatic;
427 | COMBINE_HIDPI_IMAGES = YES;
428 | DEVELOPMENT_ASSET_PATHS = "USBApp/Preview\\ Content";
429 | DEVELOPMENT_TEAM = "";
430 | ENABLE_PREVIEWS = YES;
431 | INFOPLIST_FILE = USBApp/Info.plist;
432 | LD_RUNPATH_SEARCH_PATHS = (
433 | "$(inherited)",
434 | "@executable_path/../Frameworks",
435 | );
436 | PRODUCT_BUNDLE_IDENTIFIER = sc.knight.USBApp;
437 | PRODUCT_NAME = "$(TARGET_NAME)";
438 | SWIFT_VERSION = 5.0;
439 | };
440 | name = Debug;
441 | };
442 | 6F55576722B2C4DB00139F6B /* Release */ = {
443 | isa = XCBuildConfiguration;
444 | buildSettings = {
445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
446 | CODE_SIGN_ENTITLEMENTS = USBApp/USBApp.entitlements;
447 | CODE_SIGN_STYLE = Automatic;
448 | COMBINE_HIDPI_IMAGES = YES;
449 | DEVELOPMENT_ASSET_PATHS = "USBApp/Preview\\ Content";
450 | DEVELOPMENT_TEAM = "";
451 | ENABLE_PREVIEWS = YES;
452 | INFOPLIST_FILE = USBApp/Info.plist;
453 | LD_RUNPATH_SEARCH_PATHS = (
454 | "$(inherited)",
455 | "@executable_path/../Frameworks",
456 | );
457 | PRODUCT_BUNDLE_IDENTIFIER = sc.knight.USBApp;
458 | PRODUCT_NAME = "$(TARGET_NAME)";
459 | SWIFT_VERSION = 5.0;
460 | };
461 | name = Release;
462 | };
463 | 6F55577C22B2C52C00139F6B /* Debug */ = {
464 | isa = XCBuildConfiguration;
465 | buildSettings = {
466 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
467 | CODE_SIGN_ENTITLEMENTS = MyUserUSBInterfaceDriver/MyUserUSBInterfaceDriver.entitlements;
468 | CODE_SIGN_STYLE = Automatic;
469 | DEVELOPMENT_TEAM = "";
470 | DRIVERKIT_DEPLOYMENT_TARGET = 19.0;
471 | FRAMEWORK_SEARCH_PATHS = (
472 | "$(inherited)",
473 | "$(SDKROOT)/System/DriverKit/System/Library/Frameworks",
474 | );
475 | INFOPLIST_FILE = MyUserUSBInterfaceDriver/Info.plist;
476 | PRODUCT_BUNDLE_IDENTIFIER = sc.knight.MyUserUSBInterfaceDriver;
477 | PRODUCT_NAME = "$(inherited)";
478 | SDKROOT = driverkit;
479 | SKIP_INSTALL = YES;
480 | };
481 | name = Debug;
482 | };
483 | 6F55577D22B2C52C00139F6B /* Release */ = {
484 | isa = XCBuildConfiguration;
485 | buildSettings = {
486 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
487 | CODE_SIGN_ENTITLEMENTS = MyUserUSBInterfaceDriver/MyUserUSBInterfaceDriver.entitlements;
488 | CODE_SIGN_STYLE = Automatic;
489 | DEVELOPMENT_TEAM = "";
490 | DRIVERKIT_DEPLOYMENT_TARGET = 19.0;
491 | FRAMEWORK_SEARCH_PATHS = (
492 | "$(inherited)",
493 | "$(SDKROOT)/System/DriverKit/System/Library/Frameworks",
494 | );
495 | INFOPLIST_FILE = MyUserUSBInterfaceDriver/Info.plist;
496 | PRODUCT_BUNDLE_IDENTIFIER = sc.knight.MyUserUSBInterfaceDriver;
497 | PRODUCT_NAME = "$(inherited)";
498 | SDKROOT = driverkit;
499 | SKIP_INSTALL = YES;
500 | };
501 | name = Release;
502 | };
503 | /* End XCBuildConfiguration section */
504 |
505 | /* Begin XCConfigurationList section */
506 | 6F55574D22B2C4D900139F6B /* Build configuration list for PBXProject "USBApp" */ = {
507 | isa = XCConfigurationList;
508 | buildConfigurations = (
509 | 6F55576322B2C4DB00139F6B /* Debug */,
510 | 6F55576422B2C4DB00139F6B /* Release */,
511 | );
512 | defaultConfigurationIsVisible = 0;
513 | defaultConfigurationName = Release;
514 | };
515 | 6F55576522B2C4DB00139F6B /* Build configuration list for PBXNativeTarget "USBApp" */ = {
516 | isa = XCConfigurationList;
517 | buildConfigurations = (
518 | 6F55576622B2C4DB00139F6B /* Debug */,
519 | 6F55576722B2C4DB00139F6B /* Release */,
520 | );
521 | defaultConfigurationIsVisible = 0;
522 | defaultConfigurationName = Release;
523 | };
524 | 6F55577B22B2C52C00139F6B /* Build configuration list for PBXNativeTarget "MyUserUSBInterfaceDriver" */ = {
525 | isa = XCConfigurationList;
526 | buildConfigurations = (
527 | 6F55577C22B2C52C00139F6B /* Debug */,
528 | 6F55577D22B2C52C00139F6B /* Release */,
529 | );
530 | defaultConfigurationIsVisible = 0;
531 | defaultConfigurationName = Release;
532 | };
533 | /* End XCConfigurationList section */
534 | };
535 | rootObject = 6F55574A22B2C4D900139F6B /* Project object */;
536 | }
537 |
--------------------------------------------------------------------------------
/USBApp/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // USBApp
4 | //
5 | // Created by Scott Knight on 6/13/19.
6 | // Copyright © 2019 Scott Knight. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import SwiftUI
11 |
12 | @NSApplicationMain
13 | class AppDelegate: NSObject, NSApplicationDelegate {
14 |
15 | var window: NSWindow!
16 |
17 |
18 | func applicationDidFinishLaunching(_ aNotification: Notification) {
19 | // Insert code here to initialize your application
20 | window = NSWindow(
21 | contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
22 | styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
23 | backing: .buffered, defer: false)
24 | window.center()
25 | window.setFrameAutosaveName("Main Window")
26 |
27 | window.contentView = NSHostingView(rootView: ContentView())
28 |
29 | window.makeKeyAndOrderFront(nil)
30 | }
31 |
32 | func applicationWillTerminate(_ aNotification: Notification) {
33 | // Insert code here to tear down your application
34 | }
35 |
36 |
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/USBApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/USBApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/USBApp/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
--------------------------------------------------------------------------------
/USBApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // USBApp
4 | //
5 | // Created by Scott Knight on 6/13/19.
6 | // Copyright © 2019 Scott Knight. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 | import SystemExtensions
11 |
12 | struct ContentView : View {
13 | var body: some View {
14 | VStack {
15 | Text("USBApp")
16 | HStack {
17 | Button(action: ExtensionManager.shared.activate) {
18 | Text("Activate")
19 | }
20 | Button(action: ExtensionManager.shared.deactivate) {
21 | Text("Deactivate")
22 | }
23 | }
24 | }
25 | .frame(maxWidth: .infinity, maxHeight: .infinity)
26 | }
27 | }
28 |
29 |
30 | #if DEBUG
31 | struct ContentView_Previews : PreviewProvider {
32 | static var previews: some View {
33 | ContentView()
34 | }
35 | }
36 | #endif
37 |
--------------------------------------------------------------------------------
/USBApp/ExtensionManager.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ExtensionDelegate.swift
3 | // USBApp
4 | //
5 | // Created by Scott Knight on 6/13/19.
6 | // Copyright © 2019 Scott Knight. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import SystemExtensions
11 | import os.log
12 |
13 | class ExtensionManager : NSObject, OSSystemExtensionRequestDelegate {
14 |
15 | static let shared = ExtensionManager()
16 |
17 | func activate() {
18 | let activationRequest = OSSystemExtensionRequest.activationRequest(forExtensionWithIdentifier: "sc.knight.MyUserUSBInterfaceDriver", queue: .main)
19 | activationRequest.delegate = self
20 | OSSystemExtensionManager.shared.submitRequest(activationRequest)
21 | }
22 |
23 | func deactivate() {
24 | // This doesn't seem to work in b1 not sure why
25 | let activationRequest = OSSystemExtensionRequest.deactivationRequest(forExtensionWithIdentifier: "sc.knight.MyUserUSBInterfaceDriver", queue: .main)
26 | activationRequest.delegate = self
27 | OSSystemExtensionManager.shared.submitRequest(activationRequest)
28 | }
29 |
30 | func request(_ request: OSSystemExtensionRequest, actionForReplacingExtension existing: OSSystemExtensionProperties, withExtension ext: OSSystemExtensionProperties) -> OSSystemExtensionRequest.ReplacementAction {
31 | os_log("sysex actionForReplacingExtension %@ %@", existing, ext)
32 |
33 | return .replace
34 | }
35 |
36 | func requestNeedsUserApproval(_ request: OSSystemExtensionRequest) {
37 | os_log("sysex needsUserApproval")
38 |
39 | }
40 |
41 | func request(_ request: OSSystemExtensionRequest, didFinishWithResult result: OSSystemExtensionRequest.Result) {
42 | os_log("sysex didFinishWithResult %@", result.rawValue)
43 |
44 | }
45 |
46 | func request(_ request: OSSystemExtensionRequest, didFailWithError error: Error) {
47 | os_log("sysex didFailWithError %@", error.localizedDescription)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/USBApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | Copyright © 2019 Scott Knight. All rights reserved.
27 | NSMainStoryboardFile
28 | Main
29 | NSPrincipalClass
30 | NSApplication
31 | NSSupportsAutomaticTermination
32 |
33 | NSSupportsSuddenTermination
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/USBApp/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/USBApp/USBApp.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.system-extension.install
6 |
7 | com.apple.developer.system-extension.uninstall
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------