Re: passing buffer from User Client to Driver
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com G'day Imran, I only have a couple of observations. Can you change "com_MySoftwareCompany" to "com_spsoftindia"? This is what I do when I debug code that I'm sure works. Godfrey On 04/18/2005, at 23:21 , Imran wrote: Hi GodFrey, IOMemoryDescriptor address value in driver = 0x11b2680 Please take your time to go through the code segment of my driver. 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); getProvider()->write(this, byteStart, inBuffer, completion); return retWrite; } _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... can assure you that the IOMemoryDescriptor works and readBytes does return data from user land as expected. So now it is just an exercise in debugging. This is what I'd do, first check the arguments to the memory descriptor, do you have the correct task and virtual address? Does the user land task indeed have the expected data? Have you prepared() the descriptor? Is it still prepared when the I/O is performed, i.e. if the I/O is asynch did you complete() the descriptor prematurely? 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: The Output of readBytes is as follows. MyFilterScheme:: readBytes = 512 byteStart = 0 bufLength = 512 buffer = 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); IOLog("MyFilterScheme:: readBytes = %lu byteStart = %lu bufLength = %lu buffer = %s \n", (long)readBytes, (long)byteStart, (long)bufLength, myBuff); The Outputs are: IOMemoryDescriptor value in driver = 0x11b2680 IOMemoryDescriptor buffer in driver = bufLength = 512 MyFilterScheme:: readBytes = 512 byteStart = 0 bufLength = 512 buffer = This email sent to site_archiver@lists.apple.com
participants (1)
-
Godfrey van der Linden