Skip to content

Keyboard and Mouse not working from 1.8.0 release on #423

Open
@per1234

Description

@per1234

Describe the problem

When using version 1.8.0 or higher of the platform, there are problems with HID functionality of the boards:

  • Mouse emulation doesn't work at all on Windows machines
  • Keyboard emulation doesn't work at all on Windows machines
  • Keyboard emulation is incorrect on Linux machines

To reproduce

Equipment

  • Any of the boards supported by the platform.

Steps

Keyboard
  1. Upload the following sketch to one of the platform's boards:
    #include <Keyboard.h>
    void setup() {
      pinMode(2, INPUT_PULLUP);
      pinMode(LED_BUILTIN, OUTPUT);
      Keyboard.begin();
    }
    
    void loop() {
      if (digitalRead(2) == LOW) {
        Keyboard.print("hello");
        digitalWrite(LED_BUILTIN, HIGH);
        delay(500);
        digitalWrite(LED_BUILTIN, LOW);
        delay(500);
      }
    }
  2. Open any text editor program, and give focus to the editor.
  3. Connect pin 2 to ground.

🐛 If connected to a Windows machine, no text is typed.

🐛 If connected to a Linux machine, incorrect text is typed. For example:

heloooooooooooohelohelohelooooooooooooheloooooooooooohelheloheloooooooooooohelooooooooooooheloooooooooooohhelooooooooooooheloooooooooooohelooooooooooooheloooooooooooohelheloooooooooooohelohhelohelhhhelhelohhe
Mouse
  1. Upload the following sketch to one of the platform's boards:
    #include <Mouse.h>
    void setup() {
      pinMode(2, INPUT_PULLUP);
      pinMode(LED_BUILTIN, OUTPUT);
      Mouse.begin();
    }
    
    void loop() {
      if (digitalRead(2) == LOW) {
        Mouse.move(0, 200);
        digitalWrite(LED_BUILTIN, HIGH);
        delay(1000);
        Mouse.move(0, -200);
        digitalWrite(LED_BUILTIN, LOW);
        delay(1000);
      }
    }
  2. Connect the board to a Windows machine.
  3. Connect pin 2 to ground.

🐛 The mouse pointer does not move.

Has no effect on Windows, but seems to work correctly on Linux.

Arduino SAMD Boards (32-bits ARM Cortex-M0+) version

Operating system

  • Linux
  • Windows

Operating system version

  • Raspbian 9.4
  • Ubuntu 19.04
  • Windows 10 64 bit

Additional context

When compiled with version 1.6.28 or 1.6.21 of the platform, both sketches work as expected on Windows and Linux.


Reproduced using library versions:

  • Keyboard@1.0.2
  • Mouse@1.0.1

Reproduced with the following boards:

  • MKR 1000 WiFi
  • MKR Fox 1200
  • MKR GSM 1400

Mouse emulation seems to work correctly on a Linux machine.

Additional reports

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions