how to Implement read and write functionality in DriverKit for IOUserUSBDriver class.

Hi,


I am trying to Write a sample serial driver for mac os Catalina, Since all these kind of drivers has to be moved to User Space (as per wwdc 2019). So I am Planning to use driver kit, usb serial driver Kit and Serial driver kit.


i am using IOUserUSBSerial as my parent class for my driver.

I am not fully clear about data transfer in Dext.

There is TxDataAvailable function for transmitting data. But is override and final function. So i am not able to override the function to handle data transfer.

void TxDataAvailable() override final;

in the developer.apple.com forum description says

--> "The default implementation of this method initiates an asynchronous operation to transmit the buffered data to the device."


So i dont need to handle the data transfer in my driver?

does IOUserUSBSerial class handles the data transfer internally?

how it send/receive data to/from the application layer?

or do i need override data transfer function (TxDataAvailable) of IOUserSerial? (IOUserSerial is the parent class of IOUserUSBSerial class)

If i have to override IOUserSerial::TxDataAvailable() function, how to get the water mark(low, high) states? and do i need to have circular buffers for data intermediate storage?


I need more clarity on below functions too.

1) handleRxPacket

2) RxFreeSpaceAvailable

3) handleInterruptPacket.


I checked below link , but still i am not fully clear how to implement read/write.

https://developer.apple.com/documentation/driverkit/creating_a_driver_using_the_driverkit_sdk?language=objc


Thanks i advance.

Replies

Could you please share your source code of sample serial driver?
Thanks you!