Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working 10.11 version of driver #80

Closed
Wouter1 opened this issue Jul 1, 2016 · 59 comments
Closed

Working 10.11 version of driver #80

Wouter1 opened this issue Jul 1, 2016 · 59 comments

Comments

@Wouter1
Copy link
Owner

Wouter1 commented Jul 1, 2016

Let's see if we can get the 10.11 version of the driver actually working

@Wouter1 Wouter1 changed the title Debug 10.11 version of driver Working 10.11 version of driver Jul 1, 2016
@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

First run gives kernel panic.

*** Panic Report ***
panic(cpu 0 caller 0xffffff80107ce40a): Kernel trap at 0xffffff7f9371d49b, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0x0000000000000000, CR3: 0x0000000013e98000, CR4: 0x00000000001627e0
RAX: 0x0000000000000000, RBX: 0x0000000000000001, RCX: 0x0000000000000000, RDX: 0x0000000000000000
RSP: 0xffffff91ff243b10, RBP: 0xffffff91ff243b40, RSI: 0xffffff804ef5cc00, RDI: 0x0000000000000000
R8:  0xffffff8049827200, R9:  0x0000000000000001, R10: 0x0000000000000000, R11: 0x0000000000000013
R12: 0xffffff8010f27250, R13: 0x0000000000000000, R14: 0xffffff8032c79400, R15: 0xffffff804ef5cc00
RFL: 0x0000000000010246, RIP: 0xffffff7f9371d49b, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x0000000000000000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff91ff2437a0 : 0xffffff80106dab12 
0xffffff91ff243820 : 0xffffff80107ce40a 
0xffffff91ff243a00 : 0xffffff80107ec273 
0xffffff91ff243a20 : 0xffffff7f9371d49b 
0xffffff91ff243b40 : 0xffffff8010c917dd 
0xffffff91ff243b80 : 0xffffff8010c910a6 
0xffffff91ff243bf0 : 0xffffff8010c8bd7a 
0xffffff91ff243c30 : 0xffffff8010c8ba11 
0xffffff91ff243c70 : 0xffffff8010c8b856 
0xffffff91ff243cb0 : 0xffffff7f919a736b 
0xffffff91ff243de0 : 0xffffff7f919a6840 
0xffffff91ff243ee0 : 0xffffff7f918b47f2 
0xffffff91ff243f00 : 0xffffff801070f1ea 
0xffffff91ff243fb0 : 0xffffff80107c8e27 
      Kernel Extensions in backtrace:
         com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f918af000->0xffffff7f91917fff
            dependency: com.apple.driver.AppleUSBHostMergeProperties(1.0.1)[9D5F86A1-76EF-3007-94CA-49652E62355C]@0xffffff7f918ab000
         com.apple.iokit.IOUSBFamily(900.4.1)[7B5AC81A-D0B6-3F3D-87C7-AFD78F4686DB]@0xffffff7f91955000->0xffffff7f919eefff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[4FE41F9B-2849-322A-BBF8-A94816C003D6]@0xffffff7f90f2c000
            dependency: com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f918af000
         com.emu.driver.EMUUSBAudio(3.5.5)[84175FD4-435D-30BE-A910-73A716E482DE]@0xffffff7f9370e000->0xffffff7f93769fff
            dependency: com.apple.iokit.IOAudioFamily(204.3)[79080C52-FC35-31BA-8C06-087B308D33D1]@0xffffff7f92c74000
            dependency: com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f918af000

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

The fourth entry, that's coming from EMUUSBAudioDevice::start(IOService*) (in EMUUSBAudio) (EMUUSBAudioDevice.cpp:139)

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

The log file does not even show the ::start message.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

The actual code there is

mControlInterface = OSDynamicCast(IOUSBInterface1, provider);

Tried to replace the OSDynamic cast with a straightforward cpp cast

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

No, again instant crash, not a single EMU message comes into the log. Now we have this

