Skip to content

Commit

Permalink
#80 fixed issue in compiler settings that caused random driver link f…
Browse files Browse the repository at this point in the history
…ailures (some builds worked, some builds didn’t, and the project seemed to break for no reasons).
  • Loading branch information
Wouter1 committed Jul 10, 2016
1 parent f07eb82 commit 1ddd6fc
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 641 deletions.
2 changes: 0 additions & 2 deletions src/EMUUSBAudio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
6CB2722F1A54197B00FA8B61 /* EMUUSBOutputStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6CB2722D1A54197B00FA8B61 /* EMUUSBOutputStream.cpp */; };
6CB272301A54197B00FA8B61 /* EMUUSBOutputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CB2722E1A54197B00FA8B61 /* EMUUSBOutputStream.h */; };
6CE021FE1A5FCE9C00568A82 /* StreamInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6CE021FD1A5FCE9C00568A82 /* StreamInfo.cpp */; };
6CF9CB271D26D53200719B95 /* EMUUSBAudio-Info-11.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CF9CB261D26D53200719B95 /* EMUUSBAudio-Info-11.plist */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -325,7 +324,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6CF9CB271D26D53200719B95 /* EMUUSBAudio-Info-11.plist in Resources */,
6C7735F719E320A000ED3FAA /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
19 changes: 2 additions & 17 deletions src/EMUUSBAudio/EMUUSBAudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,15 @@ IOReturn EMUUSBAudioDevice::protectedInitHardware(IOService * provider) {
mAnchorResetCount = kRefreshCount;
mUpdateTimer = IOTimerEventSource::timerEventSource(this, TimerAction);
FailIf(NULL == mUpdateTimer, Exit);
// TURNED OFF HACK to turn off this update timer.
//workLoop->addEventSource(mUpdateTimer);
TimerAction(this, mUpdateTimer);

// CHECK This bundle was removed as it is not clear what it is for.
// setProperty(kIOAudioEngineCoreAudioPlugInKey, "EMUUSBAudio.kext/Contents/Plugins/EMUHALPlugin.bundle"); //"EMUUSBAudio.kext/Contents/Plugins/
IOService::registerService();
//<AC mod>
// init engine - see what happens
#if 1
// need to make sure we're not crossing paths with a terminating driver (hey, it happens)

// need to make sure we're not crossing paths with a terminating driver (hey, it happens)
if (FALSE == mTerminatingDriver) {
EMUUSBAudioEngine *audioEngine = NULL;
audioEngine = new EMUUSBAudioEngine;
Expand All @@ -345,7 +343,6 @@ IOReturn EMUUSBAudioDevice::protectedInitHardware(IOService * provider) {
audioEngine->release();
mAudioEngine = audioEngine; //used for releasing at end
}
#endif
//</AC mod>
}
Exit:
Expand Down Expand Up @@ -378,27 +375,15 @@ void EMUUSBAudioDevice::checkUHCI() {


void EMUUSBAudioDevice::setupStatusFeedback() {
// IOUSBFindEndpointRequest statusEndpoint;

// statusEndpoint.type = kUSBInterrupt;
// statusEndpoint.direction = kUSBIn;
// statusEndpoint.maxPacketSize = kStatusPacketSize; // is this sizeof(UInt16)
// statusEndpoint.interval = 0xFF;

//mStatusPipe = mControlInterface->findPipe(&statusEndpoint);

mStatusPipe = mControlInterface->findPipe(kUSBIn,kUSBInterrupt);
if (mStatusPipe) {// the endpoint exists
mStatusPipe->retain();// retain until tear down
mDeviceStatusBuffer = (UInt16*) IOMalloc(sizeof(UInt16)); // Is this kStatusPacketSize?
if (mDeviceStatusBuffer) {
mStatusBufferDesc = IOMemoryDescriptor::withAddress(mDeviceStatusBuffer, kStatusPacketSize, kIODirectionIn);
if (mStatusBufferDesc) {
mStatusBufferDesc->prepare();
mStatusCheckCompletion.set((void*) this, statusHandler, 0);
// mStatusCheckCompletion.target = (void*) this;
// mStatusCheckCompletion.action = statusHandler;
// mStatusCheckCompletion.parameter = 0;
mStatusCheckTimer = IOTimerEventSource::timerEventSource(this, StatusAction);
if (mStatusCheckTimer) {
workLoop->addEventSource(mStatusCheckTimer);// add timer action to the workloop
Expand Down
12 changes: 0 additions & 12 deletions src/EMUUSBAudio/EMUUSBAudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1761,15 +1761,11 @@ IOReturn EMUUSBAudioEngine::startUSBStream() {
FailIf (kIOReturnSuccess != resultCode, Exit);

// Acquire a PIPE for the isochronous stream.
//audioIsochEndpoint.type = kUSBIsoc;
//audioIsochEndpoint.direction = usbInputStream.streamDirection;
{
debugIOLogC("createInputPipe");
// usbInputStream.pipe = usbInputStream.streamInterface->findPipe ( &audioIsochEndpoint);
usbInputStream.pipe =
usbInputStream.streamInterface->findPipe (usbInputStream.streamDirection, kUSBIsoc);
FailIf (NULL == usbInputStream.pipe, Exit);
usbInputStream.pipe->retain ();
}

address = usbAudio->GetIsocEndpointAddress(usbInputStream.interfaceNumber, usbInputStream.alternateSettingID, usbInputStream.streamDirection);
Expand Down Expand Up @@ -1803,15 +1799,9 @@ IOReturn EMUUSBAudioEngine::startUSBStream() {
FailIf (kIOReturnSuccess != resultCode, Exit);

debugIOLog("create output pipe ");
//bzero(&audioIsochEndpoint,sizeof(audioIsochEndpoint));
//audioIsochEndpoint.type = kUSBIsoc;
//audioIsochEndpoint.direction = mOutput.streamDirection;
//mOutput.pipe = mOutput.streamInterface->findPipe ( &audioIsochEndpoint);
mOutput.pipe = mOutput.streamInterface->findPipe (mOutput.streamDirection, kUSBIsoc);
FailIf (NULL == mOutput.pipe, Exit);
mOutput.pipe->retain ();
debugIOLog("check for associated endpoint");
//CheckForAssociatedEndpoint (usbAudio,mOutput.interfaceNumber,mOutput.alternateSettingID);// result is ignored

address = usbAudio->GetIsocEndpointAddress(mOutput.interfaceNumber, mOutput.alternateSettingID, mOutput.streamDirection);
maxPacketSize = usbAudio->GetEndpointMaxPacketSize(mOutput.interfaceNumber, mOutput.alternateSettingID, address);
Expand All @@ -1826,9 +1816,7 @@ IOReturn EMUUSBAudioEngine::startUSBStream() {
// When a late error is encountered (USB 2.0), increment the var until a max of 16 frames is reached.
// NB - From testing and observation this work around does not help and has therefore been deleted.
mOutput.frameOffset = 8; // HACK kMinimumFrameOffset + ((kUSBDeviceSpeedHigh == mHubSpeed) * kUSB2FrameOffset);
//mOutput.usbFrameToQueueAt = 0; // INIT as late as possible. mBus->GetFrameNumber() + mOutput.frameOffset; // start on an offset usb frame
mOutput.usbIsocFrames[0].resetTime();
//*(UInt64 *) (&(mOutput.usbIsocFrames[0].frTimeStamp)) = 0xFFFFFFFFFFFFFFFFull;

setRunEraseHead(true); // need it to avoid stutter at start&end and to allow multiple simultaneous playback.

Expand Down
11 changes: 7 additions & 4 deletions src/IOUSBInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ class IOUSBInterface1: public IOUSBInterface {
@param request Requirements for pipe to match, updated with the found pipe's
properties.
@result Pointer to the pipe, or NULL if no pipe matches the request.
@result Pointer to the retained pipe, or NULL if no pipe matches the request.
*/
IOUSBPipe* findPipe(uint8_t direction, uint8_t type) {
IOUSBFindEndpointRequest request;
request.direction = direction;
request.type = type;
request.interval = 0xFF;
request.maxPacketSize = 0;
return FindNextPipe(NULL, &request);
IOUSBPipe* pipe= FindNextPipe(NULL, &request);
if (pipe!=NULL) {
pipe->retain();
}
return pipe;
}

/*! Send a request to the USB device over mControlInterface (default pipe 0?)
Expand Down Expand Up @@ -147,7 +151,7 @@ class IOUSBInterface1: public IOUSBHostInterface {
starting from the beginning of the interface's pipe list
@param direction the direction for the required pipe. eg kUSBInterrupt or kUSBIsoc or kUSBAnyType
@param type the type of the required pipe: kUSBIn or kUSBOut
@result Pointer to the pipe, or NULL if no pipe matches the request.
@result Pointer to the retained pipe, or NULL if no pipe matches the request.
*/
IOUSBPipe* findPipe(uint8_t direction, uint8_t type) {
debugIOLog("+findPipe: dir=%d, type = %d", direction, type);
Expand Down Expand Up @@ -183,7 +187,6 @@ class IOUSBInterface1: public IOUSBHostInterface {
return NULL;
}
debugIOLog("-findpipe: success");
//pipe->release(); // FIXME HACK should be consistent with 10.9
return OSDynamicCast(IOUSBPipe, pipe);
}
}
Expand Down
Binary file modified v11/.DS_Store
Binary file not shown.
Binary file modified v11/EMUUSBAudio.kext/Contents/MacOS/EMUUSBAudio
Binary file not shown.
Loading

0 comments on commit 1ddd6fc

Please sign in to comment.