I created a driver using DriverKit on Intel macOS 12.6.1 and Xcode 13.3. I enabled auto-manage signing, and set the signing certificate to 'Sign to Run Locally'. Then, I created a provision profile for the driver and selected my M1 test device. After installing the profile, I ran the app on the M1 device and successfully activated the driver.
However, when I tried to compile the project on M1 macOS 13.3 with Xcode 14.3.1, I encountered an error. It appears that DriverKit does not support the 'Sign to Run Locally' option on M1 devices. To resolve this issue, I switched to using the 'Apple Development' signing certificate. Unfortunately, even after making this change, I still received an error message regarding 'Sign to Run Locally' from the Xcode console.
Both devices are logged in with the same developer account. Could you please advise me on how to resolve this problem?
iig:
#include <Availability.h>
#include <DriverKit/IOService.iig>
#include <DriverKit/IOUserClient.iig>
//class OSAction;
class epusbfilter: public IOService
{
public:
virtual bool init() override;
virtual kern_return_t Start(IOService * provider) override;
virtual kern_return_t Stop(IOService * provider) override;
virtual void free() override;
virtual kern_return_t GetRegistryEntryID(uint64_t * registryEntryID) override;
};
cpp:
#include <os/log.h>
#include <DriverKit/IOUserServer.h>
#include <DriverKit/IOLib.h>
#include <USBDriverKit/IOUSBHostInterface.h>
#include <USBDriverKit/IOUSBHostPipe.h>
#include "epusbfilter.h"
#define Log(fmt, ...) os_log(OS_LOG_DEFAULT, "epusbfilter - no super," fmt "\n", ##__VA_ARGS__)
struct epusbfilter_IVars
{
IOUSBHostInterface *interface;
IOUSBHostPipe *inPipe;
OSAction *ioCompleteCallback;
IOBufferMemoryDescriptor *inData;
uint16_t maxPacketSize;
};
bool epusbfilter::init() {
bool result = false;
Log("init");
result = super::init();
return result;
}
void epusbfilter::free() {
super::free();
Log("free");
}
kern_return_t
IMPL(epusbfilter, Start)
{
kern_return_t ret;
Log("Start");
ret = Start(provider, SUPERDISPATCH);
return ret;
}
kern_return_t
IMPL(epusbfilter, Stop)
{
kern_return_t ret = kIOReturnSuccess;
Log("Stop");
ret = Stop(provider, SUPERDISPATCH);
return ret;
}
kern_return_t
IMPL(epusbfilter, GetRegistryEntryID) {
Log("GetRegistryEntryID");
return GetRegistryEntryID(registryEntryID, SUPERDISPATCH);
}
info.plist
<?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>IOKitPersonalities</key>
<dict>
<key>epusbfilter</key>
<dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleIdentifierKernel</key>
<string>com.apple.kpi.iokit</string>
<key>IOProviderClass</key>
<string>IOUSBHostInterface</string>
<key>IOClass</key>
<string>IOUserUserClient</string>
<!-- <key>IOResourceMatch</key>-->
<!-- <string>IOKit</string>-->
<key>IOUserClass</key>
<string>epusbfilter</string>
<key>IOUserServerName</key>
<string>com.injection.epusbfilter.dext</string>
<key>bConfigurationValue</key>
<integer>1</integer>-->
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>idVendor</key>
<string>*</string>
<key>idProduct</key>
<string>*</string>
<key>UserClientProperties</key>
<dict>
<key>IOClass</key>
<string>IOUserUserClient</string>
<key>IOUserClass</key>
<string>epusbfilter</string>
</dict>
</dict>
</dict>
</dict>
</plist>
entitlemens:
<?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>com.apple.developer.driverkit</key>
<true/>
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<string>*</string>
<key>idProduct</key>
<string>*</string>
</dict>
</array>
</dict>
</plist>