*** Panic Report ***
panic(cpu 0 caller 0xffffff801cfce40a): Kernel trap at 0xffffff7f9ff25371, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00000001088cc000, CR3: 0x00000000206fa000, CR4: 0x00000000001627e0
RAX: 0xffffff7f9e1ca0a0, RBX: 0xffffff7f9ff246d0, RCX: 0x0000000000000000, RDX: 0xffffff803c8e7920
RSP: 0xffffff9245883bb0, RBP: 0xffffff9245883bc0, RSI: 0x0000000000000020, RDI: 0xffffff805b23e400
R8:  0x000000000000ffff, R9:  0x0000000000000001, R10: 0xffffff803d1de2b0, R11: 0x0000000000000000
R12: 0x0000000000000000, R13: 0x00000000fffffffd, R14: 0xffffff8054e9e5e0, R15: 0xffffff80571355e0
RFL: 0x0000000000010282, RIP: 0xffffff7f9ff25371, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0x00000001088cc000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff81dd1f9c50 : 0xffffff801cedab12 
0xffffff81dd1f9cd0 : 0xffffff801cfce40a 
0xffffff81dd1f9eb0 : 0xffffff801cfec273 
0xffffff81dd1f9ed0 : 0xffffff7f9ff25371 
0xffffff9245883bc0 : 0xffffff7f9ff25247 
0xffffff9245883c00 : 0xffffff7f9ff24793 
0xffffff9245883e00 : 0xffffff7f9ff24723 
0xffffff9245883e50 : 0xffffff801d4b5958 
0xffffff9245883ec0 : 0xffffff7f9ff2461d 
0xffffff9245883f00 : 0xffffff801cf0f1ea 
0xffffff9245883fb0 : 0xffffff801cfc8e27 
      Kernel Extensions in backtrace:
         com.emu.driver.EMUUSBAudio(3.5.5)[096B53AC-6067-3140-94E9-2999DB42A94D]@0xffffff7f9ff15000->0xffffff7f9ff70fff
            dependency: com.apple.iokit.IOAudioFamily(204.3)[79080C52-FC35-31BA-8C06-087B308D33D1]@0xffffff7f9f350000
            dependency: com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f9e0af000

which SEEMS to be further down the driver

0xffffff801cedab12
0xffffff801cfce40a
0xffffff801cfec273
IOUSBInterface1::getDevice1() (in EMUUSBAudio) (IOUSBInterface.h:117)
EMUUSBAudioDevice::checkUHCI() (in EMUUSBAudio) (EMUUSBAudioDevice.cpp:355)
EMUUSBAudioDevice::protectedInitHardware(IOService*) (in EMUUSBAudio) (EMUUSBAudioDevice.cpp:192)
EMUUSBAudioDevice::initHardwareThreadAction(OSObject*, void*, void*, void*, void*) (in EMUUSBAudio) (EMUUSBAudioDevice.cpp:177)
0xffffff801d4b5958
EMUUSBAudioDevice::initHardwareThread(EMUUSBAudioDevice*, void*) (in EMUUSBAudio) (EMUUSBAudioDevice.cpp:168)
0xffffff801cf0f1ea
0xffffff801cfc8e27

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

fixed debugger messages

Wouter1 added a commit that referenced this issue Jul 1, 2016
… 10.11 driver. This must be turned off to compile a working driver.
Wouter1 added a commit that referenced this issue Jul 1, 2016
Wouter1 added a commit that referenced this issue Jul 1, 2016
@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

Turning on debug logs seems not to work properly.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 1, 2016

If I put some large sleep after each printf, the printf shows, but it still does not end up in the system.log

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 2, 2016

Maybe the printf's never make it really into the file because of some caching?
or maybe something wrong in /etc/asl.conf ?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 2, 2016

the checkUHCI only checks if the current device has the name "AppleUSBUHCI", to avoid using that. I can't find any documentation if string comparison is right way to go here. Apparently the call to IOUSBDevice#)getDevice is crashing internally.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

It's something in the system driver crashing.
Hard to tell what because the system kext doesn't have debug symbols

Maybe I can try this

http://stackoverflow.com/questions/34356393/possible-to-display-debug-kext-symbols-in-the-panic-log-by-default

Assuming you don't explicitly strip symbols, they'll stay in your kext binary. The problem is the kernel's dynamic loader doesn't retain them in memory. You can however change that by setting the keepsyms=1 kernel argument (either via the nvram boot-args variable, or via com.apple.Boot.plist in /Library/Preferences/SystemConfiguration/) - if you set that flag, the kernel will retain symbols for kexts and the kernel itself, and symbolicate stack traces in panic logs. Note that you'll still get the C style symbol names, so you'll need to unmangle any C++ function names using the c++filt command.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

Checking the man pages of kextutil and kext_logging. The latter points to the file
/System/Library/LaunchDaemons/com.apple.kextd.plist

Checked that this file is identical on my 10.9 and 10.11

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

I added a sleep of 1 second (!!!) to every call to log. I can see that my debugIOLog calls ARE being logged into system.log (I see them appear there if I have tail -f /var/log/system.log running)

However, after the crash, there is completely NOTHING in the file. There is a complete TWO MINUTES missing between the moment the driver had been installed till the moment OSX reboots.

Jul  3 21:36:47 wouters-MBP com.apple.kextcache[755]: Lock acquired; proceeding.
Jul  3 21:36:47 wouters-MBP com.apple.kextcache[755]: /: helper partitions appear up to date.
Jul  3 21:37:58 wouters-MBP syslogd[40]: ASL Sender Statistics
Jul  3 21:39:51 localhost bootlog[0]: BOOT_TIME 1467574791 0
Jul  3 21:39:52 localhost syslogd[41]: Configuration Notice:
    ASL Module "com.apple.AccountPolicyHelper" claims selected messages.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

Trying this bizarre hack:

 tail -f /var/log/system.log  > log.log

which should copy my system.log file text immediately to log.log when new entries appear.....

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 3, 2016

No, that doesn't work either. This file also does not contain the last minute or so. I suspect something is being cached and never gets flushed to the drive

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 4, 2016

posted bug #27162632 with apple

Summary:
I'm working on debugging a kext. I have a problem with the system.log file missing data from the last seconds before a kernel panic.

I have a console open, running 'tail -f /var/log/system.log'. 

When I start a kext that leads to a kernel panic, various messages are being shown in that console. The kernel panic occurs only several seconds after these messages appeared in the console so there seems plenty of time for the system. I already put sleep around the kext calls to printf to give the system more time before the crash, but so far no luck.

However, when the system has recovered from the panic and I open system.log, almost 2 minutes around this time are missing from system.log. The text that I saw appearing on the console isn't in the system.log file

I also tried 'tail -f /var/log/system.log > backup.log'. Same problem, nothing from minute or so before the panic...

Obviously these messages right before the panic are the most crucial to fix the issues...

