Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: USBHost_t36 and Keyboard Hubs

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Location
    Huntsville
    Posts
    5

    USBHost_t36 and Keyboard Hubs

    Edit: Enabling full debugging messages in USBHost_t36 it seems to be working. I don't know why though. After disabling them, it still works after all. I'm unsure what changed but his post is resolved. I'm not sure how to delete a thread though.

    I've been working with several different keyboards trying to figure out the USBHost_t36 package and have run across a problem.
    I picked up a very common Dell Model: SK-8135 keyboard from a goodwill to test with because my other keyboard is gaming keyboard and Wireshark shows it doing some weird stuff with the USB keyboard standard to add in extra functionality.
    I didn't realize until I got home this keyboard has two extra USB ports on it and acts as a hub.

    Plugging it into Win10 confirms it's a hub from its popup messages of which driver its installing, but Device Manager also recognizes it's a keyboard. But when using it with the USBHost_t36 library I get no keypress or release events back from the KeyboardController. The other gaming keyboard did, it was only the modifier keys that didn't conform to the normal USB standard and thus were causing problems.
    Recognizing this is a hub as well, I added in a Hub controller to the original code according to some other forum posts to see if that fixes it. It didn't. So I'd like to ask for help.

    **Please understand the project I'm working on cannot have its code shared publicly because it's not a personal project, this is actually for a product. So I'm going to submit a freshly written program from my home machine that I typed in the new thread text editor and functions the same but is not the original code, it will just demonstrate the process I've been using. I just feel I need to put this as a disclaimer because there may be typos. Thank you for understanding**

    Code that worked on my gaming keyboard, and did not work with the Hub keyboard:
    Code:
    #include <antplusdefs.h>
    #include <USBHost_t36.h>
    
    USBHost myhost;
    KeyboardController keycon;
    
    void setup(){
      Serial.begin(9600);//setup serial to debug
    
      myhost.begin();
      keycon.attachPress(keypress);
      keycon.attachRelease(keyrelease);
    
      delay(250); //time to setup
    }
    
    void loop(){
      myhost.Task();
    }
    
    void keypress(int key){
      Serial.println(key);
    }
    
    void keyrelease(int key){
      Serial.println(key);
    }

    Code after adding hub like other forum posts said. Still did not work for me:
    Code:
    #include <antplusdefs.h>
    #include <USBHost_t36.h>
    
    USBHost myhost;
    USBHub hub(myhost);
    KeyboardController keycon(myhost);
    
    void setup(){
      Serial.begin(9600);//setup serial to debug
    
      myhost.begin();
      keycon.attachPress(keypress);
      keycon.attachRelease(keyrelease);
    
      delay(250); //time to setup
    }
    
    void loop(){
      myhost.Task();
    }
    
    void keypress(int key){
      Serial.println(key);
    }
    
    void keyrelease(int key){
      Serial.println(key);
    }
    Looking at the KeyboardController code in the convert to unicode function I would think I should at least be getting zeros back for the key parameter in keypress and keyrelease if the KeyboardController was getting anything at all. It leaves me scratching my head.

    Thank you in advance for the help.
    Last edited by supersquirel500; 07-09-2019 at 07:27 PM. Reason: typo in code

Posting Permissions

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