PsychHID
Psychtoolbox>PsychHID
Usage:
General commands:
rc = PsychHID(‘KeyboardHelper’, commandCode)
Support for generic USB-HID devices:
numberOfDevices=PsychHID(‘NumDevices’)
devices=PsychHID(‘Devices’ [, deviceClass])
elementState=PsychHID(‘RawState‘,deviceNumber,elementNumber)
[keyIsDown,secs,keyCode]=PsychHID(‘KbCheck’ [, deviceNumber][, scanList])
[report,err]=PsychHID(‘GetReport‘,deviceNumber,reportType,reportID,reportBytes)
err=PsychHID(‘SetReport‘,deviceNumber,reportType,reportID,report)
[reports,err]=PsychHID(‘GiveMeReports‘,deviceNumber,[reportBytes])
err=PsychHID(‘ReceiveReports‘,deviceNumber[,options])
err=PsychHID(‘ReceiveReportsStop‘,deviceNumber)
Queue based keyboard queries: See ‘help KbQueueCreate’ for explanations:
PsychHID(‘KbQueueCreate’, [deviceNumber][, keyFlags=all][, numValuators=0][, numSlots=10000][, flags=0][, windowHandle=0])
PsychHID(‘KbQueueRelease’ [, deviceIndex])
[navail] = PsychHID(‘KbQueueFlush’ [, deviceIndex][, flushType=1])
PsychHID(‘KbQueueStart’ [, deviceIndex])
PsychHID(‘KbQueueStop’ [, deviceIndex])
[keyIsDown, firstKeyPressTimes, firstKeyReleaseTimes, lastKeyPressTimes, lastKeyReleaseTimes]=PsychHID(‘KbQueueCheck’ [, deviceIndex])
secs=PsychHID(‘KbTriggerWait’, KeysUsage, [deviceNumber])
[event, navail] = PsychHID(‘KbQueueGetEvent’ [, deviceIndex][, maxWaitTimeSecs=0])
Support for access to generic USB devices: See ‘help ColorCal2’ for one usage example:
usbHandle = PsychHID(‘OpenUSBDevice’, vendorID, deviceID [, configurationId=0])
PsychHID(‘CloseUSBDevice’ [, usbHandle])
PsychHID(‘USBClaimInterface’, usbHandle, interfaceId)
[recData, count] = PsychHID(‘USBControlTransfer’, usbHandle, bmRequestType, bRequest, wValue, wIndex, wLength [, outData][, timeOutMSecs=10000])
[countOrRecData] = PsychHID(‘USBBulkTransfer’, usbHandle, endPoint, length [, outData][, timeOutMSecs=10000])
[countOrRecData] = PsychHID(‘USBInterruptTransfer’, usbHandle, endPoint, length [, outData][, timeOutMSecs=10000])
ok<STOUT>