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

Controllers not found on Mac OSX Monterey (3008) #1524

Closed
GalacticEmperor1 opened this issue Feb 12, 2023 · 1 comment
Closed

Controllers not found on Mac OSX Monterey (3008) #1524

GalacticEmperor1 opened this issue Feb 12, 2023 · 1 comment
Labels
bug Not working as intended macOS

Comments

@GalacticEmperor1
Copy link
Collaborator

Issue №3008 opened by adyb-fj-cns at 2022-01-29 23:33:46

Environment:

  • Mac OSX Monterey
  • Any Python 3.x
  • 2.0.16 or 2.0.18
  • 2.1.0
  • Bluetooth Joysticks (PS5/4 Controllers)

Current behavior:

Bluetooth attached controllers return count of 0 joysticks. However running identical on an identical python env with the exception of Mac OSX version (Big Sur), it correctly returns the bluetooth joystick (PS5 controller, although PS4 didnt show). The controllers are confirmed to be attached via alternative apps on Monterey

Expected behavior:

Joysticks found

Test code

import pygame
pygame.init()
pygame.joystick.init()
joystick_count = pygame.joystick.get_count()
print(joystick_count)

Comments

# # adyb-fj-cns commented at 2022-01-30 14:10:12

I'm seeing other bluetooth python libraries also experiencing issues in OSX 12.x so wonder if this is related. Looks like Apple may have either shut the door or introduced a bug

hbldh/bleak#635

Plugging the controller in via USB-C doesnt work wither in OSX 12 though, even though other Mac apps can see the controller


# # Starbuck5 commented at 2022-02-01 00:15:51

This looks way above my pay grade, but one of the stack overflow links in that issue says that Apple has fixed this in MacOS 12.3.

https://stackoverflow.com/questions/69661809/no-name-or-address-cbcentralmanager-no-longer-working-on-macos-12


# # rethanon commented at 2022-04-13 15:51:53

I tested this with both a PS4 controller (DualShock 4) and a PS5 controller (DualSense), and I can confirm the issue still exists:

O/S: MacOS 12.3.1 (Intel based 2015 MacBook Pro)
Python version: 3.10.0 (SDL version 2.0.20)
Pygame version: 2.1.3.dev2

joystick.get_count() results in 0 despite both controllers showing as connected in the Mac's Bluetooth settings.


# # sabard commented at 2022-06-08 02:42:35

I'm also getting 0 with get_count over USB and bluetooth with a PS4 controller on:

Big Sur 11.2.1 (2019 Intel MBP)
Python 3.8.12
Pygame 2.1.2

The controller is working with hidapi and enjoyable, just not pygame.


# # nello commented at 2022-07-03 01:20:56

I've got the same issue on a 2022 M1 Macbook Pro:

Mac OS 12.4 Monterey
Pygame 2.1.2
Python 3.9.13

Controller shows connection via both/either USB or Bluetooth in https://gamepad-tester.com/

I guess I'll try hidapi and enjoyable. Thanks for the tip @sabard!


# # HubertReX commented at 2022-08-22 10:54:40

Same here on a 2020 M1 Macbook Air with Xbox One wireless (BT) controller:

Mac OS 12.5 Monterey
Pygame 2.1.2
Python 3.8.9

The controller is working fine on https://gamepad-tester.com/

Is there a chance to fix it?


# # g0to commented at 2022-08-29 16:42:20

Same issue. Same repo steps.

  • macOS 12.5.1 (21G83)
  • python 3.10.4
  • pygame 2.1.2

# # g0to commented at 2022-08-30 16:57:06

@Starbuck5, @MyreMylar

OP input doesn't seem to be required anymore. Could any of you remove the needs-op-input label? I'm guessing that could help getting further attention.

Thanks.


# # zoldalma999 commented at 2022-08-30 17:52:19

Sadly, I do not own a mac, but next the step would be to check if it works with sdl. Can you try using https://generalarcade.com/gamepadtool/ and see if that picks it up? If so, post the sdl version that the app uses, as well as what sdl version pygame uses


# # Starbuck5 commented at 2022-08-30 19:36:30

I suspect that this would be fixed with a more up to date version of SDL.

Try “pip install pygame==2.1.3.dev4”

Or try grabbing a prebuilt from main.


# # jaraco commented at 2022-08-31 00:46:05

Same with pygame 2.1.3.dev4:

 ~ $ pip-run -q pygame==2.1.3.dev4 -- -c "import pygame; pygame.init(); pygame.joystick.init(); print(pygame.joystick.get_count())"
