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

Thread: USB Host wireless mouse not working keyboard ok

  1. #1

    USB Host wireless mouse not working keyboard ok

    I have a Teensy 3.6 I am using with a Logitech wireless keyboard/mouse combo, Linux Mate 18.04 OS, Arduino 1.8.7 and Teensyduino 1.44.

    The keyboard seems to work fine but the mouse does not. I am using the mouse test sketch. The serial monitor does not display mouse movement or button presses except for pressing the right mouse button. Even then all mouse values are 0. "Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0". If randomly press various combinations of the mouse buttons I get the following display.

    Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0
    Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0
    Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0
    HID (C0000) key release:FF
    HID (C0000) key press:FF
    HID (C0000) key release:FF
    HID (C0000) key press:1
    HID (C0000) key press:FF
    HID (C0000) key release:FF
    HID (C0000) key release:1
    HID (C0000) key press:1
    Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0
    HID (C0000) key release:1
    HID (C0000) key press:1
    HID (C0000) key press:FF
    Mouse: buttons = 0, mouseX = 0, mouseY = 0, wheel = 0, wheelH = 0

    This is displayed when I plug in the USB receiver.
    *** Device KB1 46d:c52e - connected ***
    manufacturer: Logitech
    product: USB Receiver
    *** Device HID1 46d:c52e - connected ***
    manufacturer: Logitech
    product: USB Receiver
    *** HID Device Mouse1 46d:c52e - connected ***
    manufacturer: Logitech
    product: USB Receiver

    If I use a wired USB mouse and keyboard the is no problem. They work as expected.
    I have narrowed it down to the version of keyboard.cpp in USBHost_t36 after the "Fix/workaround for gigabyte keyboard" patch. If I use a version of USBHost_t36 before the patch it works properly.
    I have tried three other Logitech keyboard/mouse combinations without success.

    Has anybody else had the same problem?

    Thanks

  2. #2
    Junior Member
    Join Date
    Jun 2018
    Posts
    4
    Same problem!

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    Looks like setting it into boot mode, is causing issue. Will try to take look at it in next few days, puppy is keeping me from having any time where I can be in my office.

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    I was pretty sure I verified that my Logitech Mouse/Keyboard combo worked after the last change. So I tried it again this morning.

    Note: I am running 1.8.8 Arduino 1.45B2 Teensy. Note: It is building using my copy of the library:
    Code:
    Multiple libraries were found for "USBHost_t36.h"
     Used: C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36
     Not used: D:\arduino-1.8.8\hardware\teensy\avr\libraries\USBHost_t36
    But my version of the library was just reset to be the same as Pauls's version...
    Code:
    C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36>git fetch upstream
    
    C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36>git checkout master
    Switched to branch 'master'
    Your branch is up to date with 'origin/master'.
    
    C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36>git reset --hard upstream/master
    HEAD is now at 207ffd7 Merge pull request #21 from KurtE/gigabyte_keyboard
    
    C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36>git push origin master --force
    Enumerating objects: 1, done.
    Counting objects: 100% (1/1), done.
    Writing objects: 100% (1/1), 656 bytes | 656.00 KiB/s, done.
    Total 1 (delta 0), reused 0 (delta 0)
    To https://github.com/KurtE/USBHost_t36.git
       e857a27..207ffd7  master -> master
    
    C:\Users\kurte\Documents\Arduino\libraries\USBHost_t36>
    Also looks like I may have a different Logitech combo:
    Code:
    USB Host Testing
    960
    *** Device KB1 46d:c517 - connected ***
      manufacturer: Logitech
      product: USB Receiver
    *** Device HID1 46d:c517 - connected ***
      manufacturer: Logitech
      product: USB Receiver
    *** HID Device Mouse1 46d:c517 - connected ***
      manufacturer: Logitech
      product: USB Receiver
    Mouse: buttons = 1,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = -1,  mouseY = 1,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = -4,  mouseY = 8,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = -11,  mouseY = 10,  wheel = 0,  wheelH = 0
    Mine is one of the ones that look like: https://smile.amazon.com/Logitech-MK...keyboard+combo

    Would help to know which one either of you are using as maybe something in them is behaving slightly differently.

  5. #5
    Hello again KurtE,

    Thanks for responding to this thread. I have 4 different Logitech wireless keyboard/mouse combo's; Have tried all of these with Arduino 1.88 and Teensyduino 1.45b2 and Teensyduino 1.45. Not working.

    I am putting together debug dumps with bad mouse responses and good mouse responses. I can get the mouse to work if I change line 142 of keyboard.cpp.

    I changed:
    Code:
    	mk_setup(setup, 0x21, 11, 0, 0, 0); // 11=SET_PROTOCOL  BOOT
    To:
    Code:
    	mk_setup(setup, 0x21, 10, 0, 0, 0); // 10=SET_IDLE
    I will post the results and the list of wireless keyboard/mouse models when I can. Back to work.

    That is one cute puppy!

    Thanks again
    Warren

  6. #6
    The following changes to keyboard.cpp solved my problem with the mouse not working and the repeating Keyboard Control Callback.
    It works with all four of my Logitech wireless keyboard/mouse combo's.

    I changed line 142 in the keyboard claim function to:
    Code:
    mk_setup(setup, 0x21, 10, 0, 0, 0); // 10=SET_IDLE
    I changed line 157 in the keyboard control function to:
    Code:
     mk_setup(setup, 0x21, 11, 0, 0, 0); // 11=SET_PROTOCOL  BOOT
    @KutrE
    Could these two line have been reversed? I am curious to see if your wireless combo
    Code:
    //	mk_setup(setup, 0x21, 11, 0, 0, 0); // 11=SET_PROTOCOL  BOOT
    	mk_setup(setup, 0x21, 10, 0, 0, 0); // 10=SET_IDLE
    	queue_Control_Transfer(dev, &setup, NULL, this);
    	return true;
    }
    
    void KeyboardController::control(const Transfer_t *transfer)
    {
    	println("control callback (keyboard)");
    	print_hexbytes(transfer->buffer, transfer->length);
    	// To decode hex dump to human readable HID report summary:
    	//   http://eleccelerator.com/usbdescreqparser/
    	uint32_t mesg = transfer->setup.word1;
    	println("  mesg = ", mesg, HEX);
    	if (mesg == 0x001021 && transfer->length == 0) { // SET_PROTOCOL
                mk_setup(setup, 0x21, 11, 0, 0, 0); // 11=SET_PROTOCOL  BOOT
    //          mk_setup(setup, 0x21, 10, 0, 0, 0); // 10=SET_IDLE
    		queue_Control_Transfer(device, &setup, NULL, this);
    	}
    }

  7. #7
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    @wwatson,

    With your change, my logitech unit continued to work, but it broke the gigabyte keyboard....

    But looks like there was an error in the first round, and the set idle was never being sent, as was looking for wrong, message at about line 155...

    I have a different change for you hopefully to try, which I put up in the fork/branch: https://github.com/KurtE/USBHost_t36...e-Logitech-fix

    Which changes the if statement:
    Code:
    -	if (mesg == 0x001021 && transfer->length == 0) { // SET_PROTOCOL
    +	if (mesg == 0x00B21 && transfer->length == 0) { // SET_PROTOCOL
    That is change the 1021 to B21

    If you get a chance could you try it out with your logitech units?
    I ran it with my logitech, a DELL keyboard, and the Gigabyte. Might try a few others as well.

    Note: I am having some issue with Microsoft Mouse/Keyboard combo not showing mouse events, that it looks like I need to investigate.

    EDIT: Looks like on the Microsoft keyboard/mouse combo (Sculpt), that the fix for gigabyte to put the device into boot mode, also causing issues with Microsoft Mouse here...
    Probably should have tested that more. That is switching the Keyboard to boot mode, is causing the MOUSE to output in fixed mouse format, not the full format that the mice normally outputs...

    Maybe back to drawing board.

    Just an FYI- Info about gigabyte keyboard fix in the thread: https://forum.pjrc.com/threads/53381...light=gigabyte
    Last edited by KurtE; 12-12-2018 at 08:48 PM.

  8. #8
    Hi KurtE,

    Thanks for looking into this issue. I will try out your changes on my Logitech combos. Unfortunately I only have Logitech wireless keyboard and mouse.
    I am going to see if I can find a Microsoft keyboard/mouse combo at work.
    I have two twelve hour shifts to finish up this week so it will probably be this weekend before I can try the change.
    Will also check out the gigabyte keyboard fix. My skill levels are not at your level so it takes me longer to understand. Still learning.

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    Hi @wwatson and @Paul - Currently working on a different fix for gigabyte as the always set to boot protocol has some adverse results, which I did not notice when testing the first time. That is for the most part it works fine for keyboards. The problem I did not test originally was for wireless combo units, which when you turn the keyboard to boot protocol, it also changes the mouse behavior.

    What my current stuff (not checked in) does, is it has a list of (vendor ID, product ID), that if the keyboard is in the list, will set it to boot protocol, else not. The list is setup that if the Product ID == 0 it assumes it matches all product ids of that vendor. Currently I only have the vendor ID of my megabyte keyboard.

    So far that part appears to be working. Tried with the megabyte, plus Logitech, plus Microsoft, plus a dell keyboard.

    But: I was also thinking of adding a method to the keyboard class, like: forceBootProtocol(),
    Which if some one else finds a keyboard that is not working, they might be able to add that call, to see if it helps get that specific keyboard to work... That way they can get it to work without having to edit the main library. Hopefully they will let us know the information, to then add it to this list...

    Sound Reasonable?

  10. #10
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    Hi again, I made the changes as I mentioned above and issued a PR: https://github.com/PaulStoffregen/USBHost_t36/pull/23

    @wwatson - It would be great if you would try it out on your logitech wireless combos.
    I tried it out on my: logitech wireless combo, Microsoft wireless combo, an HP keyboard, Dell Mouse and the gigabyte Blue keyboard I have. The mouse example was updated to show how one could use the new method.

    Kurt

  11. #11
    @KurtE,

    I tried all 4 of my wireless keyboard/mouse combos and all of them work great. Awesome work. I do not have a gigabyte keyboard so I cannot test that but all my other keyboards work fine,
    So if I understand you right, you are triggering the forceBootProtocol() function using the (vendor ID, product ID) to change to boot protocol for the gigabyte keyboard.

    I also checked a couple of wired keyboards and mice. No problem found.
    Maybe it's an escape from the rabbit hole

    Thanks again

    Warren

  12. #12
    Member
    Join Date
    Jul 2018
    Posts
    38
    @KurtE,

    PR #23 works fine on the Gigabyte N-key rollover keyboard and my other USB keyboards (plain, nothing special, wired USB). I also uncommented the forcebootmode function just to see what happens. All the keyboards work. Good know if someone unnecessarily calls the forcebootmode function, the Gigabte N-key rollover keyboard keeps working.

    Thanks!

  13. #13
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,694
    Thanks, hopefully should get merges in before next teensyduino released. Sorry I missed it before this last release.

    Note I tested my gigabyte by removing its vid from special table, and then verified it did not work, and then tried the two different ways to force it into boot mode and both ways worked,,,

Posting Permissions

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