Psychtoolbox>PsychHID.{mex*} subfunction

PsychHID(‘KbQueueCreate’, [deviceNumber][, keyFlags=all][, numValuators=0][, numSlots=10000][, flags=0][, windowHandle=0])

Creates a queue for events generated by an input device (keyboard, keypad,
mouse, …).
By default the default keyboard device (as defined by an operating system
specific heuristic) is used. If no keyboard is found, the first keypad device is
used, followed by other devices, e.g., mice. Optionally, the ‘deviceNumber’ of
any keyboard or HID device may be specified.
On MS-Windows it is not possible to enumerate different keyboards and mice
separately. Therefore the ‘deviceNumber’ argument is mostly useless for
keyboards and mice. Usually you can only check the system keyboard or mouse.
The optional ‘keyFlags’ argument is a vector of key/button codes to record. If
supplied, then only the provided keys or buttons are recorded, others are
ignored. By default, all available keys and buttons are recorded.
The ‘numValuators’ argument only applies to input devices with axis or other
non-button inputs. If set to a non-zero value, then up to ‘numValuators’
additional values are recorded from the selected input device. On a mouse, the
first two such channels could record mouse (x,y) position. A joystick could
record (x,y) deflection or changes of other sliders, levers or knobs. A
touchscreen could report (x,y) touch position, touch pressure or other touch
properties etc. Note that support for these properties is operating system
specific, on some systems you may not get any additional information for
‘numValuators’ settings > 0.
The ‘numSlots’ argument defines the maximum capacity of the event buffer. Once
‘numSlots’ events have been queued without the users script removing events,
event recording will stop and buffer full warnings will be printed. This
defaults to 10000 events if omitted, which is plenty for simple collection of
key/button press/release events, but might be tight for long running trials if
mouse movements, joystick movements, or touch screen input is collected, ie.
continuous input that might generate hundreds of events per second.
‘flags’ Optional flags to alter operation of the queue. Defaults to zero for
default behavior.
+1 = Always label synthetic key repeat events as invalid - iow. suppress them.
Supported on Linux only.
+2 = Never label synthetic key repeat events as invalid - iow. accept them.
Supported on Linux only.
+4 = Try to get raw valuator state, avoiding things like pointer acceleration.
Linux and Windows only.
For mouse and touchpad devices, this usually reports relative motion, ie.
movement deltas, instead of absolute position values.

‘windowHandle’ Optional windowing system specific handle for an associated
onscreen window.

###See also: KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueFlush, KbQueueRelease