Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Joysticks.. oww  (Read 3901 times)

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« on: October 25, 2005, 02:09:14 PM »

Well, I've al most finished joystick support.. However, there are some paculiar things...

It could be just that the joystick I have sucks (in terms of driver support though) - a modified xbox controller. It works fine mostly.

The only issues I've seen that bother me... On linux, the dpad (a hat) is treated as a button, and on linux it is an axis.. which is ok I guess. However, on linux the left and right position of the DPad register as 32676 (or whatever the full on is). So, there is there is only on or off. There should be a negitive value for one direction :/ (the up and down DPad works good).

Another issue on windows.. DirectInput registers the buffered event values for the axis (there are two sticks on xbox controller) incorrectly. They are almost right, but fluctaute to wierd values... Immediate values are perfect though. But, that renders action mapping for joysticks to nothing. Just wierd.. I really need some more joysticks to test with to see if some of my assumptions hold up....

Though.. the problems are probably due to the XBox controller.. And a more standard one whould probably work better on linux and windows.

Anyway.. I just need to get hats working on Win32... and for the most part, joystick and action mapping will be ready for a release. Maybe not perfect, but ready for a release nontheless.. All these issues will be cleared up by version 1... Perhaps even calibration support will be added internally to the joystick class.. where you can (via a text file) change the mappings of axis event to axis number, and adjust tolerence settings.. This joystick I have, for one, is always devaiting values even when center and not being touched.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #1 on: October 27, 2005, 08:47:39 PM »

Ok, I have also seen the same crazy values coming from Linux too when using the eventX stuff (which I will need when finally getting force feedback working on linux)..

With that said.. I will hold off on trying to fix that, as I have spent all day trying to build my own xpad module with no luck. I guess I will have to recompile the kernel (also needed for trying to get force feedback working for me). But, i have other parts to work on, so that is now back burner,, at least FF on linux is.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #2 on: October 30, 2005, 06:29:07 PM »

Hmm, well, the crazy values on linux were either a) me being crazy.. or b) just an random error... Because, now Linux works fine for me...

Ok, so, this means I am going to switch from using the JoyStick.h API, and instead move over to the linux/input.h API. Why? Because... By using the input.h header (which also involves using /dev/input/eventXX instead of /dev/input/jsXX) I gain two advantages: 1) Better Joystick Axis/Button & Hats... 2) It seems more modern, and probably will get better supported then the other... 3) Force Feedback works through the newer API. - even though my controller does not work with FF on linux.

The API to the outside world will not change.. This is an internal core change.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #3 on: November 03, 2005, 09:25:21 AM »

Ok.. I've done most of the work on FF and Event API in linux.. however, it is not complete... Continue using the old interface for now.. If you are using CVS head, this is acheived using "./configure --disable-joyevents" then building... As events is defaults. It works, except I have not yet filled in the Axis event/state updating yet. Buttons work fine :)

I've done just about as much FF stuff I can on linux right now, until I can a) get my controller working or b) get another controoler, or someone testing with a Linux FF capable controller.

So, i am moving back to DX to start actually implementing FF there.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #4 on: November 03, 2005, 01:57:31 PM »

've gotten Axes & Buttons working with JoyStick events API now... THe only catch, you have to enabled read/write access on your event# (either all, or just the specific joystick event#) or else it fails... js# is always read enabled, the events are not.. Seems like a stupid linux thing, if any knows how to make the automatically created evnt files read/write access allowed, please let me know.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #5 on: November 06, 2005, 11:22:06 AM »

Well, I figured out how to change the rules for when devices are plugged in (during boot and hotplug)... in /etc/udev/rules.d add a rules file... I named my 20-test.rules

THe 20 is because there was one named 10- and the default one was named 50-, so I picked a random numer there.. Not sure of any significance. Anyway, the test is just becase that, it is a test rule files right now.

Anyway, the contents:
Code: [Select]

# udev rules for allowing "games" group read/write access to the joystick device event
BUS=="usb", KERNEL=="event*", GROUP="games", MODE="0660", NAME="input/%k"

A reboot for me was in order for the rule to be followed.

Basically, this is not complete.. But, what it does as is right now is create any USB event device (USB mouse, joystick, tablet, etc etc) with group "games" and has a setting of 660 (owner/group read/write, other none). This can be refined more I'm sure, for specific bus, id etc information to only let certain controls read/write.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #6 on: May 04, 2006, 08:15:50 PM »

Blah!!! Again, more problems.. On my latest FC5 box (this works on both FC4 boxes), I can't get this udev rule to be picked up.. Hence, joystick only works under root. If anyone has some insight, I'm all ears.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #7 on: May 04, 2006, 08:45:41 PM »

Hmm, it seems to be apllying my rule (which I found that instead ofa reboot, you only need to do "/sbin/udevstart" to have the new rule work)... However, the GROUP="" does not seem to work.. And, setting the permissions is the whole reason for the rule.. Ahh!
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Joysticks.. oww
« Reply #8 on: May 04, 2006, 11:06:34 PM »

Wow.. That was hours wasted. I figured out what has changed...

Apparently, even after a rule match is made, several other rules can change it :( The rule file 50-udev.rules had an entry: kernel="*", OWNER="root", GROUP="root", MODE="0600"
Which, apparently causes the permsssions I set to be reset :/ Which is odd.. as, I had initially had my rule file last, so it should have changed that (until, I read, that I should have my rul file first, so that the first match would be the one)... So, it is either that a wild card can change something once set (hence the "*"), or something entirely wierd oO

Anyway, I resolved the situation, by placing the rule in the the 50-udev.rules file, right after the wild card entry... And, now, it works.
Logged