Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-24 Thread René Dudfield
hi again,

I didn't end up buying a joypad yet...

from the SDL mailing list...   are you able to use the SDL program
testjoy.c to see if that works?  It comes with the SDL source code.


cu,


On Sun, May 24, 2009 at 3:42 PM, René Dudfield ren...@gmail.com wrote:
 cool, ok.  I let the SDL mailing list know that too.

 cheers,



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-24 Thread pymike
Hey, I'll try it tomorrow, I don't have the SDL source code. It's almost
midnight here. :)

On Sun, May 24, 2009 at 11:19 PM, René Dudfield ren...@gmail.com wrote:

 hi again,

 I didn't end up buying a joypad yet...

 from the SDL mailing list...   are you able to use the SDL program
 testjoy.c to see if that works?  It comes with the SDL source code.


 cu,


 On Sun, May 24, 2009 at 3:42 PM, René Dudfield ren...@gmail.com wrote:
  cool, ok.  I let the SDL mailing list know that too.
 
  cheers,
 




-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-23 Thread René Dudfield
Hi,

I've posted your test program to the ubuntu bug, and also sent it along to
the SDL mailing list.

The best chance of getting joystick working in the short term(6-12 months)
however is to include a python joystick implementation in pygame.

I know there's been some implementations floating around...  I'll ask Simon
Wittber if he wants to contribute what he has done to pygame... and maybe we
can modify that to work well enough.


My mission tomorrow will be to buy another joystick, so I can debug it
myself... damn... I had two of them last time I moved... and also 6 dance
mats... but now nothing.



cu.




On Sat, May 16, 2009 at 1:58 AM, pymike pymik...@gmail.com wrote:

 It's definitely SDL. I made a demo that checks for hats, hat presses, and
 button presses. Output:

 Name of joystick: Logitech Logitech Dual Action
 Number of hats: 0
 Number of buttons: 12
 Number of balls: 0
 1 was released
 2 was released
 1 was pressed
 1 was released
 2 was pressed
 2 was released

 Here's the code:

 #include SDL/SDL.h

 int main() {
 SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO);
 SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
 SDL_Joystick *joy;
 joy = SDL_JoystickOpen(0);
 printf(Name of joystick: %s\n, SDL_JoystickName(0));
 printf(Number of hats: %d\n, SDL_JoystickNumHats(joy));
 printf(Number of buttons: %d\n, SDL_JoystickNumButtons(joy));
 printf(Number of balls: %d\n, SDL_JoystickNumBalls(joy));

 SDL_Event event;
 Uint8 hat_state;

 int running = 1;
 while( running ) {

 SDL_JoystickUpdate();

 hat_state = SDL_JoystickGetHat(0, 0);
 if( hat_state == SDL_HAT_UP )
 printf(Hat is pointing up);

 while(SDL_PollEvent(event)) {
 switch(event.type) {
 case SDL_QUIT:
 running = 0;
 break;
 case SDL_KEYDOWN:
 switch(event.key.keysym.sym) {
 case SDLK_ESCAPE:
 running = 0;
 break;
 default:
 break;
 }

 break;
 case SDL_JOYBUTTONDOWN:
 switch(event.jbutton.button) {
 case 1:
 printf(1 was pressed\n);
 break;
 case 2:
 printf(2 was pressed\n);
 break;
 }

 break;
 case SDL_JOYBUTTONUP:
 switch(event.jbutton.button) {
 case 1:
 printf(1 was released\n);
 break;
 case 2:
 printf(2 was released\n);
 break;
 }

 break;
 }
 }
 }

 SDL_Quit();
 return 1;
 }


 --
 - pymike



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-23 Thread René Dudfield
hi again,

I got this feedback from the bug report:
'How come you didn't show axes? On your bug at launchpad.net, you report
that hats and axes are not recognized.'

Are you able to put in the axes code, and print out what it reports?


cu,



