# Re: Subject response boxes, USB

**URL:** <https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764>\
**Category:** Uncategorized\
**Created:** [June 5, 2000, 10:55pm UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764 "2000-06-05T22:55:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 5, 2000, 10:55pm UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/1 "2000-06-05T22:55:42Z")

</div>

> \>\>I'm revamping my laboratory formerly used as a slide-projector laboratory  
> \>\>that was suitable for running groups of up to 8 subjects at a time. I talked  
> \>\>to you about this plan a couple of years ago: I plan to put in an LCD  
> \>\>projector controlled by a Mac running under (guess what?) MATLAB. The  
> \>\>implementation of this lab would go fairly easily but for one thing: I want  
> \>\>to have some form of subject response boxes interfaced to the Mac, along  
> \>\>with appropriate MATLAB functions to monitor the responses.  
> \>  
> \>I know of two options that don't involve building custom hardware/software.  
> \>  
> \>Option i) Buy the CMU button box and download Brian Stankiewicz's   
> \>MATLAB interface  
> \>files. See [http://color.psych.ucsb.edu/psychtoolbox/questions.html#keyboard](http://color.psych.ucsb.edu/psychtoolbox/questions.html#keyboard)  
> \>for all the relevant pointers.  
> \>  
> \>Option ii) Use a standard Mac game controller. We use the Gravis   
> \>GamePad (about $20)  
> \>which provides a joy stick and 4 buttons. You just install a little   
> \>init and each button  
> \>is read in as a key press. This one works for ADB bus, but I assume  
> \>there are similar products available for USB. Or maybe there is  
> \>a ADB card/adapter you can plug into USB Macs.  
> \>  
> \>Anyone else know of good ways to do this? Or about availability of   
> \>USB game controllers?  
> \>  
> \>DB

I just bought the Keyspan USB infrared remote for $79. It has about a   
dozen keys, and the interface control panel allows you to set up any   
keyboard mapping you want, which can be different for different   
applications. The remote is about the size of a credit card and very neat   
to use. i'm using it to control DVD playback and Powerpoint, but it might   
be fine for subject responses too. (however, i don't know what the   
response latency is.)  
[http://www.keyspan.com/products/usb/remote/](http://www.keyspan.com/products/usb/remote/)  
  
Apple's latest edition of GameSprockets (free) is supposed to allow you   
to use a wide variety of game controllers, making them all appear to be a   
standard keyboard or mouse.  
[http://asu.info.apple.com/swupdates.nsf/artnum/n11564](http://asu.info.apple.com/swupdates.nsf/artnum/n11564)  
  
here's a good overview of USB products (including game controllers) that   
you can use with Macs:  
[http://www.macintouch.com/usb.html](http://www.macintouch.com/usb.html)  
  
best  
  
denis

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 14, 2000, 7:18pm UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/2 "2000-06-14T19:18:19Z")

</div>

When I hook up an external monitor (an LCD projector) to our G3 laptop,  
the new monitor shows up as another screen in SCREEN('Screens'),  
ResolutionTest, etc. Using SCREEN('Resolution'), screen 0 seems to show  
the resolution characteristics of the external monitor (with res.hz always  
NaN for the projector we are using), while screen 1 seems to show the  
characteristics of the laptop display.  
  
Bad things happen (i.e. the computer usually crashes) when I try to access  
screen 1, either deliberately or not. For example, ScreenTest crashes  
when it starts trying to test screen 1.  
  
I'm not sure how the laptop works, but although it might be possible for  
the external monitor to be running at a different refresh rate than the  
laptop screen, it should still display the same images. I am surprised  
that the external monitor shows up with another screen number (though it  
also shows up as another screen in the monitor control panel, and it is  
possible to change the two resolutions and pixelSizes independently here).  
  
Has anyone experienced difficulties using the SCREEN functions on an  
external display with a G3 laptop?  
  
keith

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 15, 2000, 7:11am UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/3 "2000-06-15T07:11:25Z")

</div>

--- In [psychtoolbox@egroups.com](mailto:psychtoolbox@egroups.com), Keith Schneider \<ks@b...\>  
wrote:  

> \> When I hook up an external monitor (an LCD projector) to our G3 laptop,  
> \> the new monitor shows up as another screen in SCREEN('Screens'),  
> \> ResolutionTest, etc. Using SCREEN('Resolution'), screen 0 seems to show  
> \> the resolution characteristics of the external monitor (with res.hz always  
> \> NaN for the projector we are using), while screen 1 seems to show the  
> \> characteristics of the laptop display.  
> \>  
> \> Bad things happen (i.e. the computer usually crashes) when I try to access  
> \> screen 1, either deliberately or not. For example, ScreenTest crashes  
> \> when it starts trying to test screen 1.  
> \>

...  

> \>  
> \> keith

dear keith  
  
Which PowerBook G3 model and what version of the Mac OS are you using?  
  
i can't replicate your bug on my Powerbook G3 Series under Mac  
OS 9.0.4. SCREEN('screens') always returns just 0, even though  
i've got a video projector connected. I tried many resolutions.  
  
best  
  
denis  
  
Here's my report from ScreenTest:  
  
\*\*\*\*\*\* Denis Pelli's PowerBook G3 Series/250, Mac OS 9.0.4 \*\*  
PsychToolbox 2.42, 7 March 2000, MATLAB 5.2.1.1421  
QuickTime 4.1.2  
Screen saver present, now disabled.  
Using UpTime-based timing, which is very accurate and reliable.  
Has serial port arbitration.  
G3, 250 MHz, memory bus 83 MHz, 34.569 Mflop/s  
\*\*\* Screen 0 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ATY,264LT-G (.Display\_Video\_ATI\_mach64 version 1.0.1f2) in  
slot E1  
8 bit dacs. 1024x768 60 Hz. (56,60,67,70,72,75,85 Hz avail)  
pixel size 8 16 32 bits  
pages 1 1 1  
CopyWindow (ie CopyBits) 69 70 70 MB/s  
GetClut equals SetClut? == na na  
SetClutDriverWaitsForBlanking? Yes  
At priority 7 ... No blanking intrpts.  
SetClut (cscSetEntries) min dur. 0.5 0.1 0.5 frames  
At priority 1 ... Blanking interrupts.  
SetClut (cscSetEntries) min dur. 0.5 0.1 0.5 frames  
SetClut suppresses ints. for 0.0 0.0 0.0 frames  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 15, 2000, 7:54pm UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/4 "2000-06-15T19:54:41Z")

