Q: Update on fORP keypresses? Strange behaviour + test code

Dear PsychToolbox users,

I'm having trouble getting the OS X Psychtoolbox
to read inputs from the "fORP" fMRI button-box and trigger device.
From the list, it seems that others have been having problems too.
The most recent summary I could find was here:
http://tech.groups.yahoo.com/group/psychtoolbox/message/5092

I have been getting the following strange behaviour:
the 't' signals that the fORP spits out for each scanner trigger
are being read by Matlab, and are showing up as t's in the
command window, but I cannot get a running program to read them,
regardless of whether I used KbCheck, PsychHID('KbCheck'),
or PsychHID('GetReport'), and no matter which HID device-number
I specify.

The fact that the t's are showing up in the command window,
even while the Matlab key-detecting loop is cycling round
and failing to report anything, is weird.
If I press a real key on the laptop, it both shows up
in the command window and also gets detected by the code.

From the list, it seems that different people's fORP boxes
have been behaving in different ways from each other.

Below is some code that shows the three different methods
that I tried with the fORP box, none of which worked for me.
I've tried to reproduce a similar situation at my desktop
machine by plugging in a second USB keyboard into it,
but the two-keyboards arrangement doesn't produce the same problem.

In the posting linked to above, Mario writes "A HID device that announces
itself to the operating system as a keyboard should act exactly like a
keyboard." I'm curious if anyone knows specifically what
the fORP does that is un-keyboard-like. That might allow a work-around.

Any help, or tales of other fORP experiences, greatly appreciated.

Raj
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear key*; % Make sure there's nothing in these variables

%method_to_use = 'kbcheck';
%method_to_use = 'psychhid_kbcheck';
method_to_use = 'psychhid_report';
disp(['Using method ' method_to_use ]);

dev = 5; % Device number depends on your hardware setup

run_start_time = GetSecs;
triggered = 0;

if strcmp(method_to_use,'kbcheck'),
while (triggered<1),
[touch, secs, kbcheck_out] = KbCheck;
if find(kbcheck_out),
keycode = find(kbcheck_out);
press_time = secs - run_start_time;
disp(['Keycode ' num2str(keycode) ' at ' num2str(press_time)]);
end;
end;
elseif strcmp(method_to_use,'psychhid_kbcheck'),
disp(['Listening on device ' num2str(dev) ]);
while (triggered<1),
[touch, secs, psychhid_kb] = PsychHID('KbCheck',dev);
if find(psychhid_kb),
keycode = find(psychhid_kb);
press_time = secs - run_start_time;
disp(['Keycode ' num2str(keycode) ' at ' num2str(press_time)]);
end;
end;
elseif strcmp(method_to_use,'psychhid_report'),
disp(['Listening on device ' num2str(dev) ]);
while (triggered<1),
[report_key,err] = PsychHID('GetReport', dev, 1, 0, 8);
if find(report_key),
keycode = find(report_key);
press_time = err.reportTime - run_start_time;
disp(['Keycode ' num2str(keycode) ' at ' num2str(press_time)]);
end;
end;
end;
Hi,


i just read that and remembered a strange behaviour we had with the response-box:

>Theoretically
> you can switch the mode of the forp with some switch on the device to
> not auto-release keys, but it didn't seem to have any effect when
> people tried it.

Turning the switch at the back of the device around ONLY will have any effect if you
disconnect and connect the power supply of the box after turning around(or at least that it
what i remembering....couldn't try it, because our forp is in use currently)...

servus

florian