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

OSX joystick patch #614

Closed
SiegeLord opened this issue Apr 10, 2016 · 7 comments
Closed

OSX joystick patch #614

SiegeLord opened this issue Apr 10, 2016 · 7 comments
Labels

Comments

@SiegeLord
Copy link
Member

See https://www.allegro.cc/forums/thread/616193

@SiegeLord SiegeLord added the OSX label Apr 10, 2016
@ghost
Copy link

ghost commented Apr 11, 2016

How does this relate to #579, does it help?

@NewCreature
Copy link
Contributor

It doesn't relate to that issue. This patch is strictly to make enumerating connected joysticks more robust. The current implementation assumes each HID device is one controller/joystick. The patch fixes this by interpreting each collection reported by the device as a separate controller/joystick (this is part of the USB HID spec).

@ghost
Copy link

ghost commented Apr 12, 2016

I've applied your patch (from a.cc) to a branch in my fork of Allegro, and I'll put in a pull request, unless you want to do it. There are a couple of things which I was going to fix:

  • elements needs releasing in device_count_joysticks (memory leak)
  • The docs for CFStringGetCStringPtr in get_element_name warn that it could return NULL at any time. Sounds ominous... I assume it's not currently a problem in this code but it would be as well to fix it.

@NewCreature
Copy link
Contributor

Yeah, I missed that CFRelease().

get_element_name() doesn't do anything except return default_name on any devices I've ever used. I don't think it will ever get to that CFStringGetCStringPtr() call.

I started working on another patch to get the name and button/stick/axis names from the HID data. I already have the device name working, but I want to see if I can retrieve the other information as well. It should be possible and it would make joystick support on par with the other supported platforms.

@NewCreature
Copy link
Contributor

I put up a new version of the patch in the thread linked above. I went ahead and fixed the two issues you mentioned. I also added support for getting the device name instead of just calling it "Joystick" and I made more appropriate default names for the various types of elements.

@ghost
Copy link

ghost commented Apr 20, 2016

OK I have put this in as a pull request #625. Thanks!

@ghost
Copy link

ghost commented Jul 5, 2016

Looks like this was closed, reopen if I'm mistaken.

@ghost ghost closed this as completed Jul 5, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants