Bus Error when using Empirisoft millisecond accurate keyboard

I receive a bus error (that crashes Matlab) when using an empirisoft millisecond accurate keyboard with Psychtoolbox.

My setup is as follows:
* iMac Core 2 Duo
* CRT set up as secondary display
* 1 vanilla Apple keyboard used to set up experiment
* 1 Empirisoft millisecond accurate keyboard used by the subject during the actual experiment

I can't quite figure out what is causing it. My code calls KbCheck with the device ID of the Empirisoft keyboard, which seems to be the culprit. However, I have a second setup that is identical to the above specs that works fine.

I have attached a Matlab dump, since it seems to be the only means of troubleshooting in this case (Psychtoolbox is unable to give an error message due to the bus error).

Thanks for any insight!
--Dean

--


------------------------------------------------------------------------
Bus error detected at Wed Sep 15 12:21:13 2010
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.10.0.499 (R2010a)
MATLAB License: 361635
Operating System: Darwin 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
Processor ID: x86 Family 6 Model 15 Stepping 6, GenuineIntel
Virtual Machine: Java 1.6.0_20-b02-279-10M3065 with Apple Inc. Java HotSpot(TM) Client VM mixed mode, sharing
Default Encoding: ISO-8859-1

Fault Count: 1

Register State:
eax = a06938cc ebx = 9566db11
ecx = 00000000 edx = 00000016
esi = 00000000 edi = 036793d0
ebp = bfffe1b8 esp = bfffe050
eip = 9566db80 flg = 00010283

Stack Trace:

trial=1429 pctOcclude=0.80, maskSOA=10, contrast=1.00, category=fish, correctAnswer=f
[0] CoreFoundation:CFNumberGetValue~(0, 14, 0xbfffe1f4, 0xa0686078) + 128 bytes
[1] HIToolbox:_ISSendWindowServerKeyboardLayoutUpdate~(0x036793d0, 0x1b9b07b0 "CODT", 0xa06827a0, 0x977f8c94) + 174 bytes
[2] HIToolbox:_TSMSetInputSourceSelected~(0x036793d0, 1, 1, 0) + 1429 bytes
[3] HIToolbox:MyActivateTSMDocument~(0x1b9b07b0 "CODT", 0x977eef4c, 0xa0694780, 0x98acc8fe) + 1261 bytes
[4] HIToolbox:ActivateTSMDocument~(0x1b9b07b0 "CODT", 0x7573776d, 0, 0xbfffe468) + 17 bytes
[5] AppKit:-[NSTextInputContext activate]~(0x1b9b0190, 0x9932f7e7 "activate", 0x99263574 "inputContext", 0x98aa7ab6) + 275 bytes
[6] AppKit:+[NSTextInputContext currentInputContext]~(0xa0b3c8e8, 0x99230c98 "currentInputContext", 0xa0adce0c, 0x05803eb0) + 323 bytes
[7] AppKit:-[NSApplication updateWindows]~(0x05803eb0, 0x99236bda "updateWindows", 0x956b43d0, 0xa0693960) + 118 bytes
[8] AppKit:_handleWindowsNeedUpdateNote~(0x277ebf00, 2, 0x05803eb0, 0x956c74f0) + 67 bytes
[9] CoreFoundation:__CFRunLoopDoObservers~(0x058000e0, 0xa0687c68, 7171, 2048) + 1186 bytes
[10] CoreFoundation:__CFRunLoopRun~(0, 0, 0x05802f40, 0) + 557 bytes
[11] CoreFoundation:CFRunLoopRunSpecific~(0x058000a0, 0xa0687c68, 0, 0) + 452 bytes
[12] CoreFoundation:CFRunLoopRunInMode~(0xa0687c68, 0, 0, 1) + 97 bytes
[13] HIToolbox:RunCurrentEventLoopInMode~(0, 0, 0, 1) + 392 bytes
[14] HIToolbox:ReceiveNextEventCommon~(0xbffff150, 0, 1, 0) + 158 bytes
[15] HIToolbox:_AcquireNextEvent~(0, 0, 0, 0xbff00000) + 54 bytes
[16] HIToolbox:RunApplicationEventLoop~(0xbffff1d0 " (", 0, 0, 0x02e2d5b0) + 228 bytes
[17] libmwuix.dylib:MacRunCFRunLoop(bool)(0, 2, 0x02e191a6, 0) + 101 bytes
[18] libmwuix.dylib:MacRunApplicationMain(int, char const**, bool)(2, 0xbffff264, 0, 1) + 45 bytes
[19] libmwmcr.dylib:mcr_run_main(int (*)(int, char const**), bool, int, char const**, bool)(10272, 1, 2, 0xbffff264) + 109 bytes
[20] MATLAB:start(2, 0xbffff264, 0xbffff270, 0xbffff2e8 "Úˇø") + -3604 bytes
[21] MATLAB:start(0xbffff33c "/Applications/MATLAB_R2010a.app/..", 0xbffff386 "-desktop", 0, 0xbffff38f "XKEYSYMDB=/Applications/MATLAB_R..") + -4042 bytes

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/ts/help_request_1.html

A technical support engineer might contact you with further information.

Thank you for your help.
Update: I still get the error when running with only the vanilla Apple keyboard. And still on only one of my setups. Weird...

I have similar Matlab dumps if you would like them, but they all indicate bus errors, seg faults, and seem to point to something in HIToolbox. Please let me know if there is anything I can do to help.

--Dean

--- In psychtoolbox@yahoogroups.com, "deanwyatte" <deanwyatte@...> wrote:
>
> I receive a bus error (that crashes Matlab) when using an empirisoft millisecond accurate keyboard with Psychtoolbox.
>
> My setup is as follows:
> * iMac Core 2 Duo
> * CRT set up as secondary display
> * 1 vanilla Apple keyboard used to set up experiment
> * 1 Empirisoft millisecond accurate keyboard used by the subject during the actual experiment
>
> I can't quite figure out what is causing it. My code calls KbCheck with the device ID of the Empirisoft keyboard, which seems to be the culprit. However, I have a second setup that is identical to the above specs that works fine.
>
> I have attached a Matlab dump, since it seems to be the only means of troubleshooting in this case (Psychtoolbox is unable to give an error message due to the bus error).
>
> Thanks for any insight!
> --Dean
>
> --
>
>
> ------------------------------------------------------------------------
> Bus error detected at Wed Sep 15 12:21:13 2010
> ------------------------------------------------------------------------
>
> Configuration:
> MATLAB Version: 7.10.0.499 (R2010a)
> MATLAB License: 361635
> Operating System: Darwin 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
> Processor ID: x86 Family 6 Model 15 Stepping 6, GenuineIntel
> Virtual Machine: Java 1.6.0_20-b02-279-10M3065 with Apple Inc. Java HotSpot(TM) Client VM mixed mode, sharing
> Default Encoding: ISO-8859-1
>
> Fault Count: 1
>
> Register State:
> eax = a06938cc ebx = 9566db11
> ecx = 00000000 edx = 00000016
> esi = 00000000 edi = 036793d0
> ebp = bfffe1b8 esp = bfffe050
> eip = 9566db80 flg = 00010283
>
> Stack Trace:
>
> trial=1429 pctOcclude=0.80, maskSOA=10, contrast=1.00, category=fish, correctAnswer=f
> [0] CoreFoundation:CFNumberGetValue~(0, 14, 0xbfffe1f4, 0xa0686078) + 128 bytes
> [1] HIToolbox:_ISSendWindowServerKeyboardLayoutUpdate~(0x036793d0, 0x1b9b07b0 "CODT", 0xa06827a0, 0x977f8c94) + 174 bytes
> [2] HIToolbox:_TSMSetInputSourceSelected~(0x036793d0, 1, 1, 0) + 1429 bytes
> [3] HIToolbox:MyActivateTSMDocument~(0x1b9b07b0 "CODT", 0x977eef4c, 0xa0694780, 0x98acc8fe) + 1261 bytes
> [4] HIToolbox:ActivateTSMDocument~(0x1b9b07b0 "CODT", 0x7573776d, 0, 0xbfffe468) + 17 bytes
> [5] AppKit:-[NSTextInputContext activate]~(0x1b9b0190, 0x9932f7e7 "activate", 0x99263574 "inputContext", 0x98aa7ab6) + 275 bytes
> [6] AppKit:+[NSTextInputContext currentInputContext]~(0xa0b3c8e8, 0x99230c98 "currentInputContext", 0xa0adce0c, 0x05803eb0) + 323 bytes
> [7] AppKit:-[NSApplication updateWindows]~(0x05803eb0, 0x99236bda "updateWindows", 0x956b43d0, 0xa0693960) + 118 bytes
> [8] AppKit:_handleWindowsNeedUpdateNote~(0x277ebf00, 2, 0x05803eb0, 0x956c74f0) + 67 bytes
> [9] CoreFoundation:__CFRunLoopDoObservers~(0x058000e0, 0xa0687c68, 7171, 2048) + 1186 bytes
> [10] CoreFoundation:__CFRunLoopRun~(0, 0, 0x05802f40, 0) + 557 bytes
> [11] CoreFoundation:CFRunLoopRunSpecific~(0x058000a0, 0xa0687c68, 0, 0) + 452 bytes
> [12] CoreFoundation:CFRunLoopRunInMode~(0xa0687c68, 0, 0, 1) + 97 bytes
> [13] HIToolbox:RunCurrentEventLoopInMode~(0, 0, 0, 1) + 392 bytes
> [14] HIToolbox:ReceiveNextEventCommon~(0xbffff150, 0, 1, 0) + 158 bytes
> [15] HIToolbox:_AcquireNextEvent~(0, 0, 0, 0xbff00000) + 54 bytes
> [16] HIToolbox:RunApplicationEventLoop~(0xbffff1d0 " (", 0, 0, 0x02e2d5b0) + 228 bytes
> [17] libmwuix.dylib:MacRunCFRunLoop(bool)(0, 2, 0x02e191a6, 0) + 101 bytes
> [18] libmwuix.dylib:MacRunApplicationMain(int, char const**, bool)(2, 0xbffff264, 0, 1) + 45 bytes
> [19] libmwmcr.dylib:mcr_run_main(int (*)(int, char const**), bool, int, char const**, bool)(10272, 1, 2, 0xbffff264) + 109 bytes
> [20] MATLAB:start(2, 0xbffff264, 0xbffff270, 0xbffff2e8 "Úˇø") + -3604 bytes
> [21] MATLAB:start(0xbffff33c "/Applications/MATLAB_R2010a.app/..", 0xbffff386 "-desktop", 0, 0xbffff38f "XKEYSYMDB=/Applications/MATLAB_R..") + -4042 bytes
>
> This error was detected while a MEX-file was running. If the MEX-file
> is not an official MathWorks function, please examine its source code
> for errors. Please consult the External Interfaces Guide for information
> on debugging MEX-files.
>
> If this problem is reproducible, please submit a Service Request via:
> http://www.mathworks.com/support/contact_us/ts/help_request_1.html
>
> A technical support engineer might contact you with further information.
>
> Thank you for your help.
>
You need to narrow it down more, e.g., writing a minimal script that triggers the crash.

