CMU Button Box OS X 10.4 and 10.5 Drivers

Hello, the lab I work in has been using the CMU Button Box for over a decade now and we recently upgraded to OS X 10.4 and 10.5. Problem is, we cannot find any drivers for the button box on OS X and the manufacturer has not returned any of our attempts to communicate. Does anyone know of a corner of the internet where these drivers exist?

Nick
The new CMUBox() driver in the latest PTB 'beta' should be able to cope with this respone box at least as far as pure timestamped response collection (without driving the outputs of the box) is concerned.

Read message 9877 and translate any mention of PST with CMU. The CMU box has the same braindead protocol as the PST box, just a little bit worse because it apparently doesn't allow to stop or start streaming of data from the box - which is something the PST box supports and that makes life a bit easier.

All warnings and caveats apply, except that the CMU mode is completely untested due to lack of such a box.

Please give feedback how it works out.
-mario


--- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@...> wrote:
>
> From what i can see by a quick look at the OS-9 driver software, the CMU button box is basically a serial port device, with a pretty bad protocol design for communicating button presses back to the computer.
>
> What it does after power-up is send a continuous stream of bytes over the serial port, about 1 every millisecond. Each byte encodes the current state of the buttons and inputs and the original software installs a low level interrupt handler to detect or poll for arrival of new bytes, check for a change in button state and timestamp it.
>
> This method of timstamping is very ill-suited for modern operating systems like OS X and the protocol was ill-suited since its invention, but especially so if you try to run it over USB emulated serial ports.
>
> Installing low-level interrupt handlers for serial ports or access to serial ports is difficult on modern operating systems and especially so if you use Serial-over-USB connections.
>
> You still could write your own M-File based driver if you don't care all too much for millisecond accurate timestamps by use of the IOPort serial port driver. Here's a rough untested sketch of how one could do it:
>
> At startup:
> ---------
>
> % Setup serial port for CMU button box configuration:
> config = 'BaudRate=19200 Parity=Odd DataBits=8 StopBits=1 FlowControl=None';
> % Find the box by guessing its device name:
> devname = FindSerialPort([], 1);
> % Open connection to box:
> cmubox = IOPort('OpenSerialPort', devname, config);
> % Drain receive buffers form all junk that has accumulated:
> IOPort('Purge', cmubox);
> % Read out whatever junk maybe in the input buffer:
> IOPort('Read', cmubox, 0);
>
> At shutdown:
> -----------
>
> IOPort('Close', cmubox);
>
> For timed button queries:
> --------------------
>
> % Read out whatever junk maybe in the input buffer:
> IOPort('Read', cmubox, 0);
>
> % Wait blocking for reception of next byte from box:
> [buttonstate, tcurrent] = IOPort('Read', cmubox, 1, 1);
>
> -> buttonstate == 1 byte, each bit encoding the state of 1 button/input.
> -> tcurrent == Guesstimate of when it happened, in GetSecs time.
>
>
> For non-timed button queries (just get "current"/most recent button state):
> ----------------------------------------------------------
>
> buttonstates = IOPort('Read', cmubox, 0);
> if ~isempty(buttonstates)
> buttonstate = buttonstates(end);
> else
> buttonstate = [];
> end
>
> The 'tcurrent' timestamp willl incur an unknown and possibly variable uncertainty, depending on the way you connect it to your machine (native serial ports better than USB connection, some USB-Serial converters better than other) and how lucky you are, it may be accurate to a few milliseconds, or less accurate than >> 20 msecs.
>
> And if you fail to drain the receive buffers frequently via IOPort('Read', cmubox, 0) or IOPort('Purge', cmubox), e.g. in your main trial loop, then all kind of stuff can happen, like receive buffer overflows and whatnot. Maybe one could use some Matlab timer callback to reduce this problem...
>
> Most of the problems are due to the bad design decision of transmitting a continuous stream of bytes from the box to the computer even if button state didn't change, instead of only reporting state changes. This wasn't a good idea in the first place but may have worked somewhat ok on MacOS-9 or maybe MS-DOS with native built-in serial ports.
>
> Good luck,
> mario
>
> --- In psychtoolbox@yahoogroups.com, "Nick Metcalf" <metcalfn@> wrote:
> >
> > Hello, the lab I work in has been using the CMU Button Box for over a decade now and we recently upgraded to OS X 10.4 and 10.5. Problem is, we cannot find any drivers for the button box on OS X and the manufacturer has not returned any of our attempts to communicate. Does anyone know of a corner of the internet where these drivers exist?
> >
> > Nick
> >
>