On Sat, May 23, 2009 at 5:34 PM, René Dudfield ren...@gmail.com wrote:

 Hi,

 I've posted your test program to the ubuntu bug, and also sent it along to
 the SDL mailing list.

 The best chance of getting joystick working in the short term(6-12 months)
 however is to include a python joystick implementation in pygame.

 I know there's been some implementations floating around...  I'll ask Simon
 Wittber if he wants to contribute what he has done to pygame... and maybe we
 can modify that to work well enough.


 My mission tomorrow will be to buy another joystick, so I can debug it
 myself... damn... I had two of them last time I moved... and also 6 dance
 mats... but now nothing.



 cu.





 On Sat, May 16, 2009 at 1:58 AM, pymike pymik...@gmail.com wrote:

 It's definitely SDL. I made a demo that checks for hats, hat presses, and
 button presses. Output:

 Name of joystick: Logitech Logitech Dual Action
 Number of hats: 0
 Number of buttons: 12
 Number of balls: 0
 1 was released
 2 was released
 1 was pressed
 1 was released
 2 was pressed
 2 was released

 Here's the code:

 #include SDL/SDL.h

 int main() {
 SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO);
 SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
 SDL_Joystick *joy;
 joy = SDL_JoystickOpen(0);
 printf(Name of joystick: %s\n, SDL_JoystickName(0));
 printf(Number of hats: %d\n, SDL_JoystickNumHats(joy));
 printf(Number of buttons: %d\n, SDL_JoystickNumButtons(joy));
 printf(Number of balls: %d\n, SDL_JoystickNumBalls(joy));

 SDL_Event event;
 Uint8 hat_state;

 int running = 1;
 while( running ) {

 SDL_JoystickUpdate();

 hat_state = SDL_JoystickGetHat(0, 0);
 if( hat_state == SDL_HAT_UP )
 printf(Hat is pointing up);

 while(SDL_PollEvent(event)) {
 switch(event.type) {
 case SDL_QUIT:
 running = 0;
 break;
 case SDL_KEYDOWN:
 switch(event.key.keysym.sym) {
 case SDLK_ESCAPE:
 running = 0;
 break;
 default:
 break;
 }

 break;
 case SDL_JOYBUTTONDOWN:
 switch(event.jbutton.button) {
 case 1:
 printf(1 was pressed\n);
 break;
 case 2:
 printf(2 was pressed\n);
 break;
 }

 break;
 case SDL_JOYBUTTONUP:
 switch(event.jbutton.button) {
 case 1:
 printf(1 was released\n);
 break;
 case 2:
 printf(2 was released\n);
 break;
 }

 break;
 }
 }
 }

 SDL_Quit();
 return 1;
 }


 --
 - pymike





Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-23 Thread pymike
On Sat, May 23, 2009 at 3:24 AM, René Dudfield ren...@gmail.com wrote:

 hi again,

 I got this feedback from the bug report:
 'How come you didn't show axes? On your bug at launchpad.net, you report
 that hats and axes are not recognized.'

 Are you able to put in the axes code, and print out what it reports?


 cu,


Ah crap. Yeah that was stupid. Okay, I did some printouts and it appears
it's reading axes fine. I was under the impression that they were called
balls in SDL instead of axes. I guess that would explain why current SDL
games still work with joysticks. :P

However, hats *are* still not working. (I tested with a joystick and a
gamepad, both Logitechs) When you get a gamepad, here's a pygame test
program to run:

import pygame

pygame.init()
screen = pygame.display.set_mode((640, 480))
joy = pygame.joystick.Joystick(0)
joy.init()

print Joy Name:, joy.get_name()
print Num Hats:, joy.get_numhats()
print Num Balls:, joy.get_numballs()
print Num Axes:, joy.get_numaxes()

running = 1
while running:
pygame.time.wait(10)
for e in pygame.event.get():
if e.type == pygame.QUIT:
running = 0
axis1_state = joy.get_axis(1)
axis2_state = joy.get_axis(2)
print Axis 1 State:, axis1_state
print Axis 2 State:, axis2_state

#Uncomment below to test hats. Raises error: invalid joystick hat
#hat_state = joy.get_hat(0)
#print Hat State:, hat_state

Output:

Joy Name: Logitech Logitech Dual Action
Num Hats:SDL_JoystickNumHats value:0:
 0
Num Balls: 0
Num Axes: 6

-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-23 Thread René Dudfield
cool, ok.  I let the SDL mailing list know that too.

cheers,


