OK so it monitors other stuff aswell then. So if I extract the following I will be able to monitor an individual key? As in that the following values (and whatever else is monitored) are added together (when the corresponding key is pressed) and outputted at kbd_exp[0]?
The first number is the index in the array, so all the keys except the last four are in kbd_exp[0], while the remainder are in kbd_exp[2].
The second number is the CHDK identifier for the key
The third number defines the individual bits associated with the key. Usually if the bit is set, it means the key is NOT pressed.
KEY_SHOOT_FULL is special, it combines the bits of KEY_SHOOT_HALF and KEY_SHOOT_FULL_ONLY.
You can figure out if a specific key is pressed using bitwise operators.
However I still have the problem of it crashing and misbehaving, could this be because I am calling GetKbdState too often?
It's possible, but more likely you've just broken something else.
edit:
Looking at the disassembly, GetKbdState on this camera is relatively complicated compared to many cameras (which just read directly from some MMIOs), so it's quite possible it doesn't want to be called out of the normal kbd_task sequence.
It does read some MMIOs
0xC022F480
0xC022F484
0xC022F488
0xC022F48C
but the values get fiddled a bunch, so it's not immediately obvious how they correspond to physw_status bits.
If you want to monitor a single key, it's possible you could just poll these addresses directly.