The stack trace doesn't point to anything ptb specific, i.e. it is not crashing within one of our mex files but somewhere within mathworks/apple's code for handling keyboard layouts. At best one of our mex files running in parallel could somehow trigger/facilitate a bug in matlab itself in an indirect way. Do you have some kind of exotic keyboard layout? Did you try rebooting? Is your os/x up to date?

Do you have other security sensitive applications running, e.g., something that asks for password input (firefox/safari/ with a login page that requires entering some passwords etc.)?

-mario

--- In psychtoolbox@yahoogroups.com, "deanwyatte" <deanwyatte@...> wrote:
>
> Update: I still get the error when running with only the vanilla Apple keyboard. And still on only one of my setups. Weird...
>
> I have similar Matlab dumps if you would like them, but they all indicate bus errors, seg faults, and seem to point to something in HIToolbox. Please let me know if there is anything I can do to help.
>
> --Dean
>
> --- In psychtoolbox@yahoogroups.com, "deanwyatte" <deanwyatte@> wrote:
> >
> > I receive a bus error (that crashes Matlab) when using an empirisoft millisecond accurate keyboard with Psychtoolbox.
> >
> > My setup is as follows:
> > * iMac Core 2 Duo
> > * CRT set up as secondary display
> > * 1 vanilla Apple keyboard used to set up experiment
> > * 1 Empirisoft millisecond accurate keyboard used by the subject during the actual experiment
> >
> > I can't quite figure out what is causing it. My code calls KbCheck with the device ID of the Empirisoft keyboard, which seems to be the culprit. However, I have a second setup that is identical to the above specs that works fine.
> >
> > I have attached a Matlab dump, since it seems to be the only means of troubleshooting in this case (Psychtoolbox is unable to give an error message due to the bus error).
> >
> > Thanks for any insight!
> > --Dean
> >
> > --
> >
> >
> > ------------------------------------------------------------------------
> > Bus error detected at Wed Sep 15 12:21:13 2010
> > ------------------------------------------------------------------------
> >
> > Configuration:
> > MATLAB Version: 7.10.0.499 (R2010a)
> > MATLAB License: 361635
> > Operating System: Darwin 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
> > Processor ID: x86 Family 6 Model 15 Stepping 6, GenuineIntel
> > Virtual Machine: Java 1.6.0_20-b02-279-10M3065 with Apple Inc. Java HotSpot(TM) Client VM mixed mode, sharing
> > Default Encoding: ISO-8859-1
> >
> > Fault Count: 1
> >
> > Register State:
> > eax = a06938cc ebx = 9566db11
> > ecx = 00000000 edx = 00000016
> > esi = 00000000 edi = 036793d0
> > ebp = bfffe1b8 esp = bfffe050
> > eip = 9566db80 flg = 00010283
> >
> > Stack Trace:
> >
> > trial=1429 pctOcclude=0.80, maskSOA=10, contrast=1.00, category=fish, correctAnswer=f
> > [0] CoreFoundation:CFNumberGetValue~(0, 14, 0xbfffe1f4, 0xa0686078) + 128 bytes
> > [1] HIToolbox:_ISSendWindowServerKeyboardLayoutUpdate~(0x036793d0, 0x1b9b07b0 "CODT", 0xa06827a0, 0x977f8c94) + 174 bytes
> > [2] HIToolbox:_TSMSetInputSourceSelected~(0x036793d0, 1, 1, 0) + 1429 bytes
> > [3] HIToolbox:MyActivateTSMDocument~(0x1b9b07b0 "CODT", 0x977eef4c, 0xa0694780, 0x98acc8fe) + 1261 bytes
> > [4] HIToolbox:ActivateTSMDocument~(0x1b9b07b0 "CODT", 0x7573776d, 0, 0xbfffe468) + 17 bytes
> > [5] AppKit:-[NSTextInputContext activate]~(0x1b9b0190, 0x9932f7e7 "activate", 0x99263574 "inputContext", 0x98aa7ab6) + 275 bytes
> > [6] AppKit:+[NSTextInputContext currentInputContext]~(0xa0b3c8e8, 0x99230c98 "currentInputContext", 0xa0adce0c, 0x05803eb0) + 323 bytes
> > [7] AppKit:-[NSApplication updateWindows]~(0x05803eb0, 0x99236bda "updateWindows", 0x956b43d0, 0xa0693960) + 118 bytes
> > [8] AppKit:_handleWindowsNeedUpdateNote~(0x277ebf00, 2, 0x05803eb0, 0x956c74f0) + 67 bytes
> > [9] CoreFoundation:__CFRunLoopDoObservers~(0x058000e0, 0xa0687c68, 7171, 2048) + 1186 bytes
> > [10] CoreFoundation:__CFRunLoopRun~(0, 0, 0x05802f40, 0) + 557 bytes
> > [11] CoreFoundation:CFRunLoopRunSpecific~(0x058000a0, 0xa0687c68, 0, 0) + 452 bytes
> > [12] CoreFoundation:CFRunLoopRunInMode~(0xa0687c68, 0, 0, 1) + 97 bytes
> > [13] HIToolbox:RunCurrentEventLoopInMode~(0, 0, 0, 1) + 392 bytes
> > [14] HIToolbox:ReceiveNextEventCommon~(0xbffff150, 0, 1, 0) + 158 bytes
> > [15] HIToolbox:_AcquireNextEvent~(0, 0, 0, 0xbff00000) + 54 bytes
> > [16] HIToolbox:RunApplicationEventLoop~(0xbffff1d0 " (", 0, 0, 0x02e2d5b0) + 228 bytes
> > [17] libmwuix.dylib:MacRunCFRunLoop(bool)(0, 2, 0x02e191a6, 0) + 101 bytes
> > [18] libmwuix.dylib:MacRunApplicationMain(int, char const**, bool)(2, 0xbffff264, 0, 1) + 45 bytes
> > [19] libmwmcr.dylib:mcr_run_main(int (*)(int, char const**), bool, int, char const**, bool)(10272, 1, 2, 0xbffff264) + 109 bytes
> > [20] MATLAB:start(2, 0xbffff264, 0xbffff270, 0xbffff2e8 "Úˇø") + -3604 bytes
> > [21] MATLAB:start(0xbffff33c "/Applications/MATLAB_R2010a.app/..", 0xbffff386 "-desktop", 0, 0xbffff38f "XKEYSYMDB=/Applications/MATLAB_R..") + -4042 bytes
> >
> > This error was detected while a MEX-file was running. If the MEX-file
> > is not an official MathWorks function, please examine its source code
> > for errors. Please consult the External Interfaces Guide for information
> > on debugging MEX-files.
> >
> > If this problem is reproducible, please submit a Service Request via:
> > http://www.mathworks.com/support/contact_us/ts/help_request_1.html
> >
> > A technical support engineer might contact you with further information.
> >
> > Thank you for your help.
> >
>