Hello,
I have crated a DriverKit driver for macOS and iPad M-series if I ever get the mac driver working. I have the correct entittlements, and matching provisioning profile downloaded manually. The driver loads (no errors!), and is visible in ioreg below the usb device (when plugged).
The issue is that I never get any log from the driver, have reduced to minimal working code (below). When I debug with lldb, I load the symbols for my driver and break on init and Start - but lldb never triggers == never calls start or init. This is also why no logs. When I unplug the device, the driver process (ps aux) keeps running, causes a hard crash of the Mac with dext remove/or kill driver.dext process.
I have asked Claude - but its just running in circles: check Info.plist=ok, check entitlements=ok, check code (minimal)=ok, check iig=ok, check provisioning profile=ok, check build settings=ok, check ioreg=ok, check code signature=ok, start over
I don't get any log from my driver, which is consistent with init() not being called. All logs from kernel & friends (AMFI) do show the driver loading - no errors.
Any tips appreciated!
// USBDriver.iig
#ifndef USBDriver_h
#define USBDriver_h
#include <USBDriverKit/IOUSBHostInterface.iig>
class USBDriver: public IOService
{
public:
virtual bool init() override;
virtual void free() override;
virtual kern_return_t Start(IOService * provider) override;
virtual kern_return_t Stop(IOService * provider) override;
};
// USBDriver.cpp
#include <os/log.h>
#include <DriverKit/DriverKit.h>
#include "USBDriver.h"
bool USBDriver::init()
{
if (!super::init()) return false;
os_log(OS_LOG_DEFAULT, "terminal.driver: init()");
return true;
}
kern_return_t IMPL(USBDriver, Start) {
os_log(OS_LOG_DEFAULT, "terminal.driver: Start()");
kern_return_t ret = super::Start(provider);
if (ret != kIOReturnSuccess) {
os_log(OS_LOG_DEFAULT, "terminal.driver: super::Start failed: 0x%08x", ret);
return ret;
}
os_log(OS_LOG_DEFAULT, "terminal.driver: Start() success");
return super::Start(provider);
}
kern_return_t IMPL(USBDriver, Stop) {
os_log(OS_LOG_DEFAULT, "terminal.driver: Stop()");
return super::Stop(provider);
}
void USBDriver::free() {
os_log(OS_LOG_DEFAULT, "terminal.driver: free()");
super::free();
}