DownloadPsychtoolbox, GetSubversionPath: Match svn client path search order.

It was different between DownloadPsychtoolbox and the rest, which could
cause funnyness if multiple svn clients were installed on the same OSX
machine in the different locations, e.g., if the clients required different
svn repository formats and caused "upgrade your repo" errors.

Closes issue #103 on Psychtoolbox main repo.
BitsPlusPlus: Fix command submission for multi-DIO commands.

If multiple T-Lock DIO control codes were defined via
BitsPlusPlus('DIOCommand', ...) and no specifix x,y offset
was given, so that default positions for T-Lock patterns were
to be chosen, it would fail. Reason: y offset for each T-Lock
line was fixed to scanline 3, instead of advancing one scaline
for each successive T-Lock. In use, each T-Lock would have
overwritten its predecessor, so only the very last T-Lock would
have taken effect.

Fixed by advancing by 1 scanline per additional T-Lock control line.
FindSerialPort: Add ttyACMxxx devices to enumerated serial ports on Linux.

The CRS Bits# enumerates, e.g., as a /dev/ttyACM0, so auto-detect
this port device category.
BitsPlusImagingPipelineTest and BitsPlusIdentityClutTest: Add Bits# support.

Allow to run Bits# hardware assisted diagnostic routines and
auto-fixes, similar to the ones already available for VPixx
DataPixx, ViewPixx and ProPixx.

Also allow specification of an optional 'windowrect' for the
onscreen test window. This only makes sense on Linux for quick
and dirty testing, not for production use on any os.
PsychImaging/BitsPlusPlus: Add basic support for CRS Bits#

PsychImaging, respective BitsPlusPlus is now able to detect
if a Bits# device instead of a Bits+ device shall be used.

This is done by creating a configuration file "BitsSharpConfig.txt"
in the PsychtoolboxConfigDir() which marks and configures use
of a Bits#. Presence of the file signals a connected Bits#
device and the 1st line of the config file stores the name
of the serial port(-device file) to which the Bits# is connected.
If no such name is given, the serial port of the connected Bits#
is auto-detected via serial port probing. One can also specify
explicitely that a Bits# should be used, and the serial port spec,
via the new PsychImaging('AddTask','General','UseBits#' [, portspec]);
command.

If a Bits# is connected, the driver will try to establish a
serial port connection and use it to command automatic video
mode switching between Bits++, Mono++ and Color++ mode, depending
on what PsychImaging() high precision display mode was requested.
At onscreen window close time, the Bits# will be automatically
switched back into Bits++ mode and the connection will be closed.
Bits++ mode is GUI compatible, ie., the Bits# monitor can be used
to display the desktop GUI.

The driver can now also use the Bits#'s new diagnostic pixeldata
readback feature to perform hardware based diagnostic and auto-lut
tweaking to make sure that a proper framebuffer pixel identity
passthrough is achieved, and to tweak/correct the GPU's gamma
table LUT accordingly to fix possible problems with passthrough,
e.g., due to non-identity gamma tables or display dithering.
The tweaking algorithm is exactly the same as the one formerly
only used for VPixx devices like DataPixx inside the PsychDataPixx()
driver's 'CheckGPUSanity' subfunction. The test and tweaking code
has been factored out into a shared function ...
PsychHardware/PsychGPUTestAndTweakGammaTables.m
... so we only need one implementation of the routine. This function
gets called by BitsPlusPlus for Bits# and PsychDataPixx for VPixx
devices and has little bits of device specific callbacks into those
drivers to perform device setup and device specific pixel readback.

Currently the Bits# driver only supports basic video mode switching,
connecting to the device, resetting of video modes and the LUT/encoder
testing and tweaking, ie., basic video output handling. It doesn't yet
support Bits# device analog/digital i/o, or RtBox style response box
functionality or interop with that driver. If one wanted to use those
functionality, one would need to operate the driver as if it was
connected to a good'ol Bits+ device.

Tested with BitsPlusImagingPipelineTest (and included encodertest),
BitsPlusIdentityClutTest (and included encodertest and tweaking),
AdditiveBlendingForLinearSuperpositionTutorial and MinimumMotionExp
under Ubuntu Linux 12.10 + 64-Bit Octave.
BitsPlusIdentityClutTest, BitsPlusImagingPipelineTest: Make compatible with Bits#