Steps to Reproduce:
have a kext (maybe it's relevant that this is an audio USB driver), that does some printf() followed by some sleep before it crashes. Check with 'tail -f /var/log/system.log' that the message appears in the system.log file. After the crash, check that the message is NOT in system.log anymore.

Expected Results:
message is in system.log

Actual Results:
message is not in system.log

Version:
 OSX 10.11.4, macbook pro retina, 2,3 GHz Intel Core i7, SSD.  

Notes:
No workaround available ...
This exact configuration works fine if I run on OSX 10.9 with a 10.9 driver.

Configuration:
external Dell 4K screen, EMU0404 USB, apple keyboard through iMate, razer mouse. Computer in clamshell mode. All devices attached through the screen's USB ports. 

Apple replied, and only 5 days after I posted:

Please use the Kernel Developer Kit.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 4, 2016

Maybe the problems are caused by the protectedinitHardware running in a separate thread?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 4, 2016

The driver in 10.9 seems to work fine also if I do the init not in a separate thread but call it straight like

bool EMUUSBAudioDevice::start(IOService * provider) {
    bool            result = FALSE;

    debugIOLogC("+ EMUUSBAudioDevice[%p]::start(%p)", this, provider);
    mControlInterface = (IOUSBInterface1 *)provider;//OSDynamicCast(IOUSBInterface1, provider);
    FailIf(FALSE == mControlInterface->open(this), Exit);
    mCurSampleRate = mNumEngines = 0;

    debugIOLogC("- EMUUSBAudioDevice[%p]::start(%p)", this, provider);

    result = super::start(provider);                // Causes our initHardware routine to be called.
    debugIOLogC("EMUUSBAudioDevice started about to registerService result is %d\n", result);
Exit:
    return result;
}

bool EMUUSBAudioDevice::initHardware(IOService * provider) {
    bool        result = FALSE;
    mStatusPipe = NULL;
    return kIOReturnSuccess == protectedInitHardware(provider);
}

Advantage of this is that I can return proper true iff driver started up properly.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 4, 2016

Didn't really help, I get another panic

Backtrace (CPU 6), Frame : Return Address
0xffffff80156dab12
0xffffff80157ce40a
0xffffff80157ec273
IOUSBInterface1::getDevice1() (in com.emu.driver.EMUUSBAudio.sym) + 33
EMUUSBAudioDevice::checkUHCI() (in com.emu.driver.EMUUSBAudio.sym) + 55
EMUUSBAudioDevice::protectedInitHardware(IOService*) (in com.emu.driver.EMUUSBAudio.sym) + 160
EMUUSBAudioDevice::initHardware(IOService*) (in com.emu.driver.EMUUSBAudio.sym) + 65
IOAudioDevice::start(IOService*) (in com.apple.iokit.IOAudioFamily.sym) + 197
EMUUSBAudioDevice::start(IOService*) (in com.emu.driver.EMUUSBAudio.sym) + 300
0xffffff8015c917dd
0xffffff8015c910a6
0xffffff8015c8bd7a
0xffffff8015c8ba11
0xffffff8015c8b856
0xffffff7f969a736b
0xffffff7f969a6840
AppleUSBHostResources::registerUSBHostServiceThreadCall(void*, void*) (in IOUSBHostFamily) + 30

0xffffff82006f3f00 : 0xffffff801570f1ea 
0xffffff82006f3fb0 : 0xffffff80157c8e27 
      Kernel Extensions in backtrace:
         com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f968af000->0xffffff7f96917fff
            dependency: com.apple.driver.AppleUSBHostMergeProperties(1.0.1)[9D5F86A1-76EF-3007-94CA-49652E62355C]@0xffffff7f968ab000
         com.apple.iokit.IOUSBFamily(900.4.1)[7B5AC81A-D0B6-3F3D-87C7-AFD78F4686DB]@0xffffff7f96955000->0xffffff7f969eefff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[4FE41F9B-2849-322A-BBF8-A94816C003D6]@0xffffff7f95f2c000
            dependency: com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f968af000
         com.apple.iokit.IOAudioFamily(204.3)[79080C52-FC35-31BA-8C06-087B308D33D1]@0xffffff7f97b50000->0xffffff7f97b80fff
            dependency: com.apple.vecLib.kext(1.2.0)[2D9008E3-9EE8-30E4-844D-51CA4B093F03]@0xffffff7f97ad4000
         com.emu.driver.EMUUSBAudio(3.5.5)[B3C5395F-FA40-3B1B-94D0-296664D14924]@0xffffff7f9871d000->0xffffff7f9877ffff
            dependency: com.apple.iokit.IOAudioFamily(204.3)[79080C52-FC35-31BA-8C06-087B308D33D1]@0xffffff7f97b50000
            dependency: com.apple.iokit.IOUSBHostFamily(1.0.1)[4C8B5BB6-6AE4-313E-B79C-AC07A4E31A2D]@0xffffff7f968af000

BSD process name corresponding to current thread: kernel_task

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 4, 2016

This time, no messages are logged at all to system.log. The crash seems to occur instantly the moment I turn on the device. Even though I do IOSleep(1000) (1 second!) and call debugIOLogC as first action in EMUUSBAudioDevice::start().

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 5, 2016

Maybe the printf or the IOSleep are causing the problems?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 5, 2016

No, that is not likely, as the processing runs fine across several calls to debugIOLogC. I suppose it would hang in start() if that were the case.

Instead something seems to go wrong with the address of the call. I would expect that getDevice() would bring us into IOUSBHostDevice, supposedly part of USBHostFamily?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 8, 2016

When I start the engine with HALLab tools, I see this in console

Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: +EMUUSBAudioEngine[<ptr>]::performAudioEngineStart ()
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: +findPipe: dir=1, type = 1
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: endpoint found: epDirection = 1, epType = 1
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: -findpipe: success
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: create output pipe 
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: +findPipe: dir=0, type = 1
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: endpoint found: epDirection = 0, epType = 1
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: -findpipe: success
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: check for associated endpoint
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: USB pipe READ error 24e08a00
Jul  8 21:29:08 --- last message repeated 3 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  8 21:29:08 --- last message repeated 127 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: warning way-out ring wrap position
Jul  8 21:29:08 --- last message repeated 1 time ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  8 21:29:08 --- last message repeated 63 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: warning way-out ring wrap position
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  8 21:29:08 --- last message repeated 63 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: warning way-out ring wrap position
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  8 21:29:08 --- last message repeated 63 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: warning way-out ring wrap position
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  8 21:29:08 --- last message repeated 63 times ---
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: warning way-out ring wrap position
Jul  8 21:29:08 wouters-MacBook-Pro kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 8, 2016

THis error code is new to me. Trying to decypher it.
https://developer.apple.com/library/mac/qa/qa1075/_index.html

24e08a00 = 0010 0100 1110 0000 1000 1010 0000 0000

Splitting in 6, 12, 14:
system=00 1001 =0x09
sybsystem=0011 1000 0010 = 0x382
code=00 1010 0000 0000 = 0xa00

this makes no sense at all when checking the IOReturn values.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 8, 2016

Checking the system error codes. Spread over USB.h, mach/error.h, IOReturn.h, OSReturn.h, err_libkern.sub, etc.... But none of these contais system code 0x09.

found these ones:

code for err_system() system
0x0 kernel
0x1 user space library
0x2 user space servers
0x3 old ipc
0x4 mach ipc
0x5 bootstrap errors
0x7 distributed ipc
0x10 GNU Hurd server errors
0x37 libkern
0x38 iokit
0x3e user defined errors
0x3f mach-ipc compatibilyt error

Seems these types can also be decoded using system.h (GNU C Library, eg https://fossies.org/dox/glibc-2.23/errstring_8c_source.html#l00067) but I cant find the sources...

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Maybe the problem is that I release the pipe after findpipe got it, to match the original code that hat to claim the pipe?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

If I do not call the release, indeed things seem to work better. I now get this

Jul  9 08:07:50 wouters-MBP kernel[0]: +EMUUSBAudioDevice[0xff802ffcf800]::performPowerStateChange(1, 2, <ptr>)
Jul  9 08:07:50 wouters-MBP kernel[0]: +EMUUSBAudioEngine[<ptr>]::performAudioEngineStart ()
Jul  9 08:07:50 wouters-MBP kernel[0]: about to start USB stream(s)
Jul  9 08:07:50 wouters-MBP kernel[0]: averageFrameSamples=48
Jul  9 08:07:50 --- last message repeated 1 time ---
Jul  9 08:07:50 wouters-MBP kernel[0]: Isoc Frames / usbCompletions
Jul  9 08:07:50 wouters-MBP kernel[0]: EMUUSBAudioEngine::SetSampleRate 96000
Jul  9 08:07:50 wouters-MBP kernel[0]: using SampleRateXU
Jul  9 08:07:50 wouters-MBP kernel[0]: createInputPipe
Jul  9 08:07:50 wouters-MBP kernel[0]: +findPipe: dir=1, type = 1
Jul  9 08:07:50 wouters-MBP kernel[0]: endpoint found: epDirection = 1, epType = 1
Jul  9 08:07:50 wouters-MBP kernel[0]: -findpipe: success
Jul  9 08:07:50 wouters-MBP kernel[0]: GetIsocEndpointAddress, looking for direction 1
Jul  9 08:07:50 wouters-MBP kernel[0]: GetEndpointMaxPacketSize interfaceNum 2 altInterfaceNum 8 address 130
Jul  9 08:07:50 wouters-MBP kernel[0]: ++EMUUSBAudioDevice::hub speed HIGH
Jul  9 08:07:50 wouters-MBP kernel[0]: +UsbInputRing::init bytesize=73728 byterate=576000
Jul  9 08:07:50 wouters-MBP kernel[0]: -UsbInputRing::init 128000000
Jul  9 08:07:50 wouters-MBP kernel[0]: ringbuffer<USBInputRing> allocate 73728
Jul  9 08:07:50 wouters-MBP kernel[0]: ringbuffer<frameSizeQueue> allocate 1024
Jul  9 08:07:50 wouters-MBP kernel[0]: create output pipe 
Jul  9 08:07:50 wouters-MBP kernel[0]: +findPipe: dir=0, type = 1
Jul  9 08:07:50 wouters-MBP kernel[0]: endpoint found: epDirection = 0, epType = 1
Jul  9 08:07:50 wouters-MBP kernel[0]: -findpipe: success
Jul  9 08:07:50 wouters-MBP kernel[0]: check for associated endpoint
Jul  9 08:07:50 wouters-MBP kernel[0]: GetIsocEndpointAddress, looking for direction 0
Jul  9 08:07:50 wouters-MBP kernel[0]: GetEndpointMaxPacketSize interfaceNum 1 altInterfaceNum 8 address 1
Jul  9 08:07:50 wouters-MBP kernel[0]: + read frameList 0 
Jul  9 08:07:50 wouters-MBP kernel[0]: READ framelist 0 in framenr 8766147 at 8783898022221
Jul  9 08:07:50 wouters-MBP kernel[0]: USB pipe READ error 24e08a00
Jul  9 08:07:50 wouters-MBP kernel[0]: + read frameList 1 
Jul  9 08:07:50 wouters-MBP kernel[0]: READ framelist 1 in framenr 8766179 at 8783898027055
Jul  9 08:07:50 wouters-MBP kernel[0]: USB pipe READ error 24e08a00
Jul  9 08:07:50 wouters-MBP kernel[0]: + read frameList 2 

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

The extra messages probably was just the debug logging level changed. In the 10.9 driver

This is what I get in the 10.9 version of the driver. Notice that there are no findPipe messages here because we do not stub the findPipe function in 10.9

Jul  9 10:17:55 vlieland kernel[0]: +EMUUSBAudioDevice[0xff8038494000]::performPowerStateChange(1, 2, 0xffffff81f74c3924)
Jul  9 10:17:55 vlieland kernel[0]: +EMUUSBAudioEngine[0xffffff8031ae5000]::performAudioEngineStart ()
Jul  9 10:17:55 vlieland kernel[0]: about to start USB stream(s)
Jul  9 10:17:55 vlieland kernel[0]: averageFrameSamples=48
Jul  9 10:17:55 --- last message repeated 1 time ---
Jul  9 10:17:55 vlieland kernel[0]: Isoc Frames / usbCompletions
Jul  9 10:17:55 vlieland kernel[0]: EMUUSBAudioEngine::SetSampleRate 96000
Jul  9 10:17:55 vlieland kernel[0]: using SampleRateXU
Jul  9 10:17:55 vlieland kernel[0]: createInputPipe
Jul  9 10:17:55 vlieland kernel[0]: GetIsocEndpointAddress, looking for direction 1
Jul  9 10:17:55 vlieland kernel[0]: GetEndpointMaxPacketSize interfaceNum 2 altInterfaceNum 8 address 130
Jul  9 10:17:55 vlieland kernel[0]: ++EMUUSBAudioDevice::hub speed HIGH
Jul  9 10:17:55 vlieland kernel[0]: +UsbInputRing::init bytesize=73728 byterate=576000
Jul  9 10:17:55 vlieland kernel[0]: -UsbInputRing::init 128000000
Jul  9 10:17:55 vlieland kernel[0]: ringbuffer<USBInputRing> allocate 73728
Jul  9 10:17:55 vlieland kernel[0]: ringbuffer<frameSizeQueue> allocate 1024
Jul  9 10:17:55 vlieland kernel[0]: create output pipe 
Jul  9 10:17:55 vlieland kernel[0]: check for associated endpoint
Jul  9 10:17:55 vlieland kernel[0]: GetIsocEndpointAddress, looking for direction 0
Jul  9 10:17:55 vlieland kernel[0]: GetEndpointMaxPacketSize interfaceNum 1 altInterfaceNum 8 address 1
Jul  9 10:17:55 vlieland kernel[0]: + read frameList 0 
Jul  9 10:17:55 vlieland kernel[0]: READ framelist 0 in framenr 7409875 at 7410460023434
Jul  9 10:17:55 vlieland kernel[0]: + read frameList 1 
Jul  9 10:17:55 vlieland kernel[0]: READ framelist 1 in framenr 7409907 at 7410460074182
Jul  9 10:17:55 vlieland kernel[0]: + read frameList 2 
Jul  9 10:17:55 vlieland kernel[0]: READ framelist 2 in framenr 7409939 at 7410460117761
Jul  9 10:17:55 vlieland kernel[0]: + read frameList 3 
Jul  9 10:17:55 vlieland kernel[0]: READ framelist 3 in framenr 7409971 at 7410460153414
Jul  9 10:17:55 vlieland kernel[0]: EMUUSBOutputStream::start at 7410460155168
Jul  9 10:17:55 vlieland kernel[0]: frameSizeQueue empty, guessing some queue size. May need fix..
Jul  9 10:17:55 --- last message repeated 63 times ---
Jul  9 10:17:55 vlieland kernel[0]: WRITE framenr 7409875 at 7410460510767

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Tried to use OSDynamicCast in findPipe to convert the IOUSBHostPipe* into an IOUSBPipe.

That changes the error code from the pipe->io() (call to Read) to 0x29d65f00

0010 1001 1101 0110 0101 1111 0000 0000

00 1010 =0x0a
011101011001
01111100000000

Still makes no sense. Is this just a completely messed up call?

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

oooops some of the IOUSBPipe functions are virtual! This is just totally wrong, that will modify the original structures and cause completely bad calls.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Yes, that was the problem. We now have some sound!

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Needed stil

  • Testing
  • findPipe fix the hack and make stuff consistent with 10.9
  • remove out-commented old code

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Done brief tests

  • changing the sample rate works.
  • 96kHz works for just playing quicktime file
  • 48kHz works for playing an flv

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

If I switch to 192k the control panel crashes. Not clear yet if we switch to 192 or not.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 9, 2016

Made ticket #81 for control panel

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 10, 2016

While cleaning up the code, something broke again in the project. Again had to revert to last saved version. There seems something broken in XCode 7, I never had these problems before

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 10, 2016

Maybe that problem was related to this compiler warning I had

Warning: The Copy Bundle Resources build phase contains this target's Info.plist file

After I removed the EMUUSBAudio-Info-11.plist from the Build Phase/Copy Bundle Resources items the problem seems resolved. Need to check if this solution really works.

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 10, 2016

I have to compile the kext for 10.9 on 10.9

Compile with XCode 7 on OSX 10.11 gives this when I try to load in 10.9:

EMUUSBAudio.kext - no dependency found for com.apple.iokit.IOUSBHostFamily.
EMUUSBAudio.kext - no compatible dependency found for com.apple.kpi.bsd.
EMUUSBAudio.kext - no dependency found for com.apple.iokit.IOUSBHostFamily.
EMUUSBAudio.kext - no compatible dependency found for com.apple.kpi.bsd.
Diagnostics for EMUUSBAudio.kext:
Dependency Resolution Failures: 
    Only incompatible kexts found for these libraries: 
        com.apple.kpi.bsd
    No kexts found for these libraries: 
        com.apple.iokit.IOUSBHostFamily

Code Signing Failure: not code signed

Wouter1 added a commit that referenced this issue Jul 10, 2016
…ailures (some builds worked, some builds didn’t, and the project seemed to break for no reasons).
@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 10, 2016

Compiling on 10.9 seems still ok with above fix. This seems the proper solution. Committed that change

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 11, 2016

Still need to bump the version of the driver

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 11, 2016

When I separate the code properly, I can not keep the inline annotations

I dropped them, hoping that the compiler is smart enough

@Wouter1
Copy link
Owner Author

Wouter1 commented Jul 11, 2016

fixed the documentations, readme, installation instructions etc.

@Wouter1 Wouter1 closed this as completed Jul 11, 2016
Repository owner locked and limited conversation to collaborators Oct 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant