#include <cafe/kbd.h>

KBDEc KBDSetModState(KBDChannel ch, KBDModState modState);


ch Keyboard channel to set.
modState A KBDModState value to set the current modifier state.

Return Values

KBDEc Keyboard error code. KBD_SUCCESS if the call was successful.
KBD_ERR_NOT_INITIALIZED if the library was not initialized.
KBD_ERR_BAD_VALUE if ch or modState is out of range.


Sets the current modifier key state of the USB keyboard on channel ch. Normally, this function only lets you change these modifier bits.

The modifier key state for these bits is set according to the bits set in modState.

If the bit KBD_MS_SET_ALL is set in modState, all bits in the keyboard modifier state are set.

The modifier key state is used by KBDTranslateHidCode to correctly translate HID codes into Unicodes. The modifier state is normally controlled by the KBD library, although the application may take control of the locking states by calling KBDSetLockProcessing.

The default value for the keyboard modifier state is KBD_MS_NULL.

Do Not Call From

Background Do not call this function from the background.

Revision History

2013-05-08 Automated cleanup pass.
2011-12-21 Moved to Cafe.
2007-03-19 Initial version.