summaryrefslogtreecommitdiff
path: root/spectro/usbio_ox.c
diff options
context:
space:
mode:
Diffstat (limited to 'spectro/usbio_ox.c')
-rw-r--r--spectro/usbio_ox.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/spectro/usbio_ox.c b/spectro/usbio_ox.c
index 24498fb..c92aed5 100644
--- a/spectro/usbio_ox.c
+++ b/spectro/usbio_ox.c
@@ -186,6 +186,7 @@ icompaths *p
IOObjectRelease(mit); /* Release the itterator */
return rv;
}
+
}
} else {
IOObjectRelease(ioob); /* Release found object */
@@ -402,7 +403,7 @@ char **pnames /* List of process names to try and kill before opening */
/* mess up the Spyder2, BUT we can't do a get config because this */
/* messes up the i1pro-D. */
- /* OS X doesn't do a set_configuration() by default */
+ /* OS X doesn't do a set_configuration() by default, so force one. */
p->cconfig = 0;
if (p->cconfig != config) {
@@ -462,7 +463,7 @@ char **pnames /* List of process names to try and kill before opening */
return ICOM_SYS;
}
(*pluginref)->Stop(pluginref);
- IODestroyPlugInInterface(pluginref);
+ IODestroyPlugInInterface(pluginref); // this stops IOServices though ??
if ((rv = (*(p->usbd->interfaces[i]))->USBInterfaceOpen(
p->usbd->interfaces[i])) != kIOReturnSuccess) {
@@ -703,9 +704,11 @@ static int icoms_usb_transaction(
}
if (cancelt != NULL) {
- usb_lock_cancel(cancelt);
+ amutex_lock(cancelt->cmtx);
cancelt->hcancel = (void *)&req;
- usb_unlock_cancel(cancelt);
+ cancelt->state = 1;
+ amutex_unlock(cancelt->cond); /* Signal any thread waiting for IO start */
+ amutex_unlock(cancelt->cmtx);
}
/* Wait for the callback to complete */
@@ -757,7 +760,7 @@ static int icoms_usb_transaction(
/* If io was aborted, ClearPipeStall */
if (req.result == kIOReturnAborted) {
-#if defined(NEVER) && (InterfaceVersion > 182)
+#if (InterfaceVersion > 182)
(*p->usbd->interfaces[iix])->ClearPipeStallBothEnds(p->usbd->interfaces[iix], pno);
#else
(*p->usbd->interfaces[iix])->ClearPipeStall(p->usbd->interfaces[iix], pno);
@@ -787,9 +790,12 @@ static int icoms_usb_transaction(
done:;
if (cancelt != NULL) {
- usb_lock_cancel(cancelt);
+ amutex_lock(cancelt->cmtx);
cancelt->hcancel = (void *)NULL;
- usb_unlock_cancel(cancelt);
+ if (cancelt->state == 0)
+ amutex_unlock(cancelt->cond);
+ cancelt->state = 2;
+ amutex_unlock(cancelt->cmtx);
}
pthread_cond_destroy(&req.cond);
@@ -865,7 +871,7 @@ int icoms_usb_cancel_io(
) {
int reqrv = ICOM_OK;
- usb_lock_cancel(cancelt);
+ amutex_lock(cancelt->cmtx);
usbio_req *req = (usbio_req *)cancelt->hcancel;
if (req != NULL) {
IOReturn rv;
@@ -875,7 +881,7 @@ int icoms_usb_cancel_io(
reqrv = ICOM_USBW;
}
}
- usb_unlock_cancel(cancelt);
+ amutex_unlock(cancelt->cmtx);
return reqrv;
}
@@ -911,7 +917,7 @@ int icoms_usb_clearhalt(
IOReturn rv;
int irv;
-#if defined(NEVER) && (InterfaceVersion > 182)
+#if (InterfaceVersion > 182)
if ((rv = (*p->usbd->interfaces[iix])->ClearPipeStallBothEnds(
p->usbd->interfaces[iix], pno)) != kIOReturnSuccess) {
a1logd(p->log, 1, "icoms_usb_clearhalt failed with 0x%x\n",rv);