How does the driverkit serve as a … | Apple Developer Forums
How does the driverkit serve as a bridge between hardware and the system? App & System Services Drivers USBDriverKit DriverKit BlockStorageDeviceDriverKit You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications. You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity.
Click again to start watching. emerys OP Created Nov ’23 Replies 1 Boosts 0 Views 915 Participants 2 I want to use DriverKit to develop a USBDriver, which serves as a bridge between USB devices and the system. All messages between USB devices and the system will be forwarded through the USBDriver. Can anyone give me some tips or suggestions? What API should I use? I couldn't find anything like this in the documentation or sample code. class MyUSBDriver: public IOUserClient { 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; virtual kern_return_t NewUserClient(uint32_t type, IOUserClient** userClient) override; virtual kern_return_t ExternalMethod(uint64_t selector, IOUserClientMethodArguments* arguments, const IOUserClientMethodDispatch* dispatch, OSObject* target, void* reference) override; }; I am now able to retrieve the device descriptor in the Start method IOUSBHostDevice *device = OSDynamicCast(IOUSBHostDevice, provider); if (device) { const IOUSBDeviceDescriptor *deviceDescriptor = device->CopyDeviceDescriptor(); if (deviceDescriptor) { uint16_t idVendor = deviceDescriptor->idVendor; uint16_t idProduct = deviceDescriptor->idProduct; uint8_t iSerialNumber = deviceDescriptor->iSerialNumber; IOUSBHostFreeDescriptor(deviceDescriptor); } } Replies 1 Boosts 0 Views 915 Participants 2 DTS Engineer OP Apple 1d I want to use DriverKit to develop a USBDriver, which serves as a bridge between USB devices and the system.
All messages between USB devices and the system will be forwarded through the USBDriver. Why? What are you actually trying to do? There are actually three different cases here: If you're just trying to exchange commands with a USB device on macOS, then you don't need to use DriverKit, as the IOUSBHost framework will do everything you need. If you're trying to do the same thing as #1 but on iPadOS, then you'll need to use DriverKit to communicate with the device and a custom user client to talk to the device.
This sample project shows how a basic user client functions. If you're trying to integrate a device into the system, then you'll need to combine those higher-level families ( AudioDriverKit , NetworkingDriverKit , HIDDriverKit , etc.). The details of how that process works vary by family, but most of the higher-level families have WWDC videos which provide an overview of how the family functions. Which category does your driver fall under?
Can anyone give me some tips or suggestions? I'd start by reviewing the start of this forum post , my " Basic introduction to DEXT Matching and Loading " post, then go through the longer IOKit resources linked to in both posts, and finally go to resource like the videos I mentioned above. __ Kevin Elliott DTS Engineer, CoreOS/Hardware Add comment