</div>

> \>\> When I hook up an external monitor (an LCD projector) to our G3 laptop,  
> \>\> the new monitor shows up as another screen in SCREEN('Screens'),  
> \>\> ResolutionTest, etc. Using SCREEN('Resolution'), screen 0 seems to show  
> \>\> the resolution characteristics of the external monitor (with res.hz always  
> \>\> NaN for the projector we are using), while screen 1 seems to show the  
> \>\> characteristics of the laptop display.

I double checked, and what I wrote above is backwards. Screen 0 is always  
the laptop display, and screen 1 is the external LCD projector. But,  
screen 1 cannot be accessed independently of screen 0.  
  

> \>\> Bad things happen (i.e. the computer usually crashes) when I try to access  
> \>\> screen 1, either deliberately or not. For example, ScreenTest crashes  
> \>\> when it starts trying to test screen 1.  
> \>  
> \>Which PowerBook G3 model and what version of the Mac OS are you using?   
> \>  
> \>i can't replicate your bug on my Powerbook G3 Series under Mac   
> \>OS 9.0.4. SCREEN('screens') always returns just 0, even though   
> \>i've got a video projector connected. I tried many resolutions.

I must have a newer model. Here's the screentest (without the external  
projector attached):  
  
\*\*\*\*\*\* lab's PowerBook/500, Mac OS 9.0.4 \*\*\*\*\*\*  
PsychToolbox 2.42, 7 March 2000, MATLAB 5.2.1.1421  
QuickTime 4.1  
FileSharing is on.  
Screen saver present, now disabled.  
Using UpTime-based timing, which is very accurate and reliable.  
G3, 500 MHz, memory bus 100 MHz, 7.199 Mflop/s  
\*\*\* Screen 0 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ATY,RageM3pA (.Display\_Rage128 version 1.0f19) in slot ATI  
8 bit dacs. 1024x768 60 Hz.  
NOTE: DipPriorityAfterSetClut is true. Works around Rage128 driver bug.  
NOTE: MinimumSetClutPriority is 2. Works around Rage128 driver bug.  
pixel size 8 16 32 bits  
pages 1 1 1  
CopyWindow (ie CopyBits) 58 59 59 MB/s  
GetClut equals SetClut? == == ==   
SetClutDriverWaitsForBlanking? Yes  
At priority 7 ... No blanking intrpts.  
SetClut (cscSetEntries) min dur. 0.2 0.2 0.2 frames  
At priority 1 ... Blanking interrupts.  
SetClut (cscSetEntries) min dur. 0.2 0.2 0.2 frames  
SetClut suppresses ints. for 0.0 0.0 -0.0 frames  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
  
