SerialDriverKit

RSS for tag

Develop drivers for serial I/O devices connected to Mac.

Posts under SerialDriverKit tag

31 Posts

Post

Replies

Boosts

Views

Activity

Subclassing Serial Driver Kit (IOUserSerial)
I have a custom serial Device, I have made a driver using USB Serial Driver Kit by sub classing IOUserUSBSerail. Driver Works fine. However I don't have any Control over Read and Write Operations since its taken care by the USBSerialDriver Kit. To overcome this problem I am trying to use Serial driver kit by subclassing the driver from IOUserSerial class. https://developer.apple.com/documentation/serialdriverkit/iouserserial As per the link above , we need to overload the function TxDataAvailable https://developer.apple.com/documentation/serialdriverkit/iouserserial/3433803-txdataavailable My overloaded function is getting called whenever data is available from the application. (I got hold of the application buffer by overloading the ConnectQueues method) For sending the data to USB I also need the size of the data. From the Connect Queue method I have the IOBufferMemoryDescriptor. The getLength method of IOMemoryDescriptor gives me the length of the full buffer which was allocated. It does not give me the actual data length. How can I get the data length in this case
2
0
1.8k
Dec ’22
The DriverKit problems to develop multiple serial USB device
Hi, I am developing a DriverKit driver for a USB device which has multiple serial UARTs connected. Each UART will represent a cu.USBX port on Mac. My driver inherits IOUSBHostDevice class and it matches device ID well. Now, I am going to crate a new class inherits IOUserSerial to implement serial port. However, compiler said no new operator on base class. It seems the base OSObject class prevent to new the subclass as I did in IOKit driver. Since the similar IOUserSerial/IOUserUSBSerial examples are hard to find, I would like to ask if anyone can help me to solve this problem. Any feedback and clue is appreciated. Following are some snippets to show my situation. My IOKit port driver inherits IORS232SerialStreamSync. class KextSerial : public IORS232SerialStreamSync { OSDeclareDefaultStructors( KextSerial ) ; // Constructor & Destructor stuff : } My USB driver could create new KextSerials and initiate them as well. KextSerial * newSerial = new KextSerial; if( !newSerial->init(0, 0) ){ goto FailExit; } However, in my DriverKit port driver inherits IOUserSerial. class DextSerial : public IOUserSerial { : } While I try to new the DextSerial as following. DextSerial * newSerial = new DextSerial; The compiler said "No matching function for call to 'operator new'" Parallelly I have tried IOUserUSBSerial and OSObject, I got the same error message.
3
0
1.1k
Nov ’22
Serial Port Communication in Xamarin iOS
Hello Guys, I'm developing Xamarin form cross-platform application. My Requirement is to communicate with the hardware component using Wi-Fi, Bluetooth LE, and USB. I've already completed Wi-Fi and Ble communication functionalities. Now, I'm trying to implement USB port communication on the iOS app. I don't know the proper way to communicate using USB Port. In the past weeks searched about it on the internet, But Most of the suggestions as need to Register for the MFI Program, and a few suggestions were not needed for MFI. Still, I'm not clear . How to integrate USB communication. Please share with me, if you are guys experienced in the USB port communication Thanks Manikandan K
1
0
1.6k
Sep ’22
USBSerialDriverKit CH340g Not Appearing in /dev
I have a CH340g connected to my M1 MacBook Air running the latest Big Sur 11.2.3. It appeared only one time in /dev, and now will not re-appear. I've tried plugging it in to both ports, unplugging everything except for the CH340g, and also kextunload, kextload on AppleUSBSerial.kext. It does not appear in /dev Has anyone had any luck with this device? Or perhaps some advice?
6
1
5.8k
Jul ’22
memory leak of API IOCreatePlugInInterfaceForService in IOKit
we are developing USB hid library to interact with HID device, however we're facing on memory lacking when we calling IOCreatePlugInInterfaceForService then calling IODestroyPlugInInterface, the memory is not released and each time of calling it take about 0.3 MB Ram, after long time running, the program crash because runout of memory. what should we do in this case to avoid memory leak? // Create a device interface/HANDLE static BOOL CreateHidDeviceInterface(io_object_t deviceObject, HANDLE* pHandle) { BOOL retVal = FALSE; IOCFPlugInInterface** ppPluginInterface = NULL; SInt32 score = 0; IOReturn pluginResult; HRESULT interfaceResult; // Create a plugin so we can create an interface pluginResult = IOCreatePlugInInterfaceForService(deviceObject, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &ppPluginInterface, &score); if (pluginResult == kIOReturnSuccess) { // Create the interface (HANDLE) interfaceResult = (*ppPluginInterface)->QueryInterface(ppPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void**)pHandle); if (interfaceResult == S_OK) { retVal = TRUE; } IODestroyPlugInInterface(ppPluginInterface); } return retVal; }
1
0
1.4k
Apr ’22
Serial Port support for iOS device
I'm new to iOS development. I have some devices that needs to be connected via serial port (read&write, chipset cp210x). I want to know if I can connect the device just using common lightning-usbc cables? Should get MFI first? Or I just using a MFI authenticated lightning-usbc cable is OK? Few more question... where the MFI chipset located? Embedded in the device or in the cable?
0
0
1.1k
Mar ’22
usb to serial / virtual COM
Dear All, I have looked for on this forum an answer to this question : it seems complicated and also depend of the MAC OS version. In fact, my team has developed an USB device. This device works on Windows OS. We have sold the product, it works on different OS versions (7, 10 and 11) This device works also on raspberry PI (linux core). Into these both OS, the product is detected like a serial port : I can use basic application of check that my product is perfectly functional. Now I want use it on MAC OS, my device appears into the list of USB components connected to my MAC. However I'm not able to indicate (or force) the serial port. I read lot of things, kext? ,,, could depend of MAC version however I cannot found a clear process to help me to install a virtual COM on my MAC OS. Do you have link to other forum (more hardware may be)? Do you have any technical documentation about this topic? regards, fu154
0
0
902
Jan ’22
How to create a modem dial using USBSerialDriverKit
I'm developing a modem driver based on DriverKit framework for a USB Ethernet adapater.      The current situation is that I can open the modem port in the /dev/ directory and send/receive data normally, but can't create Modem in the network preferences. I found IOModemSerialStreamSync can be used to create modem in IOKit, but now how to create modem using DriverKit.
4
0
1.6k
Jun ’21
Subclassing Serial Driver Kit (IOUserSerial)
I have a custom serial Device, I have made a driver using USB Serial Driver Kit by sub classing IOUserUSBSerail. Driver Works fine. However I don't have any Control over Read and Write Operations since its taken care by the USBSerialDriver Kit. To overcome this problem I am trying to use Serial driver kit by subclassing the driver from IOUserSerial class. https://developer.apple.com/documentation/serialdriverkit/iouserserial As per the link above , we need to overload the function TxDataAvailable https://developer.apple.com/documentation/serialdriverkit/iouserserial/3433803-txdataavailable My overloaded function is getting called whenever data is available from the application. (I got hold of the application buffer by overloading the ConnectQueues method) For sending the data to USB I also need the size of the data. From the Connect Queue method I have the IOBufferMemoryDescriptor. The getLength method of IOMemoryDescriptor gives me the length of the full buffer which was allocated. It does not give me the actual data length. How can I get the data length in this case
Replies
2
Boosts
0
Views
1.8k
Activity
Dec ’22
The DriverKit problems to develop multiple serial USB device
Hi, I am developing a DriverKit driver for a USB device which has multiple serial UARTs connected. Each UART will represent a cu.USBX port on Mac. My driver inherits IOUSBHostDevice class and it matches device ID well. Now, I am going to crate a new class inherits IOUserSerial to implement serial port. However, compiler said no new operator on base class. It seems the base OSObject class prevent to new the subclass as I did in IOKit driver. Since the similar IOUserSerial/IOUserUSBSerial examples are hard to find, I would like to ask if anyone can help me to solve this problem. Any feedback and clue is appreciated. Following are some snippets to show my situation. My IOKit port driver inherits IORS232SerialStreamSync. class KextSerial : public IORS232SerialStreamSync { OSDeclareDefaultStructors( KextSerial ) ; // Constructor & Destructor stuff : } My USB driver could create new KextSerials and initiate them as well. KextSerial * newSerial = new KextSerial; if( !newSerial->init(0, 0) ){ goto FailExit; } However, in my DriverKit port driver inherits IOUserSerial. class DextSerial : public IOUserSerial { : } While I try to new the DextSerial as following. DextSerial * newSerial = new DextSerial; The compiler said "No matching function for call to 'operator new'" Parallelly I have tried IOUserUSBSerial and OSObject, I got the same error message.
Replies
3
Boosts
0
Views
1.1k
Activity
Nov ’22
Serial Port Communication in Xamarin iOS
Hello Guys, I'm developing Xamarin form cross-platform application. My Requirement is to communicate with the hardware component using Wi-Fi, Bluetooth LE, and USB. I've already completed Wi-Fi and Ble communication functionalities. Now, I'm trying to implement USB port communication on the iOS app. I don't know the proper way to communicate using USB Port. In the past weeks searched about it on the internet, But Most of the suggestions as need to Register for the MFI Program, and a few suggestions were not needed for MFI. Still, I'm not clear . How to integrate USB communication. Please share with me, if you are guys experienced in the USB port communication Thanks Manikandan K
Replies
1
Boosts
0
Views
1.6k
Activity
Sep ’22
USBSerialDriverKit CH340g Not Appearing in /dev
I have a CH340g connected to my M1 MacBook Air running the latest Big Sur 11.2.3. It appeared only one time in /dev, and now will not re-appear. I've tried plugging it in to both ports, unplugging everything except for the CH340g, and also kextunload, kextload on AppleUSBSerial.kext. It does not appear in /dev Has anyone had any luck with this device? Or perhaps some advice?
Replies
6
Boosts
1
Views
5.8k
Activity
Jul ’22
Communicating with a Modem on a Serial Port
how to obtain information about transmission errors such as overrun, framing, parity, and break signals?
Replies
0
Boosts
0
Views
729
Activity
Jul ’22
memory leak of API IOCreatePlugInInterfaceForService in IOKit
we are developing USB hid library to interact with HID device, however we're facing on memory lacking when we calling IOCreatePlugInInterfaceForService then calling IODestroyPlugInInterface, the memory is not released and each time of calling it take about 0.3 MB Ram, after long time running, the program crash because runout of memory. what should we do in this case to avoid memory leak? // Create a device interface/HANDLE static BOOL CreateHidDeviceInterface(io_object_t deviceObject, HANDLE* pHandle) { BOOL retVal = FALSE; IOCFPlugInInterface** ppPluginInterface = NULL; SInt32 score = 0; IOReturn pluginResult; HRESULT interfaceResult; // Create a plugin so we can create an interface pluginResult = IOCreatePlugInInterfaceForService(deviceObject, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &ppPluginInterface, &score); if (pluginResult == kIOReturnSuccess) { // Create the interface (HANDLE) interfaceResult = (*ppPluginInterface)->QueryInterface(ppPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void**)pHandle); if (interfaceResult == S_OK) { retVal = TRUE; } IODestroyPlugInInterface(ppPluginInterface); } return retVal; }
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’22
Serial Port support for iOS device
I'm new to iOS development. I have some devices that needs to be connected via serial port (read&write, chipset cp210x). I want to know if I can connect the device just using common lightning-usbc cables? Should get MFI first? Or I just using a MFI authenticated lightning-usbc cable is OK? Few more question... where the MFI chipset located? Embedded in the device or in the cable?
Replies
0
Boosts
0
Views
1.1k
Activity
Mar ’22
JAILBREAK PROBLEM WITH IPARTNER PRO
why does it show that my MacBook is jailbroken when I open partner pro?
Replies
0
Boosts
0
Views
911
Activity
Feb ’22
usb to serial / virtual COM
Dear All, I have looked for on this forum an answer to this question : it seems complicated and also depend of the MAC OS version. In fact, my team has developed an USB device. This device works on Windows OS. We have sold the product, it works on different OS versions (7, 10 and 11) This device works also on raspberry PI (linux core). Into these both OS, the product is detected like a serial port : I can use basic application of check that my product is perfectly functional. Now I want use it on MAC OS, my device appears into the list of USB components connected to my MAC. However I'm not able to indicate (or force) the serial port. I read lot of things, kext? ,,, could depend of MAC version however I cannot found a clear process to help me to install a virtual COM on my MAC OS. Do you have link to other forum (more hardware may be)? Do you have any technical documentation about this topic? regards, fu154
Replies
0
Boosts
0
Views
902
Activity
Jan ’22
Problem about setting IOTTYBaseName in USBSerialDriverKit
I want know how to set IOTTYBaseName in USBSerialDriverKit.We try to use SetProperties method  inherit from IOService, but the method return -301 error code.
Replies
0
Boosts
0
Views
655
Activity
Oct ’21
How to create a modem dial using USBSerialDriverKit
I'm developing a modem driver based on DriverKit framework for a USB Ethernet adapater.      The current situation is that I can open the modem port in the /dev/ directory and send/receive data normally, but can't create Modem in the network preferences. I found IOModemSerialStreamSync can be used to create modem in IOKit, but now how to create modem using DriverKit.
Replies
4
Boosts
0
Views
1.6k
Activity
Jun ’21