I just installed Gizmod 3.4 and I noticed that although several of the included scripts have an onDeviceEvent() method, this seems to never be called. However, the onEvent() method is called.
If it matters, my system is Gentoo. I compiled the source from scratch (not the ebuild), I have tried it with boost-3.4.0 and boost-3.4.1.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm pretty sure this is related to the no keyboards problem you posted about in the other thread, so let's work from that first and come back to this if we need to.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
from GizmoDaemon import *
from GizmoScriptDefault import *
ENABLED = True
VERSION_NEEDED = 3.2
INTERESTED_CLASSES = [GizmoEventClass.Standard]
INTERESTED_VENDORS = [1699] # decimal version of 0x06a3 - Saitek vendor (shown by 'lsusb' command)
INTERESTED_PRODUCTS = [32960] # decimal version of 0x80c0 - PRO GAMER-Command Unit (shown by 'lsusb' command)
############################
# SaitekPGCU Class definition
##########################
class SaitekPGCU(GizmoScriptDefault):
"""
Saitek PRO GAMER-Command Unit Event Mapping
"""
############################
# Public Functions
##########################
def onDeviceEvent(self, Event, Gizmo = None):
"""
See GizmodDispatcher.onEvent documentation for an explanation of this function
"""
if Event.Class in INTERESTED_CLASSES:
if Gizmo.DeviceIDVendor in INTERESTED_VENDORS and Gizmo.DeviceIDProduct in INTERESTED_PRODUCTS:
print Gizmod.Keyboards
return True # let Gizmo know that we handled it
Yeah you actually need a keyboard AND mouse for those callbacks to work.
I notice that on startup gizmod is thinking you have two keyboards? Is this right? I'm hoping it's not.
It may sound strange -- why would you need a keyboard and mouse... but the scripts are currently making the assumption that you might want to create keyboard and mouse events. (Ie you need a mouse device to create fake mouse events on).
Again I've got some plans on how to fix this in a future version. I'm planning on writing dummy keyboard and mouse kernel modules that gizmod can create events on even if you don't have those devices connected to the system.
That being said, if you do have two keyboards, no mouse, and want this configuration, it's totally doable, you just won't be able to create fake mouse events. I can help you through the small changes that'd be needed to make this work, but I'm thinking right now this probably isn't what you want so I'll wait until I get verification from you about that.
What exactly did you put in your KEYBOARD_GIZMOS and MOUSE_GIZMOS?
Thanks,
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Yeah you actually need a keyboard AND mouse for those callbacks to work.
OK. I will give that a try.
> I notice that on startup gizmod is thinking you have two keyboards? Is this right? I'm hoping it's not.
Yes and no. There are two keyboards -- a "Gyration GyroPoint" and "USB keyboard". The two keyboards detected by gizmod however, are in fact the one "USB keyboard" that gets registered as two /dev/input/eventX files.
> I'm planning on writing dummy keyboard and mouse kernel modules that gizmod can create
> events on even if you don't have those devices connected to the system.
That sounds like it might be a good solution.
> That being said, if you do have two keyboards, no mouse, and want this configuration, it's totally doable,
> you just won't be able to create fake mouse events.
I won't need to generate any fake mouse events. I am just trying to make something that can turn my new (not fully supported by the kernel) gaming controller into keyboard events. If I can get something working, I would gladly contribute it to the project.
> What exactly did you put in your KEYBOARD_GIZMOS and MOUSE_GIZMOS?
For this run, I left them as they are in the default distribution. I merely connected a wired USB keyboard so that Keyboards[] would have something in it. KEYBOARD_GIZMOS = ["keyboard"] MOUSE_GIZMOS = ["mouse", "trackball", "touchpad", "!Macintosh mouse button emulation"]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay I get what you want to do and it can definitely be done. Unfortunately I don't actually have time to go through this at the moment -- I'm off at the end of the week to get married so things are a little hectic and chaotic right now. I just wanted you to know I haven't forgotten about you, but it may be a few weeks until I properly respond to this.
Thanks,
Tim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just installed Gizmod 3.4 and I noticed that although several of the included scripts have an onDeviceEvent() method, this seems to never be called. However, the onEvent() method is called.
If it matters, my system is Gentoo. I compiled the source from scratch (not the ebuild), I have tried it with boost-3.4.0 and boost-3.4.1.
I'm pretty sure this is related to the no keyboards problem you posted about in the other thread, so let's work from that first and come back to this if we need to.
OK, I got the Keyboards[] array to have something in it (see the other thread). However, it seems that my onDeviceEvent() is never called.
When gizmod starts up, here is what it says:
******************************************************************
GizmoDaemon v3.4 -=- (c) 2007, Tim Burrell <tim.burrell@gmail.com>
=---------=
Registering Devices:
Standard - Directory [input]
Standard - Power Button (FF) [event0] vId: 0x0 pId: 0x2
Standard - Power Button (CM) [event1] vId: 0x0 pId: 0x1
Standard - Gyration GyroPoint RF Technology Receiver [event2] vId: 0xc16 pId: 0x1
Standard - Gyration GyroPoint RF Technology Receiver [event3] vId: 0xc16 pId: 0x1
Standard - Saitek Pro Gamer Command Unit [event4] vId: 0x6a3 pId: 0x80c0
Keyboard - USB Keyboard [event5] vId: 0x1241 pId: 0x1603
Keyboard - USB Keyboard [event6] vId: 0x1241 pId: 0x1603
Loading User Scripts:
SaitekPGCU - Saitek PRO GAMER-Command Unit Event Mapping
******************************************************************
The following script is only when the OnDeviceEvent() method is changed to OnEvent():
******************************************************************
from GizmoDaemon import *
from GizmoScriptDefault import *
ENABLED = True
VERSION_NEEDED = 3.2
INTERESTED_CLASSES = [GizmoEventClass.Standard]
INTERESTED_VENDORS = [1699] # decimal version of 0x06a3 - Saitek vendor (shown by 'lsusb' command)
INTERESTED_PRODUCTS = [32960] # decimal version of 0x80c0 - PRO GAMER-Command Unit (shown by 'lsusb' command)
############################
# SaitekPGCU Class definition
##########################
class SaitekPGCU(GizmoScriptDefault):
"""
Saitek PRO GAMER-Command Unit Event Mapping
"""
############################
# Public Functions
##########################
def onDeviceEvent(self, Event, Gizmo = None):
"""
See GizmodDispatcher.onEvent documentation for an explanation of this function
"""
if Event.Class in INTERESTED_CLASSES:
if Gizmo.DeviceIDVendor in INTERESTED_VENDORS and Gizmo.DeviceIDProduct in INTERESTED_PRODUCTS:
print Gizmod.Keyboards
return True # let Gizmo know that we handled it
return False
############################
# Private Functions
##########################
def __init__(self):
"""
Default Constructor
"""
GizmoScriptDefault.__init__(self, ENABLED, VERSION_NEEDED, INTERESTED_CLASSES)
############################
# SaitekPGCU class end
##########################
SaitekPGCU()
******************************************************************
Yeah you actually need a keyboard AND mouse for those callbacks to work.
I notice that on startup gizmod is thinking you have two keyboards? Is this right? I'm hoping it's not.
It may sound strange -- why would you need a keyboard and mouse... but the scripts are currently making the assumption that you might want to create keyboard and mouse events. (Ie you need a mouse device to create fake mouse events on).
Again I've got some plans on how to fix this in a future version. I'm planning on writing dummy keyboard and mouse kernel modules that gizmod can create events on even if you don't have those devices connected to the system.
That being said, if you do have two keyboards, no mouse, and want this configuration, it's totally doable, you just won't be able to create fake mouse events. I can help you through the small changes that'd be needed to make this work, but I'm thinking right now this probably isn't what you want so I'll wait until I get verification from you about that.
What exactly did you put in your KEYBOARD_GIZMOS and MOUSE_GIZMOS?
Thanks,
Tim.
Tim, you wrote:
> Yeah you actually need a keyboard AND mouse for those callbacks to work.
OK. I will give that a try.
> I notice that on startup gizmod is thinking you have two keyboards? Is this right? I'm hoping it's not.
Yes and no. There are two keyboards -- a "Gyration GyroPoint" and "USB keyboard". The two keyboards detected by gizmod however, are in fact the one "USB keyboard" that gets registered as two /dev/input/eventX files.
> I'm planning on writing dummy keyboard and mouse kernel modules that gizmod can create
> events on even if you don't have those devices connected to the system.
That sounds like it might be a good solution.
> That being said, if you do have two keyboards, no mouse, and want this configuration, it's totally doable,
> you just won't be able to create fake mouse events.
I won't need to generate any fake mouse events. I am just trying to make something that can turn my new (not fully supported by the kernel) gaming controller into keyboard events. If I can get something working, I would gladly contribute it to the project.
> What exactly did you put in your KEYBOARD_GIZMOS and MOUSE_GIZMOS?
For this run, I left them as they are in the default distribution. I merely connected a wired USB keyboard so that Keyboards[] would have something in it. KEYBOARD_GIZMOS = ["keyboard"] MOUSE_GIZMOS = ["mouse", "trackball", "touchpad", "!Macintosh mouse button emulation"]
Okay I get what you want to do and it can definitely be done. Unfortunately I don't actually have time to go through this at the moment -- I'm off at the end of the week to get married so things are a little hectic and chaotic right now. I just wanted you to know I haven't forgotten about you, but it may be a few weeks until I properly respond to this.
Thanks,
Tim.