Menu

Joystick?

Help
Cheech
2007-10-04
2013-04-23
  • Cheech

    Cheech - 2007-10-04

    I saw mentioned on the home page the reference to being able to use a joystick with gizmod.  Could anyone point me in the right direction as to where to begin with such a thing?  I have it plugged in and it is reading the inputs with the gizmod -g command.  Do I need to somehow translate the raw values into "keystrokes/mouseclicks/etc?  And if so, how? 

    This is a brilliant project and a great idea.  I've spent the last couple evenings trying to understand the python layout and syntax for this.  I'd really dig the idea of using this :D

    the joystick btw is a USB to Playstation joystick converter, with the Playstation 2 IR sensor/remote plugged into it.  It identifies as greenasia usb joystick to ubuntu.  Ideally I'd like to simulate the abilities of a mouse... cursor control and clickability within Xwindows.  Any suggestions at all are welcome. 

    Thanks and Cheers to Tim!

     
    • Cheech

      Cheech - 2007-10-11

      After reading through the forums and the How-to's and Tutorials, I just need some info on what to use format-wise for the "if Event.Code == <Value_of_joystick_directional_pad_or_button>".  Given this, I think that I can get the rest accomplished.

      Thanks again

       
      • Tim Burrell

        Tim Burrell - 2007-10-11

        Hey Cheech,

        There is some documentation online about this:  http://gizmod.sourceforge.net/documentation/apidocs/a00316.html  and  http://gizmod.sourceforge.net/documentation/apidocs/a00552.html

        That being said, those pages aren't all that helpful.

        What I would do is start gizmod in debug mode (gizmod -g), and press the buttons you're interesting in capturing and sending.  The output will show you exactly what codes and event types you need to capture / send.

        If you're still left scratching your head, paste some debug output and I'll see if I can help sort it out.

        Thanks,

        Tim.

         
    • Tim Burrell

      Tim Burrell - 2007-10-11

      Hey thanks, and yeah this is definitely doable!

      I've actually used my joystick for tons of things already, and in fact I frequently use the pedals on my racing wheel to scroll firefox up and down.  See the MomoRacing.py script: http://gizmod.svn.sourceforge.net/viewvc/gizmod/gizmod3/scripts/modules.d/610-MomoRacing.py?view=markup

      Have you gotten anywhere so far?

      Thanks,

      Tim.

       
    • Cheech

      Cheech - 2007-10-11

      I think the momo racing wheel config will help when I get home.  Just a couple of questions though.  Is the Class MomoRacing(GizmoScriptDefault) defined in the script itself or somewhere else? And for Interested Products/Vendors assignment... Is that info explicitly necessary for non-standard peripherals? And if so, where do I get that from? Beyond that, I believe everything else is clear and will get a chance to attempt some hacking tonight when I get home.

      Thanks Tim

       
    • Cheech

      Cheech - 2007-10-14

      How do I define the Class for my joystick as you had for the momo racing wheel?

      Is it reasonable to have the following as and expression to trigger mouse cursor movement UP?

      if Event.Type == GizmoEventType.EV_ABS and Event.Code == 0x1 and Event.Value == 0x0:
                    Gizmod.Mice[0].createEvent(GizmoEventType.EV_REL, -0x1, 0x3)
                  return True

      Type.EV_ABS signals one of the "axis" keys, Code.0x1 signals the "y" axis, and Value.0x0 signals "up"?
      (if I am understanding the information correctly)

      As for debug output, did you mean the the codes for the button presses on the joystick through gizmod -g or did you mean error messages when trying to run gizmod with my ghetto script attempt?

      I am Stuck and believe this is a simple procedure that I am not fully understanding.

      Thanks

       
      • Tim Burrell

        Tim Burrell - 2007-10-17

        Hey Cheech,

        What do you mean exactly by how do you define a class?

        What I would do is just make a direct copy of the MomoRacing script... change the classname from MomoRacing to whatever you want... make sure you change INTERESTED_PRODUCTS and INTERESTED_VENDORS to match the output that comes up when you start gizmod (when it enumerates the devices connected to your system.

        Delete the scrolling speed stuff, you probably don't need that.

        Other than that it sounds like you've got the right idea.  As for the details like what Value and Code designate I can't say since each device is different.  This is why I was suggesting capturing some input from your device with gizmod running in debug mode (gizmod -g) and pasting it.  But if you already have this figured out, then don't worry about it.

        If you're still stuck, or I'm not making sense, just let me know!

        Thanks,

        Tim.

         

Log in to post a comment.