Make sure Bits# connection and video modes are properly closed down.
MinimumMotionExp: Remove harmful and redundant "clear all" at top.

It is useless and can cause malfunctions in octave and matlab.
BitsPlusPlus: New subfunctions for Bits#

SwitchtoXXX to manually switch to video mdoe XXX, e.g., Mono++
SwitchToStatusScreen to switch to diagnostic status screen.
MassStorageMode to disconnect from the device and reboot the
device into USB mass storage mode, to operate as a USB flash drive.

This concludes initial Bits# bringup for at least basic functionality
and "self-healing" for the video output system.

Still tbd: DAQ and response box functionality, as well as some of
the more fancy display mode tweaks (dithering, internal gamma table etc.).

Successfully tested so far on Ubuntu Linux 12.10 with 64-Bit Octave.
Add forgotten memcpyCudaOpenGL.mexmaci for 32-Bit Matlab on OSX/Intel.
Merge branch 'master' of https://github.com/kleinerm/Psychtoolbox-3
BitsPlusPlus: Matlab specific fixes for Bits#, cleanups.

Some tiny incompatibility between Octave and Matlab fixed.
Some fixes for warnings. Some cleanups of comments. Some
additions to help texts.

Tested and confirmed to work on OSX 10.7.5 with 64-Bit Matlab R2012a.

OSX 10.7.5 with the NVidia GeForce GT 330M has a really screwed
gamma table on OSX! None of our detected LUT's or any of the manually
selectable LUT's work at all. They don't provide an identity mapping
and they additionally cause massive interference by dithering.

The same hardware under Ubuntu Linux 12.10 just worked out of the box (tm).

Tweaking with dithering interference can take very long. It took over
11 Minutes to converge to a solution with the Bits#.
Screen for 64-Bit OSX: Fix linker failure on 10.5 Leopard due to incompatibility.

10.5 Leopard 64-Bit does not support the Cocoa class NSRunningApplication,
causing runtime linker failure ("Invalid MEX file") when trying to use it
on 64-Bit Matlab or Octave on 10.5.

Fix this by dynamically detecting and binding the class dynamically and
no-op'ing if it is unsupported on 10.5. No-Op will cause SetFocusWindow()
to silently fail on 10.5, which means that window keyboard input focus
isn't restored for the Octave or matlab -nojvm console window at fullscreen
window close on 10.5, so user has to manually click the window.

This is a minor inconvenience for an old and outdated os.

Screen for 64-Bit Octave/Matlab on OSX rebuilt and tested on 10.7.
Test by user for 10.5 pending.
PsychtoolboxKernelDriver: Improve debug output, rebuild 64-Bit kernel driver.

Move a line of debug output into a different place so it is always
printed in SetDitherMode() for dither disable.

Only 64-Bit kernel driver rebuilt.
CreateBitsSharpEDID: Convert a raw EDID file into a Bits# compatible one.

Follow the decription of the Bits# manual to do this automatically.
AdditiveBlendingForLinearSuperpositionTutorial: Change contrast to 0.25, cleanups.

A contrast setting of 0.5 was bogus, as it would create out-of-range saturated
gratings as soon as they'd overlap. Use a 0.25 setting which is the maximum
value that would be meaningful for a real stimulus presentation session -
we don't want to teach bad habits to our users ;-)
BitsPlusIdentityClutTest: Work around a MS-Windows graphics bug.

Not clear yet if it is a bug in the Windows graphicd drivers, the
windows GDI text renderer, or our code, but with text alpha blending
enabled, we get off-by-one color index errors in text rendered to the
color overlay. This results in off-by-one color palette clut access and
weirdo color artifacts which suggest failure of the imaging chain, when
everything is actually fine.

Disabling text alpha blending fixes the problem on Windows.

Also disable the 'o' key on Windows, which works by setting the
blue channel of the gpu gamma table to zero - or actually doesn't
work on Windows, where such gamma tables are illegal and cause
error abort due to failure of 'Loadnormalizedgammatable. This is
now a OSX and Linux only feature.

Minor code cleanups.

-> All tests and demos now pass and work correctly with the Bits#
   on MS-Windows in all display modes.