RE: passing buffer from User Client to Driver
RE: passing buffer from User Client to Driver
- Subject: RE: passing buffer from User Client to Driver
- From: "Imran" <email@hidden>
- Date: Tue, 19 Apr 2005 11:51:10 +0530
Hi GodFrey,
As per your reply, I had eliminated the mapping calls and change variables
(vInStruct to InStruct)in my userclient.
But still I am facing the same problem, my IOMemoryDescriptor buffer is not
getting passed from userclient to driver.
When I print the IOMemoryDescriptor address in driver it shows the following
output:
IOMemoryDescriptor address value in driver = 0x11b2680
The Output of readBytes is as follows.
MyFilterScheme:: readBytes = 512 byteStart = 0 bufLength = 512 buffer =
Please take your time to go through the code segment of my driver.
Or do we need to use vm_allocate for achieving the buffer passing from user
space application to the driver through user client.
***********************************************************
// kMyDoWrite
IOReturn
com_MySoftwareCompany_driver_MyFilterScheme::DoDriverWrite(IOMemoryDescripto
r * inBuffer)
{
IOLog("\n Inside com_MySoftwareCompany_driver_MyFilterScheme::myDoWrite
call\n");
IOLog("%s[%p]::%s\n", getName(), this, __FUNCTION__);
IOLog("\n IOMemoryDescriptor value in driver = %p\n", inBuffer);
IOLog("\n IOMemoryDescriptor buffer in driver = %s\n", inBuffer);
IOReturn retDrWrite = kIOReturnSuccess;
IOStorageCompletion completion;
// If the user client's 'open' method was never called, return
kIOReturnNotOpen.
if (!isOpen()) /* if-else Added - 15 Apr 2005 */
{
IOLog("\n Failed to open userclient for the driver....\n");
return kIOReturnNotOpen;
}
else
{
IOLog("\n Userclient is open for the driver....\n");
}
IOByteCount readBytes;
UInt64 byteStart = 0;
IOByteCount bufLength = inBuffer->getLength();
IOLog("\n bufLength = %lu\n", bufLength);
//char *myBuff = new char[bufLength];
char myBuff[512];
IOLog("\n Calling readbytes.......in driver\n");
readBytes = inBuffer->readBytes(0, myBuff, bufLength);
IOLog("MyFilterScheme:: readBytes = %lu byteStart = %lu bufLength = %lu
buffer = %s \n", (long)readBytes, (long)byteStart, (long)bufLength, myBuff);
getProvider()->write(this, byteStart, inBuffer, completion);
return retWrite;
}
The Outputs are:
IOMemoryDescriptor value in driver = 0x11b2680
IOMemoryDescriptor buffer in driver =
bufLength = 512
MyFilterScheme:: readBytes = 512 byteStart = 0 bufLength = 512 buffer =
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden