Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 39 of 39

Thread: USB keyboard hardware proxy

  1. #26
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    @Paul @mcrc - I am thinking we probably should have an example keyboard forward sketch in the library...

    Also wondering if we should Pull in the PRs from a couple of years ago to help with this and/or do similar...

    But: I did verify that:
    Code:
    void OnHIDExtrasPress(uint32_t top, uint16_t key)
    {
      if (top == 0xc0000) {
        Keyboard.press(0XE400 | key);
      }
    }
    
    void OnHIDExtrasRelease(uint32_t top, uint16_t key)
    {
      if (top == 0xc0000) {
        Keyboard.release(0XE400 | key);
      }
    }
    Appears to work, at least when I tried it on Keyboard only.

    I built it and ran it with my old Dell keyboard, and when I press the Calculator key on the keyboard, it brought up the calculator app...

    Note: this was based semi on the code in the MediaButtons Example under USB Type keyboard

  2. #27
    I actually tried this too, it doesnt trigger any Media Buttons
    Last edited by mcrc; 09-18-2021 at 06:38 PM.

  3. #28
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    @all - I just pushed up a new branch with a quick and dirty Keyboard forwarder sketch.
    Which is up at: https://github.com/KurtE/USBHost_t36...yboardForeward

    Be interesting to see if it works at all for you...
    I have not tried all of the keys on my keyboard plugged in, but at least the ones I tested appear to do something.

    The sketch is at: https://github.com/KurtE/USBHost_t36...rdForeward.ino
    Last edited by KurtE; 09-18-2021 at 07:32 PM.

  4. #29
    Your script passes normal keys just fine.
    But media keys wont pass, same as the solution provided few posts before.

  5. #30
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    Probably need additional information, like:
    Which Keyboard?
    What computer (I am assuming Windows 10? 32 or 64 bit?
    Which version of Arduino and Teensyduino?

    Do those keys work on your computer if you plug the keyboard directly into your computer?

  6. #31
    Keyboard: HyperX Alloy FPS Pro Mechanical Gaming Keyboard
    Computer: Windows 10 64 bit
    Arduino: 1.8.16
    Teensyduino: 1.55

    Yeah, they work perfectly fine directly plugged in, and they also being detected by the Mouse HIDParser. Just the pass through is not working with your .ino script or code.

  7. #32
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    Not sure what to suggest here... I tried three different keyboards And they are able to control things on my Window 10 64 bit machine...

    Wondering fi the HyperX installs it's own driver to Keyboard? If you bring up the Keyboard controller does it show anything interesting? Like a non-Microsoft driver?

  8. #33
    No, it uses the default windows drivers.

  9. #34
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    Forgot to ask which Teensy? I have been testing with 4.x ... actually right now MMOD

  10. #35
    Teensy 4.1

  11. #36
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    @mcrc - Not sure what else to try.

    With the test sketch I have tried with three different keyboards and I tried building all of the different USB types that support keyboard on MMOD... Yes could try on T4.1 as well, but they should both be using the same code and have the same options with keyboard...

    I did push up a slightly modified version of the sketch in #28 where I turned on Serial output.
    And I try generate an error if keyboard is defined but not KEYMEDIA...
    Code:
    void OnHIDExtrasPress(uint32_t top, uint16_t key)
    {
    #ifdef KEYBOARD_INTERFACE
      if (top == 0xc0000) {
        Keyboard.press(0XE400 | key);
        #ifndef KEYMEDIA_INTERFACE
        #error "KEYMEDIA_INTERFACE is Not defined"
        #endif
      }
    #endif
    ...
    Walking through the usb_desc_h for T4.x, I believe that every time KEYBOARD_INTERFACE is defined so is: KEYMEDIA_INTERFACE
    Except once, with the #elif defined(USB_EVERYTHING)
    But there is nothing in boards.txt that will define this for T4.x AND it could not work as this one has in it more endpoints than a T4.x supports...

    But regardless you may want to try same test to verify it is defined for your configuration.

    Which USB type are you using? And have you made any changes to it?

  12. #37
    Junior Member
    Join Date
    Sep 2021
    Posts
    4
    It seems this passes through every key combination except the following key presses:
    1. Windows Key (it doesn't pass through the Windows Key it seems)
    2. Keeping CTRL pressed in combination with mouse wheel (for example to zoom in and out of an document)
    This probably applies to ALT and ALT GR, too.

    Take it as and idea to expand the current example.

  13. #38
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    Thanks, I try to take a look again...

    1) If I remember correctly this may be totally on different interface or page... will check again.

    2) I only updated the modifiers going out to host when key is pressed... Wonder if maybe I need to check this on every message coming in... Other than that the CTRL+MOUSE or two different devices so probably something external from this code... But who knows.

    Thanks again

  14. #39
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    @smurf - pushed up a new copy to github/Pull Request.

    I hopefully now keep the modifier keys more in sync...

    So yes it should know when ALT or other alt is pressed regardless if you press another key or not...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •