4

Where are the step-by-step instructions to write a generic driver to a USB-connected developer board for MacOS using IOKit/DriverKit (publicly shown in WWDC 2019) in Xcode?

pmdj
  • 22,018
  • 3
  • 52
  • 103
  • What do you need a new driver for? As far as I can tell, the USB port on the MT6320 is connected to a FTDI FT4232H USB-to-UART chip. Out of the box, macOS has an FTDI driver that will create a serial port for the board. Additional drivers are available from FTDI (VCP and D2XX). And if you disable the drivers, you can access the chip with FTDI's MPSSE library. So what should the new driver achieve? – Codo Sep 12 '19 at 11:26
  • 1
    What is an FTDI driver? What is VCP and D2XX? What is MPSSE? @Codo – Shyamal Chandra Apr 06 '20 at 17:02
  • If you plan to create a USB driver for the Azure Sphere Kit, then you'll be out of luck. It doesn't have a USB peripheral that can be programmed with a custom protocol. Instead, it has an FT4232H chip from FTDI that connects the USB port to the microcontroller. It is used with 4 virtual serial ports and a SWD debug port. Drivers for the serial ports are provided by Apple (FTDI drivers). You could go more custom MPSSE (check FTDI web site). It requires no driver - any application can directly use it. If you are looking for a playground for DriverKit, you need to look for other hardware. – Codo Apr 06 '20 at 18:50

1 Answers1

3

The only documentation I'm aware of is:

  1. DriverKit reference
  2. WWDC 2019 Session 702

The DriverKit version of IOKit is intended to have a similar API to the in-kernel IOKit, so I guess they expect you to be familiar with that.

Note that in many cases when writing drivers for USB devices, you don't need to use either DriverKit or a kext, and instead can use the userspace IOUSB libraries directly. You only really need to use DriverKit or a kext if the kernel is the consumer of your driver. You haven't said what your driver will do, so I can't say which is best in your case. DriverKit is still extremely limited, so unless you want to write a HID or serial port driver, there are few reasons to choose it at the moment.

pmdj
  • 22,018
  • 3
  • 52
  • 103
  • 1
    Are there any references that describe step-by-step boilerplate code to get the job done? – Shyamal Chandra Apr 06 '20 at 17:03
  • @ShyamalChandra I'm not aware of any. I'm in the early stages of putting something together myself, but still too early to share. – pmdj Apr 06 '20 at 18:35
  • @ShyamalChandra Note that you haven't really explained what you need the driver to do, and from what you **have** said there is a good chance the regular user space USB API might be a better fit than DriverKit anyway. – pmdj Apr 06 '20 at 18:36
  • I want to allow a way to interface the Azure Sphere Kit with Mac tools similar to the toolset for Windows and Linux currently available. – Shyamal Chandra Apr 06 '20 at 18:38
  • @ShyamalChandra I'm not familiar with the Azure Sphere Kit, but from a quick web search it looks like it's basically a developer board for an embedded processor? If so, you'll want to have one process at a time uploading an image, or interfacing with the device's console, right? The device doesn't need to act as a peripheral that the operating system itself needs to drive - e.g. act as a USB network adapter, or storage device. So the user space IOKit USB APIs should be absolutely sufficient. You can even check if the Linux tools use libusb, and if so, port them directly, as libusb works on mac – pmdj Apr 06 '20 at 19:02