arduino / arduino/ArduinoCore-samd

Keyboard and Mouse not working from 1.8.0 release on

Open
#423 14 comments 0 reactions 1 assignee Claimed by @facchinm View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

### 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:
```cpp
#include
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);
}
}
```
1. Open any text editor program, and give focus to the editor.
2. 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:

```text
heloooooooooooohelohelohelooooooooooooheloooooooooooohelheloheloooooooooooohelooooooooooooheloooooooooooohhelooooooooooooheloooooooooooohelooooooooooooheloooooooooooohelheloooooooooooohelohhelohelhhhelhelohhe
```

##### Mouse

1. Upload the following sketch to one of the platform's boards:
```cpp
#include
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);
}
}
```
1. Connect the board to a Windows machine.
1. 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

- 1.8.0
- 1.8.1
- 284bc5a3185756cf6d107c002cc8841d772d07d4

### 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

- https://github.com/arduino-libraries/Keyboard/issues/41
- https://forum.arduino.cc/t/kyboard-examples-not-working-for-arduino-nano-33-iot/628340
- https://forum.arduino.cc/t/mouse-h-library-not-working-on-arduino-zero/630350
- https://forum.arduino.cc/t/i-have-a-question-about-my-mkr-zero/847762
- https://forum.arduino.cc/t/nano-33-iot-and-keyboard-library/896789
- https://forum.arduino.cc/t/arduino-zero-is-buying-it-a-mistake/957425 / https://github.com/arduino/ArduinoCore-samd/issues/663
- https://forum.arduino.cc/t/arduino-zero-joystick-arduino-zero-hid-arduino-zero-usb/1310474/14

#### Related

- https://github.com/arduino/ArduinoCore-samd/releases/tag/1.8.2#:~:text=Arduino%20drivers%20must%20be%20uninstalled%20so%20the%20system%20can%20recognize%20the%20new%20composite%20device

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.