Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse input does not work (is ignored) in MacOS #4532

Closed
marcos-diaz opened this issue Mar 7, 2021 · 7 comments
Closed

Mouse input does not work (is ignored) in MacOS #4532

marcos-diaz opened this issue Mar 7, 2021 · 7 comments
Assignees
Milestone

Comments

@marcos-diaz
Copy link

Setup

  • Firmware: CircuitPython 6.2.0 beta 3 (en_US)
  • Board: Raspberry Pi Pico
  • Host: Apple MacOS Big Sur 11.2.2 on MacBook Pro 2014

Reproduce

  1. Load this code as code.py
import time
import board
from digitalio import DigitalInOut, Pull
import usb_hid
from adafruit_hid.mouse import Mouse

button = DigitalInOut(board.GP16)
button.pull = Pull.DOWN
mouse = Mouse(usb_hid.devices)

while True:
    time.sleep(0.1)
    if button.value:
        print('CLICK!')
        mouse.click(Mouse.LEFT_BUTTON)
  1. Connect to host OS via USB cable.
  2. Push the button.

Expected results

  • Mouse clicks are performed on pushing the button.
  • It should work in any operative system.

Actual results

  • MacOS recognises there is a mouse (see below), but fails to perform a mouse click.
  • It does not work either in MacOS recovery mode (no user config).
  • Works as expected on Windows 10.
  • Works as expected on GNU/Linux.
  • Works as expected on PC BIOS.
  • No errors nor warnings are shown in the stdout.

Additional notes.

  • Mouse movement and wheel does not work either, with same results regarding OS' (it works in everything but MacOS).
  • Mouse usb_hid.device is present as expected with 0x01 page and 0x02 usage.
  • MacOS actually detects there is a mouse connected since the mouse config menu goes from this

to this

Screenshot 2021-03-07 at 10 32 15

when connected.

Thanks.

@marcos-diaz
Copy link
Author

I also replicated the issue in an older Mac with 10.15 Catalina.

@TomasHubelbauer
Copy link

FWIW, I can reproduce exactly the same issue, the only difference being I am on 11.2.3. Presumably, it worked very recently, since this YouTube video came out 10 days ago and in it, the library usage works:
https://www.youtube.com/watch?v=MjCFJCfq8ko

@dhalbert
Copy link
Collaborator

dhalbert commented Mar 16, 2021

@marcos-diaz Are you able and/or willing to try a custom build of CircuitPython? If so, try turning off other HID devices, particularly the "Gamepad" device. We know that on iOS, if Gamepad is on, other devices such as Keyboard don't work. However, it did used to work on MacOS.

If you can't do a custom build, I can try one.

@marcos-diaz
Copy link
Author

@TomasHubelbauer thanks to the video you linked I noticed that CircuitPython 6.2.0 beta 2 does not have the issue and mouse works as expected in MacOS. So the bug was introduced in beta 3.

@dhalbert 👆above info is possibly more relevant than me trying to compile the whole project, ping me later if you want me to try nightly builds for potential fixes.

@dhalbert dhalbert transferred this issue from adafruit/Adafruit_CircuitPython_HID Apr 1, 2021
@dhalbert
Copy link
Collaborator

dhalbert commented Apr 1, 2021

I got this issue mixed up with #4479. The report of beta.2 working is surprising, and I will see what is going on. Nevertheless, see #4531.

@dhalbert
Copy link
Collaborator

dhalbert commented Apr 1, 2021

Aha: the YouTube video https://www.youtube.com/watch?v=MjCFJCfq8ko cited above shows a mouse being used on Linux. This is a MacOS-specific problem. Closing this in favor of #4479, but they were both helpful.

@dhalbert dhalbert closed this as completed Apr 1, 2021
@dhalbert dhalbert added this to the Support milestone Apr 1, 2021
@dhalbert
Copy link
Collaborator

dhalbert commented Apr 5, 2021

Fixed by #4558 and #4560.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants