# How do modifiers work (USB HID)?

**URL:** <https://community.keyboard.io/t/how-do-modifiers-work-usb-hid/550>\
**Category:** Programming\
**Created:** [October 26, 2017, 6:40pm UTC](https://community.keyboard.io/t/how-do-modifiers-work-usb-hid/550 "2017-10-26T18:40:33Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![craigdissel](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@craigdissel](https://community.keyboard.io/u/craigdissel)\
**Post date:** [October 26, 2017, 11:09pm UTC](https://community.keyboard.io/t/how-do-modifiers-work-usb-hid/550/26 "2017-10-26T23:09:11Z")

</div>

> [@merlin](#):
>
> I must have been confusing the bitmask that I saw elsewhere (in key\_defs.h, maybe?), where only alt got two bits, the shift, control, and gui each got one bit, and the other bits were used for other things.

I think you’re thinking of this code. This defines the bits used in the key state that is passed around in Kaleidoscope. In particular, plugins that use event handler hooks get passed this state, which tells them something about what modifiers are held. However, that’s separate from what the HID part of the code thinks is and isn’t held - it keeps track separately, in the places Jesse has pointed out.

[https://github.com/keyboardio/Kaleidoscope/blob/master/src/key\_defs.h#L73](https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs.h#L73)

---

_[View the full topic](https://community.keyboard.io/t/how-do-modifiers-work-usb-hid/550)._