pygame 2.1.3.dev4 (SDL 2.0.20, Python 3.10.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
0

SDL2 gamepadtool (SDL 2.0.7) shows the controller.

image

No idea what SDL version pygame uses.


# # Starbuck5 commented at 2022-08-31 04:15:52

Says so in the support prompt:

pygame 2.1.3.dev4 (SDL 2.0.20, Python 3.10.6)

Try a wheel from this page: https://github.com/pygame/pygame/actions/runs/2954328519
download the artifacts
pick out the correct wheel for your python installation and architecture
pip install [the wheel filename] (from the directory with the wheel in it ofc)

I believe they would be on SDL 2.0.22, so perhaps it's fixed in that.


# # jaraco commented at 2022-08-31 12:31:42

Still no luck:

 ~ $ py -3.10 -m pip-run ~/Downloads/pygame-wheels/pygame-2.1.3.dev5-cp310-cp310-macosx_11_0_arm64.whl -- -c "import pygame; pygame.init(); pygame.j
oystick.init(); print(pygame.joystick.get_count())"
Processing ./Downloads/pygame-wheels/pygame-2.1.3.dev5-cp310-cp310-macosx_11_0_arm64.whl
Installing collected packages: pygame
Successfully installed pygame-2.1.3.dev5
pygame 2.1.3.dev5 (SDL 2.0.20, Python 3.10.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
0

Those artifacts still have SDL 2.0.20.


# # HubertReX commented at 2022-09-19 10:58:22

https://generalarcade.com/gamepadtool/

this actually helped in my case - after installing this tool Xbox One wireless gamepad is now working fine with pygame. Thanks a lot!


# # g0to commented at 2022-09-19 12:00:03

https://generalarcade.com/gamepadtool/

this actually helped in my case - after installing this tool Xbox One wireless gamepad is now working fine with pygame. Thanks a lot!

@HubertReX, could you share your setup? Running versions of macOS, pygame, python, SDL and any other remarkable settings.

Thanks.


# # HubertReX commented at 2022-09-21 08:37:47

https://generalarcade.com/gamepadtool/

this actually helped in my case - after installing this tool Xbox One wireless gamepad is now working fine with pygame. Thanks a lot!

@HubertReX, could you share your setup? Running versions of macOS, pygame, python, SDL and any other remarkable settings.

Thanks.

@g0to sure, here you go:
macOS: 12.6
pygame: 2.1.2
SDL: 2.0.18
Python: 3.9.6


# # yokoro13 commented at 2022-11-01 11:14:51

After updating to 2.1.3.dev8, Xbox wireless controller is now found.
macOS: 11.5.1
pygame: 2.1.3.dev8
SDL: 2.0.22
Python: 3.8.2


# # SSG0210 commented at 2022-11-24 11:50:47

Dualsock 4 Wireless Controller doesn't work in Mac book Pro 2017 , macOS Monterey 12.6.1

pygame: neither 2.1.2 nor 2.1.3.dev8
SDL: 2.0.18
Python: 3.9.12

I don't use for gaming I use to control a robot and the rest of things I use in it work perfectly only fail the DS4 I can't believe it!

any solution?

thanks


# # orinker commented at 2023-01-22 20:40:52

Hi all the people on this thread: I have exactly the same problem as you mentioned above. And none of the mentioned solution works. But I roll back the Pygame version to 2.0.1, it suddenly works! It's the SDL version that causes this issue.


# # jaraco commented at 2023-01-22 22:23:38

Confirmed with .dev8, the issue is resolved:

$ py -3.11 -m pip-run https://github.com/pygame/pygame/releases/download/2.1.3.dev8/pygame-2.1.3.dev8-cp311-cp311-macosx_11_0_arm64.whl -- -c "import pygame; pygame.init(); pygame.joystick.init(); print(pygame.joystick.get_count())"
pygame 2.1.3.dev8 (SDL 2.0.22, Python 3.11.1)
Hello from the pygame community. https://www.pygame.org/contribute.html
1

# # SSG0210 commented at 2023-02-01 14:36:50

Hi, Thanks jaraco,

I've got install and recognize the device.

pygame 2.1.3.dev8 (SDL 2.0.22, Python 3.11.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
1

but now I have the next problem:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff818912773 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff818672bc3 objc_exception_throw + 48
2 AppKit 0x00007ff81b2ce311 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4633
3 libSDL2-2.0.0.dylib 0x000000010ba351cd Cocoa_PumpEvents + 125
4 libSDL2-2.0.0.dylib 0x000000010b967061 SDL_PumpEvents_REAL + 33
5 event.cpython-311-darwin.so 0x000000010b7a15a5 _pg_event_wait + 149
6 event.cpython-311-darwin.so 0x000000010b79ec81 pg_event_wait + 129
7 python3.11 0x000000010aea9694 cfunction_call + 52
8 python3.11 0x000000010af9e0f7 _PyEval_EvalFrameDefault + 235927
9 python3.11 0x000000010ae4584f _PyFunction_Vectorcall + 511
10 python3.11 0x000000010ae4b73d method_vectorcall + 445
11 python3.11 0x000000010b09806b thread_run + 235
12 python3.11 0x000000010b023544 pythread_wrapper + 36
13 libsystem_pthread.dylib 0x00007ff8187d04e1 _pthread_start + 125
14 libsystem_pthread.dylib 0x00007ff8187cbf6b thread_start + 15
)
libc++abi: terminating with uncaught exception of type NSException
Abort trap: 6


# # MyreMylar commented at 2023-02-01 20:06:48

The error log sounds like a second thread being used for the event loop - which you can't do


# # SSG0210 commented at 2023-02-02 07:37:44

Thanks MyreMylar,

I check it, but the same code runs perfectly in Linux and Windows, the problem only exists in Mac (intel), that is a shame!

@zoldalma999
Copy link
Member

This seems to be fixed from SDL 2.0.22, and we use SDL 2.26.5 as of now. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended macOS
Projects
None yet
Development

No branches or pull requests

2 participants