On Sun, May 24, 2009 at 1:30 AM, pymike pymik...@gmail.com wrote:
 On Sat, May 23, 2009 at 3:24 AM, René Dudfield ren...@gmail.com wrote:

 hi again,

 I got this feedback from the bug report:
 'How come you didn't show axes? On your bug at launchpad.net, you report
 that hats and axes are not recognized.'

 Are you able to put in the axes code, and print out what it reports?


 cu,

 Ah crap. Yeah that was stupid. Okay, I did some printouts and it appears
 it's reading axes fine. I was under the impression that they were called
 balls in SDL instead of axes. I guess that would explain why current SDL
 games still work with joysticks. :P

 However, hats are still not working. (I tested with a joystick and a
 gamepad, both Logitechs) When you get a gamepad, here's a pygame test
 program to run:

 import pygame

 pygame.init()
 screen = pygame.display.set_mode((640, 480))
 joy = pygame.joystick.Joystick(0)
 joy.init()

 print Joy Name:, joy.get_name()
 print Num Hats:, joy.get_numhats()
 print Num Balls:, joy.get_numballs()
 print Num Axes:, joy.get_numaxes()

 running = 1
 while running:
     pygame.time.wait(10)
     for e in pygame.event.get():
     if e.type == pygame.QUIT:
     running = 0
     axis1_state = joy.get_axis(1)
     axis2_state = joy.get_axis(2)
     print Axis 1 State:, axis1_state
     print Axis 2 State:, axis2_state

     #Uncomment below to test hats. Raises error: invalid joystick hat
     #hat_state = joy.get_hat(0)
     #print Hat State:, hat_state

 Output:

 Joy Name: Logitech Logitech Dual Action
 Num Hats:SDL_JoystickNumHats value:0:
  0
 Num Balls: 0
 Num Axes: 6

 --
 - pymike



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-15 Thread pymike
Hmmm... I'd rather not mess with my SDL build at the moment.

I'm going to write a joystick test in C some time today (or this weekend),
to make sure it *is* SDL. It's odd that current SDL games are still working
with joysticks.

cu,

On Thu, May 14, 2009 at 7:19 PM, René Dudfield ren...@gmail.com wrote:

 hi,

 It's pretty easy to build packages from source into debs...
 http://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html

 If you'd like to go ahead... I can make some mods to SDL, send them to you,
 so you can build the libsdl .deb and let me know what the debugging info is.


 cheers,





 On Fri, May 15, 2009 at 9:47 AM, René Dudfield ren...@gmail.com wrote:

 hi,

 definitely looks like a SDL/ubuntu issue...

 Could be good to add some printf's into the SDL source to see where the
 problem is.

 Do you know how to compile custom source debs?  I'm on Jaunty... so not
 sure how to make debs for intrepid.  Or do you know how to install SDL from
 source?


 cu,







 On Fri, May 15, 2009 at 9:04 AM, pymike pymik...@gmail.com wrote:

 Here's the feedback:

  joy.get_numhats()
 SDL_JoystickNumHats value:0:
 0
  joy.get_numaxes()
 6
  joy.get_numballs()
 0
 

 Anything else I should check? It reads button presses, but won't
 recognize sticks or hats.

 --
 - pymike






-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-15 Thread pymike
It's definitely SDL. I made a demo that checks for hats, hat presses, and
button presses. Output:

Name of joystick: Logitech Logitech Dual Action
Number of hats: 0
Number of buttons: 12
Number of balls: 0
1 was released
2 was released
1 was pressed
1 was released
2 was pressed
2 was released

Here's the code:

#include SDL/SDL.h

int main() {
SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO);
SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
SDL_Joystick *joy;
joy = SDL_JoystickOpen(0);
printf(Name of joystick: %s\n, SDL_JoystickName(0));
printf(Number of hats: %d\n, SDL_JoystickNumHats(joy));
printf(Number of buttons: %d\n, SDL_JoystickNumButtons(joy));
printf(Number of balls: %d\n, SDL_JoystickNumBalls(joy));

SDL_Event event;
Uint8 hat_state;

int running = 1;
while( running ) {

SDL_JoystickUpdate();

hat_state = SDL_JoystickGetHat(0, 0);
if( hat_state == SDL_HAT_UP )
printf(Hat is pointing up);

while(SDL_PollEvent(event)) {
switch(event.type) {
case SDL_QUIT:
running = 0;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
running = 0;
break;
default:
break;
}

break;
case SDL_JOYBUTTONDOWN:
switch(event.jbutton.button) {
case 1:
printf(1 was pressed\n);
break;
case 2:
printf(2 was pressed\n);
break;
}

break;
case SDL_JOYBUTTONUP:
switch(event.jbutton.button) {
case 1:
printf(1 was released\n);
break;
case 2:
printf(2 was released\n);
break;
}

break;
}
}
}

