I am working on a device driver which simply creates a /dev entry a usb device but I am running into problems because in order to call Read or Write on an IOUSBPipe I need a IOMemoryDescriptor. I found some code on the google used in the IOStrorageFamily but it crashes my kernel on a call to write. extern "C" task_t get_aiotask(void); inline task_t get_user_task(void) { task_t utask; utask = get_aiotask(); if (utask == TASK_NULL) return current_task(); else return utask; } IOMemoryDescriptor *uio_to_MD (struct uio *uio) { return IOMemoryDescriptor::withRanges( (IOVirtualRange *) uio->uio_iov, (UInt32) uio->uio_iovcnt, (uio->uio_rw == UIO_READ ) ? kIODirectionIn : kIODirectionOut, (uio->uio_segflg != UIO_SYSSPACE) ? get_user_task() : kernel_task, true ); } I use the IOMemoryDescriptor here: ::write(dev_t dev, struct uio *uio, int ioflag) { IOUSBPipe *out = fInterface->GetPipeObj (2); IOMemoryDescriptor *mem = uio_to_MD(uio); out->Write (mem, 1, 5000, mem->getLength()); return mem->getLength(); } I know everything but the IOMemoryDescriptor is correct because I can write a buffer if I create it in this function. Am I doing something wrong? thanks, -Nathan _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.