We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1099

Summary: SDL_INIT_JOYSTICK hangs on MacOS X 10.4.11
Product: SDL Reporter: Vern Jensen <vern>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: PowerPC   
OS: Mac OS X 10.4 (PPC)   

Description Vern Jensen 2011-01-21 12:28:44 UTC
The call:

SDL_InitSubSystem(SDL_INIT_JOYSTICK);

works just fine on MacOS X 10.6.6 on my Intel Mac, but it causes my program to freeze (permanent spinning beach ball) on my PPC 1.4 GHz iBook G4 running MacOS X 10.4.11. Worse, using "force quit" does  *not* cause the program to quit, and if you try to force quit a second time, it causes the entire computer to freeze up with the "Mac screen of death" ("You need to restart your computer. Hold down the Power button for several seconds or press the Restart button.")

I am quite impressed with how easy it was to add gamepad support to my program (only took a few hours!), but unfortunately I can't enable it in the shipping version until this is fixed.
Comment 1 Sam Lantinga 2011-02-20 20:11:01 UTC
I just tried this on my iMac running Mac OS X 10.4.11 with no joysticks attached, with no problems, and then with a USB gamepad and no problems.  I even ran testjoystick with the UI option and played around with the buttons and so forth and everything worked fine.

Does it happen for you with the latest snapshot?  Does it happen both with no joysticks attached and a joystick attached?  What device are you using?

Thanks!
Comment 2 Vern Jensen 2011-02-22 12:49:16 UTC
It's quite possible it's a PPC versus Intel problem then. It freezes with no attached USB devices at all. I haven't tried it yet with a joystick attached. 

I'll test the latest snapshot on my laptop soon.
Comment 3 Vern Jensen 2011-02-23 14:59:11 UTC
Just re-tested on the laptop with latest snapshot (SDL 1.3.0-5390). Yes, it's still hanging. On:

SDL_InitSubSystem(SDL_INIT_JOYSTICK);

I know this because I have printf() outputs both immediately before and after this call, and can see in the Console log the one right before. 

Remember, this is a hang, not a crash. So it's possible it's eternally looping somehow.

Also, when I try to force the program to quit, it doesn't work. If I try to force it to quit a second time, I get the Mac Screen of Death and must manually power off and on again.

Sam -- is your iMac PPC or Intel? Mine is PPC. Do  you have a PPC running 10.4.11 you can test on?
Comment 4 Sam Lantinga 2011-02-23 15:14:28 UTC
Yep, my machine is a PPC iMac running 10.4.11.
Comment 5 Vern Jensen 2011-02-23 18:00:42 UTC
Hmm, odd that you're not seeing the problem then. Is there anything else I can do to help from my end?

Note: I don't have an XCode environment set up on the iMac. Well actually I do, but I'm guessing it's too old to compile the current SDL project. I just compile on my desktop Mac, and transfer the build results.
Comment 6 Sam Lantinga 2011-02-24 08:01:26 UTC
Oh, that's interesting.  I've been building on the 10.4 Mac with the UNIX style:
./configure; make; make install
cd test
./configure; make; ./testjoystick

Does it work if you use that method?
Comment 7 Vern Jensen 2011-03-11 12:38:17 UTC
Hi Sam, I might need a little help with the UNIX build of SDL, to do the test you asked.

When I do

./configure; make; make install

it seems to work... it just says:

mkdir -p -- /usr/local/bin
mkdir: /usr/local: Permission denied

so I did a "sudo make install" instead. This succeeded, with "Libraries have been installed in: /usr/local/lib."

But when I do

cd test

and

./configure; make; /.testjoystick

I get:

*** The sdl-config script installed by SDL could not be found
*** If SDL was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the SDL_CONFIG environment variable to the
*** full path to sdl-config.
configure: error: *** SDL version 1.3.0 not found!

I simply put the SDL-1.3.0-5466 folder in my home directory. I'm not sure how to modify my paths, and I don't know what it means to have SDL installed in PREFIX. But if you give me directions, I can follow them and continue testing. Sorry to bug you about this... afraid my UNIX skills aren't the most advanced.
Comment 8 Sam Lantinga 2011-03-11 14:18:46 UTC
Please make sure that /usr/local/bin is in your PATH when building on the command line.
Comment 9 Vern Jensen 2011-03-16 11:26:08 UTC
Hi Sam,

Okay, that worked. I configured and built under UNIX the very latest version -- 1.3.0-5497 -- and yes, it has the same problem. The testjoystick, even when run under UNIX, hangs. (It's like an infinite loop or something... permanent spinning beach ball.) I can still switch to other apps and use them, but when I force quit, it won't quit. And because of that I can't even restrart the Mac. Forcing quit a second and third time had no effect... the app still runs, and the computer won't restart, with "Terminal" trying to quit but unable to.

Any further tests I can run for you? I didn't see any output related to this in the Console log.
Comment 10 Vern Jensen 2011-03-16 11:27:00 UTC
Just to clarify, what I meant by "built under UNIX" was I used the command line in OS X 10.6.6.
Comment 11 Vern Jensen 2011-03-16 11:28:02 UTC
Ugh. I mean 10.4. Whatever the latest version of 10.4 is.
Comment 12 Vern Jensen 2011-03-16 11:31:18 UTC
Oh, and just for the heck of it (after powering the system off and on again) I tried running ./testsprite2 from the command line. It worked just fine. So everything built properly. So this is indeed a joystick problem.

OS X 10.4.11
1.2 GHz PowerPC G4
512 MB SDRAM
Comment 13 Sam Lantinga 2012-01-08 00:07:59 UTC
Unfortunately I don't have a Mac running 10.4 anymore.  You're welcome to reopen this if you find a fix, but I can't help here.