SDL_Quit();
return 1;
}


-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread pymike
 pymike: are you around sometime to help me debug?  Otherwise I'll need to
 pick up a joystick again (I gave away all of mine when I moved stupidly).


Yup, I can debug. :)

Here's the ubuntu bugs page for SDL... I suggest submitting a bug report
 there (if you have already, please send me the bug link?):
 https://bugs.launchpad.net/ubuntu/jaunty/+source/libsdl1.2


Done, here it is:
https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/376537

-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread René Dudfield
hi,

you can see where pygame is installed with:

 import pygame
 pygame.__file__
'/usr/local/lib/python2.6/dist-packages/pygame/__init__.pyc'
 pygame.version.ver
'1.9.0pre'


You'll probably want to remove the whole pygame directory.  Then install
again.



cheers,





On Fri, May 15, 2009 at 1:41 AM, pymike pymik...@gmail.com wrote:


 pymike, in svn there are some printf's in the joystick.c

 So if you try it with revision 2131 it should print out the results from
 what the SDL functions get back.

 compilation docs here: http://pygame.org/wiki/CompileUbuntu

 cheers,


 I checked it out and installed, but I checked versions and apparently
 pygame 1.8.1 is the current version.

  import pygame
  pygame.version.vernum
 (1, 8, 1)
 

 Running the new-feature-examples worked, so maybe the version attribute
 hasn't been updated?

 --
 - pymike



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread René Dudfield
cool thanks.

Let's see what the joystick module printf's out... then go from there.


cu,



On Fri, May 15, 2009 at 1:30 AM, pymike pymik...@gmail.com wrote:


 pymike: are you around sometime to help me debug?  Otherwise I'll need to
 pick up a joystick again (I gave away all of mine when I moved stupidly).


 Yup, I can debug. :)

 Here's the ubuntu bugs page for SDL... I suggest submitting a bug report
 there (if you have already, please send me the bug link?):
 https://bugs.launchpad.net/ubuntu/jaunty/+source/libsdl1.2


 Done, here it is:
 https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/376537

 --
 - pymike



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread pymike
On Thu, May 14, 2009 at 3:48 PM, René Dudfield ren...@gmail.com wrote:

 hi,

 you can see where pygame is installed with:

  import pygame
  pygame.__file__
 '/usr/local/lib/python2.6/dist-packages/pygame/__init__.pyc'
  pygame.version.ver
 '1.9.0pre'


 You'll probably want to remove the whole pygame directory.  Then install
 again.cheers,


 That worked, thanks.


-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread pymike
Here's the feedback:

 joy.get_numhats()
SDL_JoystickNumHats value:0:
0
 joy.get_numaxes()
6
 joy.get_numballs()
0


Anything else I should check? It reads button presses, but won't recognize
sticks or hats.

-- 
- pymike


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-05-14 Thread René Dudfield
hi,

definitely looks like a SDL/ubuntu issue...

Could be good to add some printf's into the SDL source to see where the
problem is.

Do you know how to compile custom source debs?  I'm on Jaunty... so not sure
how to make debs for intrepid.  Or do you know how to install SDL from
source?


cu,






On Fri, May 15, 2009 at 9:04 AM, pymike pymik...@gmail.com wrote:

 Here's the feedback:

  joy.get_numhats()
 SDL_JoystickNumHats value:0:
 0
  joy.get_numaxes()
 6
  joy.get_numballs()
 0
 

 Anything else I should check? It reads button presses, but won't recognize
 sticks or hats.

 --
 - pymike



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-02-16 Thread pymike
We're getting Invalid Hat Number and some odd indexing errors in one game.
I'll post the exact errors here in a bit. Basically, it's just not reading
the hats or axes. I've tried both gamepads and joysticks, and get the same
errors.

Cheers,

