Search Unity

Question Keyboard device name?

Discussion in 'Input System' started by any_user, Jan 28, 2023.

  1. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    Is there a way to get the name of the USB device/s that is/are used as a keyboard? I‘m trying to detect if a specific keyboard is connected (technically an Arduino Leonardo acting as a HID keyboard).

    I understand that multiple keyboards as different devices are not supported. While supporting that would be even better, I‘m just looking for a cross-platform way to detect which keyboards (or generally USB devices) are currently connected and used to create the input for the „Keyboard“ device in the input system. Since the input system already handles the platform specific parts, I thought there might be a way to get more infos more easily than adding plugins scanning for USB devices separately on each platform.
     
  2. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    116
    Unfortunately, there is not.

    Keyboards aren't going through the HID paths. Primary reason being that OSs generally won't let apps get access to them that way. The platform layer could still dig up proper info for them just fine but alas, given they're all routed into the same funnel, the platform backends just create a "magic" keyboard device devoid of any connection to actual hardware.
     
    any_user likes this.