A keyboard index is necessary when using KbQueueCheck instead of KbCheck. So how to get a valid keyboard index of your desired USB keyboard?
Credit: Jacob M. Paul in our lab.
[Linux enviroment]
1. Check if the keyboard was recognized by the system.
Steps: Plug in your USB keyboard -> Open Terminal -> Input “lsusb“ -> Plug off the USB keyboard -> Input “lsusb“ again in Terminal
Check if there were changes in the list. Here we can recognize a change of “Itron Technology tOne”, which is our USB keyboard. This means that the keyboard can be recognized by the system.
2 Get index in MATLAB
Steps: Plug off the USB keyboard -> Open MATLAB -> Input “[id names info] = GetKeyboardIndeces()”
MATLAB will give out some ids etc… Note that there are only 3, 4, 5 and 7 for now.
Steps: Plug in the USB keyboard -> Reopen MATLAB (important) -> Input “[id names info] = GetKeyboardIndeces() again”
Note that there are extra id: 8, 9, and 10.
3 Try these three indices in KbQueueCheck.
Here, the keyboard index for our USB keyboard is 10.