google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

osx platform segmentation fault when opening input devices #625

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run pyglet/examples/input.py with either an "Apple Internal Keyboard / 
Trackpad" or "PLAYSTATION(R)3 Controller" device connected.

What is the expected output? What do you see instead?

Causes a segmentation fault.

Original email report:

"""
I was encountering segmentation faults when running pyglet/examples/input.py on 
my mac;
I was able to come up with a fix:
Turns out to be an issue in the darwin_hid module; specifically there is an 
assumption that the HIDValues are all intvalues. 
Unfortunately the usb devices had elements with larger HIDValue byte lengths 
such as the builtin "Apple Internal Keyboard / Trackpad" which has 511 byte and 
6 byte HIDValue elements (probably related to multitouch...).  Also the 
"PLAYSTATION(R)3 Controller" has a 39 byte HIDValue element.

Using the IOHIDValueGetLength function, i am able to filter out hidvalues > 4 
bytes which would segfault when calling IOHIDValueGetIntegerValue.

Note that the carbon_hid module handles the large payload hid_values without 
segfault; an error is printed out. 
"error adding AbsoluteAxis(raw_name=1:1)" for the PS3 Controller.
"""

Original issue reported on code.google.com by evil.phillip@gmail.com on 8 Jan 2013 at 3:04

GoogleCodeExporter commented 9 years ago
Added a patch to filter out the non-integer values as suggested.  The 
HIDValue.intvalue property is now set to None when the byte length is > 4.

Original comment by evil.phillip@gmail.com on 8 Jan 2013 at 3:15