On Dec 31, 7:02 am, Alex Holkner <[email protected]> wrote:
> On Linux, pyglet.input exposes both xinput and evdev devices -- it
> does not look for joysticks in xinput.
The routine you use to detect joysticks isn't quite working I think. I
have one plugged in and it doesn't detect it.
You do
def get_joysticks(display=None):
return filter(None, [_create_joystick(d) for d in get_devices
(display)])
where the get_devices filters on
if filename.startswith('event'):
My joystick lives in /dev/input/js0, therefore it isn't detected.
Here's how I detect joysticks:
js_re = re.compile(r'^js\d+$')
id_re = re.compile(r'^usb-(.*?)-joystick$')
@classmethod
def available(cls):
by_id = '/dev/input/by-id'
joysticks = list()
for name in os.listdir(by_id):
match = id_re.match(name)
if match:
link = os.path.basename(
os.readlink(
os.path.join(by_id, name)
)
)
if js_re.match(link):
joysticks.append(
cls(match.group(1))
)
return joysticks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---