-----  
keith

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 16, 2000, 9:02am UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/5 "2000-06-16T09:02:10Z")

</div>

--- In [psychtoolbox@egroups.com](mailto:psychtoolbox@egroups.com), Keith Schneider \<ks@b...\>   
wrote:  

> \> \>\> When I hook up an external monitor (an LCD projector) to

our G3 laptop, the new monitor shows up as another screen in   
SCREEN('Screens'), ResolutionTest, etc. ... Bad things happen   
(i.e. the computer usually crashes) when I try to access screen 1,   
either deliberately or not. For example, ScreenTest crashes   
when it starts trying to test screen 1.  
...  
Here's the screentest (without the external projector attached):  
  
\*\*\*\*\*\* lab's PowerBook/500, Mac OS 9.0.4 \*\*\*\*\*\*  
...  
G3, 500 MHz, memory bus 100 MHz, 7.199 Mflop/s  
\*\*\* Screen 0   
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ATY,RageM3pA (.Display\_Rage128 version 1.0f19) in slot ATI  

> \> keith

dear keith  
  
This is interesting. It seems quite possible that you do have   
independent access to both devices and that there's a bug in our   
SCREEN.mex. Have your tried single stepping (using MATLAB's   
built-in debugger) to find at what point ScreenTest crashes?  
  
Can you use either Monitors or TV Mirroring control panel to turn   
mirroring off? Perhaps SCREEN.mex will then start working.  
  
Another easy test would be to try running TimeVideo. Its report   
might be helpful. You can download it from here:  
[http://vision.nyu.edu/VideoToolbox/Download.html#TimeVideo](http://vision.nyu.edu/VideoToolbox/Download.html#TimeVideo)  
  
best  
  
denis

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 16, 2000, 10:28pm UTC](https://psychtoolbox.discourse.group/t/re-subject-response-boxes-usb/764/6 "2000-06-16T22:28:17Z")

</div>

dear keith  
  
i think i've replicated your PowerBook G3 problem on a regular Mac. I   
think your PowerBook provides two video devices, one for the built-in   
display, and one for the external port. You have set them to mirror each   
other. (That's different from my older PowerBook G3 Series, which has   
only one video device that drives both the built-in screen and the   
external port.) I've forgotten when the mirroring feature appeared,   
probably in Mac OS 8, but it is certainly true now that in any Mac with   
multiple devices one can use the Monitors control panel to drag one   
screen onto another to request that they mirror each other. It works fine.  
  
However, SCREEN.mex has limitations in dealing with mirrored devices.   
There isn't any fundamental obstacle in Apple's programming model. It's   
just that several complications arise that would need to be dealt with,   
and since no one has previously wanted to use mirrored displays for   
experiments, I didn't think it worthwhile to implement the necessary   
extra code to cope with mirrored displays. (E.g. Anything copied to a   
mirrored display has to be separately copied to both displays. Two calls   
to CopyBits.)  
  
When I run ScreenTest on my Mac with the two displays set to mirroring,   
it fails with a diagnostic error message:  
  
??? SCREENOpenOffscreenWindow.c: Screens 0 and 1 are mirrored. I can only   
access the deeper one, screen 1.  
  
Error in ==\> Sirois:Applications:MATLAB   
5.2.1:Toolbox:PsychToolbox:PsychBasic:SCREEN.mex  
Error in ==\> Sirois:Applications:MATLAB   
5.2.1:Toolbox:PsychToolbox:PsychTests:ScreenTest.m  
On line 241 ==\> o(i)=SCREEN(w,'OpenOffscreenWindow');  
  
Is that what you got? (You said it "crashes", which is not the same   
thing.)  
  
I'm inclined to try to enhance ScreenTest to cope more graciously with   
mirrored screens, but I don't plan to implement full-fledged support for   
mirrored displays because it seems a rather obscure case. Or am I missing   
something?  
  
For your case, I would suggest that you simply use Monitors to turn off   
mirroring, and then you should be able to do everything as usual. (With   
mirroring on, everything you show would have to be copied to both   
displays, which would slow you down, and seems undesirable.)  
  
best  
  
denis
