Closed hyunwoogu closed 1 year ago
The issue was that the eye display code was not yet implemented for the metal version. I have written that code and checked it in and I have tested that it is working correctly.
However, there is an issue with using the Matlab Desktop with the code. If you run the code with Matlab from the terminal running
matlab -nodesktop
then everything is fine. It seems that there is something going on with the callbacks that Eyelink uses which doesn't play well with Matlab's desktop. It even crashes if you use Matlab -nodesktop and just run the editor. I suspect that it has something to do with threading or some process that gets started when Matlab runs the editor or desktop to track variables and the debugger.
Anyway, until we can get a fix for this issue, the Eyelink code should be run without desktop. It will warn you if you are using the desktop to run w/out the desktop.
Just a further note for when we come back to this.
The code in mglPrivateEyelinkSetup.c now has a hook in it for when you press key F5. This simply calls the function mglFlush in matlab. This reliably crashes the system when run from the Desktop. Note that if you put the same call in the entrance Mex function (the keyboard call is a callback from the Eyelink code), the code does not crash. So it has something to do with the re-entrant callback. I've been checking this Matlab 2022b, maybe it works in earlier versions of Matlab (as there is nothing metal or new about all of this code). Probably worth checking an older version of matlab (from 2019 onwards) to see if this is a new issue. If it is a new issue then maybe it will get resolved by MathWorks.
Closing this issue, as the above works as a fix.
System information
macOS 12.6, MATLAB R2022b, MGL(metal branch), Eyelink1000
Code to reproduce the issue
This prompts the following:
Anything else seems to work okay, but upon hitting
Enter
(=Display camera image) here, MATLAB crashes.Attempts to track the issue
I tracked down what is causing this:
eyeCalibDisp
eventually callsmglPrivateEyelinkSetup.c
in the following sequence:eyeCalibDisp.m > calibrateEyeTracker.m > eyeCalibrationEyelink.m > mglEyelinkSetup.m > mglPrivateEyelinkSetup.c
It seems that
do_tracker_setup()
call withinmglPrivateEyelinkSetup.c
causes the above problem. To verify this, I put checkpoint print functions just above and belowdo_tracker_setup()
as follows:When I see the above prompt and complete calibration routines without hitting
Enter
, both the "Checkpoint1" and "Checkpoint2" are printed. On the other hand, when I see the above prompt and hitEnter
, "Checkpoint1" is still printed but then MATLAB crashes without "Checkpoint2" being printed.do_tracker_setup()
seems to be EyeLink's function, not the MGL function. This function is located under/Library/Frameworks/eyelink_core.framework/Versions/A/Headers/core_expt.h
(ThisHeaders/
directory is included when we calledmglMakeMetal()
)By the way, the only line that defines
do_tracker_setup()
withincore_expt.h
is the following:INT16 ELCALLTYPE do_tracker_setup(void);
Other than this, I cannot find the "contents" of this function
do_tracker_setup
. Also, not sure if it issue is about fixing this function or not.