<commit_before># The difference of event grabbing methods

## CGEventTapCreate

`CGEventTapCreate` is a limited approach.<br />
It does not work with Secure Keyboard Entry even if we use `kCGHIDEventTap` and root privillege.<br />
Thus, it does not work in Terminal.<br />
You can confirm this behavior in `appendix/eventtap`.

## IOKit

IOKit allows you to read raw HID input events from kernel.<br />
The highest layer is IOHIDQueue which provides us the HID values.

# The difference of event posting methods

## IOKit device report

It requires posting HID events.<br />
The IOHIKeyboard processes the reports by passing reports to `handleReport`.

## IOKit device value

It requires posting HID events.<br />

## IOHIDPostEvent

It requires posting mac events.<br />

## CGEventCreate

It requires posting mac events.<br />


# The limitation of `device reports`

## Apple devices reports

Apple keyboards does not use generic HID keyboard report descriptor.

### Generic HID keyboard report descriptor

```
uint8_t modifiers;
uint8_t reserved;
uint8_t keys[6];
```

### Apple HID keyboard report descriptor

```
uint8_t unknown;<commit_msg>update DEVELOPMENT.md<commit_after># The difference of event grabbing methods

## CGEventTapCreate

`CGEventTapCreate` is a limited approach.<br />
It does not work with Secure Keyboard Entry even if we use `kCGHIDEventTap` and root privillege.<br />
Thus, it does not work in Terminal.<br />
You can confirm this behavior in `appendix/eventtap`.

## IOKit

IOKit allows you to read raw HID input events from kernel.<br />
The highest layer is IOHIDQueue which provides us the HID values.

# The difference of event posting methods

## IOKit device report

It requires posting HID events.<br />
The IOHIKeyboard processes the reports by passing reports to `handleReport`.

## IOKit device value

It requires posting HID events.<br />

## IOKit call IOHIKeyboard::dispatchKeyboardEvent

It requires posting mac events.<br />

## IOHIDPostEvent

It requires posting mac events.<br />

## CGEventCreate

It requires posting mac events.<br />


# The limitation of `device reports`

## Apple devices reports

Apple keyboards does not use generic HID keyboard report descriptor.

### Generic HID keyboard report descriptor

```
uint8_t modifiers;
uint8_t reserved;
uint8_t keys[6];
```

### Apple HID keyboard report descriptor

```
uint8_t unknown;
{'fraction_non_alphanumeric': 0.07824267782426778, 'fraction_numerical': 0.0041841004184100415, 'mean_word_length': 4.496551724137931, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6459628', 'n_tokens_mistral': 700, 'n_tokens_neox': 676, 'n_words': 300}