From: Johannes E. <joh...@er...> - 2002-12-18 19:03:57
|
On Wed, Dec 18, 2002, Nathan Hjelm <hj...@un...> wrote: > On Wed, 18 Dec 2002, Pete Bentley wrote: > > > On Wed, Dec 18, 2002 at 12:17:41PM +0100, Beat Birkhofer wrote: > > > I try to get sane/libusb working on OSX. > > > > > > I get quite far but then the there's a fork() in the sane backend > > > (plustek) I use and then I loose the connection to the IOService. > > > > > > Any ideas how to solve this problem? I'm quite clueless. > > > > I suspect this may be rather tricky to solve... > > > > On most Unixes, the device_handle t libusb uses to communicate > > with the device is a file handle, which will get inherited > > by the child of a fork() call. > > > > On OS X, the IOKit functions that are used to implement libusb > > seem to use mach ports for communicating with the kernel rather > > than file handles... I don't know the semantics of ports well, > > but I'm guessing they don't get shared across a fork() call > > (or at least not without a lot of extra work) > > From what I understand, you are correct, ports are not shared across fork > calls. I am not sure what can be done to fix the problem except by using > threads rather than forks (though, i am not entirely sure that will work > either). > > I am open to suggestions/ideas on how to attack this within libusb so > developers dont have to change their code. This also brings up some interesting questions for libusb 1.0 For asynchronous support, I had plans of implementing a wrapper for poll and select calls, kind of like how adns works, but it sounds like that will complicate matters. Does Darwin have any support for asynchronous communication? JE |