On Sun, Feb 15, 2009 at 11:33 PM, René Dudfield ren...@gmail.com wrote:

 hi again,

 Just a note for help in debugging, that pygame joystick support didn't
 change between pygame 1.8.0 and 1.8.1.  However there were a few small
 changes between 1.7.1 and 1.8.0.



 On Mon, Feb 16, 2009 at 4:31 PM, René Dudfield ren...@gmail.com wrote:
  hi,
 
  thanks for the report.
 
  I think ubuntu/linux might have changed their joystick support
  somehow.  I read as much not long ago, but haven't looked into it yet.
 
 
  What are the errors?  Are they segfaults, or are exceptions raised?
  Or something else?
 
 
 
  cheers.
 
 
 
 
 
  On Sun, Feb 15, 2009 at 5:30 AM, pymike pymik...@gmail.com wrote:
  Hi all,
 
  Me and my friend are having trouble with joysticks in pygame 1.8.1.
 We're
  both running Ubuntu 8.10 (on different machines in different countries)
 
  Basically, joysticks are initializing fine. joystick.get_button() also
 is
  working. However, when printing joystick.get_numhats() and
  joystick.get_numaxes(), we're getting a zero. Obviously, executing
  joystick.get_hat(0) and joystick.get_axis(0) gives us errors. We've also
  tried running some pygames that use joysticks, and they crash due to
  hat/ball errors.
 
  However, I've tried some other SDL games that use joysticks, and they
 all
  work perfectly. Help?
 
  Thanks,
 
  --
  - pymike
  Python eggs me on.
 
 




-- 
- pymike
Python eggs me on.


Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-02-15 Thread René Dudfield
hi,

thanks for the report.

I think ubuntu/linux might have changed their joystick support
somehow.  I read as much not long ago, but haven't looked into it yet.


What are the errors?  Are they segfaults, or are exceptions raised?
Or something else?



cheers.





On Sun, Feb 15, 2009 at 5:30 AM, pymike pymik...@gmail.com wrote:
 Hi all,

 Me and my friend are having trouble with joysticks in pygame 1.8.1. We're
 both running Ubuntu 8.10 (on different machines in different countries)

 Basically, joysticks are initializing fine. joystick.get_button() also is
 working. However, when printing joystick.get_numhats() and
 joystick.get_numaxes(), we're getting a zero. Obviously, executing
 joystick.get_hat(0) and joystick.get_axis(0) gives us errors. We've also
 tried running some pygames that use joysticks, and they crash due to
 hat/ball errors.

 However, I've tried some other SDL games that use joysticks, and they all
 work perfectly. Help?

 Thanks,

 --
 - pymike
 Python eggs me on.



Re: [pygame] pygame.Joystick Broken in 1.8.1?

2009-02-15 Thread René Dudfield
hi again,

Just a note for help in debugging, that pygame joystick support didn't
change between pygame 1.8.0 and 1.8.1.  However there were a few small
changes between 1.7.1 and 1.8.0.



On Mon, Feb 16, 2009 at 4:31 PM, René Dudfield ren...@gmail.com wrote:
 hi,

 thanks for the report.

 I think ubuntu/linux might have changed their joystick support
 somehow.  I read as much not long ago, but haven't looked into it yet.


 What are the errors?  Are they segfaults, or are exceptions raised?
 Or something else?



 cheers.





 On Sun, Feb 15, 2009 at 5:30 AM, pymike pymik...@gmail.com wrote:
 Hi all,

 Me and my friend are having trouble with joysticks in pygame 1.8.1. We're
 both running Ubuntu 8.10 (on different machines in different countries)

 Basically, joysticks are initializing fine. joystick.get_button() also is
 working. However, when printing joystick.get_numhats() and
 joystick.get_numaxes(), we're getting a zero. Obviously, executing
 joystick.get_hat(0) and joystick.get_axis(0) gives us errors. We've also
 tried running some pygames that use joysticks, and they crash due to
 hat/ball errors.

 However, I've tried some other SDL games that use joysticks, and they all
 work perfectly. Help?

 Thanks,

 --
 - pymike
 Python eggs me on.




[pygame] pygame.Joystick Broken in 1.8.1?

2009-02-14 Thread pymike
Hi all,

Me and my friend are having trouble with joysticks in pygame 1.8.1. We're
both running Ubuntu 8.10 (on different machines in different countries)

Basically, joysticks are initializing fine. joystick.get_button() also is
working. However, when printing joystick.get_numhats() and
joystick.get_numaxes(), we're getting a zero. Obviously, executing
joystick.get_hat(0) and joystick.get_axis(0) gives us errors. We've also
tried running some pygames that use joysticks, and they crash due to
hat/ball errors.

However, I've tried some other SDL games that use joysticks, and they all
work perfectly. Help?

Thanks,

-- 
- pymike
Python eggs me on.