Skip to content

refactor(bad_usb): make HID keyboard layouts table-driven#68

Closed
yajatnarayan wants to merge 1 commit into
HighCodeh:mainfrom
yajatnarayan:feature/hid-layout-tables
Closed

refactor(bad_usb): make HID keyboard layouts table-driven#68
yajatnarayan wants to merge 1 commit into
HighCodeh:mainfrom
yajatnarayan:feature/hid-layout-tables

Conversation

@yajatnarayan

Copy link
Copy Markdown
Contributor

Description

Replace the per-layout type_string_us/_abnt2 switch functions with pure data tables and a single generic walker. Each layout is a 128-entry ASCII table of {keycode, modifier, dead_keycode, dead_modifier} entries plus an optional UTF-8 supplemental table; dead keys (ABNT2 accents, '/") are encoded as an optional prefix press. Dispatch is now a singles_layouts[] lookup indexed by ducky_layout_t, so adding a layout needs no new code path.

Output for US and ABNT2 is unchanged. Update the component README to document the new model and the "register a layout" steps.

Related Issue: Fixes #64


Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING.md document.
  • [X My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings during build.
  • I have tested this change on physical hardware. (Please specify which target below)

Hardware Testing Details

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more layouts to HID

1 participant