Skip to content
RainEffectPublic

About

A configurable HID input mapper for custom controllers, arcade devices, rotary encoders, gamepads and industrial HID devices.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

HID2Input Logo

简体中文(zh_cn) 日本語(jp)

HID2Input

A configurable HID input mapping tool that allows various HID devices (arcade controllers, rotary encoders, gamepads, custom controllers, industrial devices, etc.) to be mapped to keyboard and mouse input.

Supports:

  • Multiple HID auto detection
  • Rotary Encoder
  • Multi-byte Buttons
  • Hat Switch (D-Pad)
  • Analog Axis (Joystick / Analog Stick)
  • Auto reconnect
  • Hot plug support
  • YAML configuration file
  • Single-file publishing (no external DLL required)
  • No driver dependency

Suitable for:

  • Rhythm game controllers
  • Arcade controllers
  • Custom USB controllers
  • Industrial HID devices
  • VR input devices
  • Special-purpose input mapping devices

FAQ

Why does the device disconnect frequently?

Common cause:

  • ReportLength mismatch

Please check first:

device:
  vid: 7375
  pid: 4116
  report_length: 6 # <= Check here
  report_id: 0
...

Why do arrow keys become numpad input?

Reason:

In Windows, arrow keys are classified as Extended Keys.
If only a normal Virtual Key is sent, the system may recognize it as numpad directional input.

This project uses KEYEVENTF_EXTENDEDKEY to handle this properly.
Please use KeyExtend to ensure arrow keys are recognized correctly.

buttons:
  - offset: 11
    mappings:
      - bit: 0
        key_code: 38
        extend: true # <= Set here
...

Why is Xbox controller D-Pad (Hat Switch) parsed incorrectly?

Reason:

XInput / Xbox HID D-Pad usually does not use standard bit mapping, but a special encoded format:

Direction Byte Bit
↑ 01 0001
↗ 02 0010
→ 03 0011
↘ 04 0100
↓ 05 0101
↙ 06 0110
← 07 0111
↖ 08 1000

In addition, the same byte may also contain other button states, such as:

  • Left Stick Press (L3)
  • Right Stick Press (R3)

Therefore, you may need to configure bit_offset separately:

hat_switches:
  - name: XBox_DPad
    offset: 12
    bit_offset: 2 # <= Set here
    action:
      up_key_code: 38
      ...

Why does the log show normal input, but no actual keyboard input happens?

Common causes:

  • Insufficient SendInput privilege (please run as Administrator)
  • Antivirus / security software blocking input injection
  • Incorrect Virtual Key Code used
  • Extended Key not handled correctly
  • Device requires initialization packet (TODO / Feature)

Recommended checks:

  • Run as Administrator
  • Add whitelist to security software
  • Verify all key_code mapping values

License

MIT License

About

A configurable HID input mapper for custom controllers, arcade devices, rotary encoders, gamepads and industrial HID devices.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages