What happens if you change the snd_pcm_open line to tweak the 3rd parameter from 0 to SND_PCM_NONBLOCK?
With that flag set it does get past that point, however it ends up not detecting any devices.
Hmm. I'm guessing that this is similar to Wine's behavior before your change to default? If so, could you try the attached patch? It now tries default:X and falls back to plughw:X if default is not available.
Cheers,
Jeremy