On Jan 1, 1:04 am, "Alex Holkner" <[email protected]> wrote:
> This depends on your hardware.  From pyglet's point of view, if you
> have an HID mouse that is exposed via the Linux evdev API, it will
> expose its events.  Otherwise, you're out of luck (short of writing
> your own kernel driver).
My mouse is exposed on the evdev driver. Using the following program:

import pyglet

window = pyglet.window.Window()
device = pyglet.input.evdev.get_devices()[2] #my relative hid mouse
device.open()

def watch(control):
    @control.event
    def on_change(value):
        print control, value

for control in device.get_controls():
    watch(control)
pyglet.app.run()

I get:

RelativeAxis(name=y, raw_name=REL_Y) 1
RelativeAxis(name=x, raw_name=REL_X) -1
RelativeAxis(name=y, raw_name=REL_Y) 1
RelativeAxis(name=x, raw_name=REL_X) -1
RelativeAxis(name=y, raw_name=REL_Y) 1

Clearly, that's not raw mouse output.

> evdev was chosen on Linux because joydev doesn't have anywhere near
> the capabilities needed to match features with Windows and OS X -- it
> just wouldn't fit into the pyglet joystick API (which, for example,
> allows for joystick enumeration and inspection).

You can enumerate joysticks as well with joydev (just filter os.listdir
('/dev/input') by js\d+), and you can get the number of axes and
buttons as well as the initial state they're in.
As far as I know that's everything you need for the API of yours.

> You'll need to add a local udev rule to give users permission to use
> your joystick device via evdev.  While this isn't ideal, I don't think
> it's unreasonable.

Writing udev rules involves editing system configuration files by hand
that look like this
KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k"
KERNEL=="hiddev*", NAME="usb/%k"

and Restarting a daemon (/etc/init.d/udev restart)

While it may not be unreasonable to you and me, I'd think that out of
the 2% or so linux desktop users most won't ever know how to do that.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to