Linux Udev and ALSA Implementation

Once SDL has found a udev sound device, e.g. udev_device_get_subsystem(device) == "sound" how does it obtain the appropriate information from this device to be used for parameters in the ALSA call snd_pcm_open()?

Specifically, given a udev sound device:

  1. Where is the code/How do you: inspect the device’s capabilities, e.g. can it be used for playback, recording? For example, to determine if a joystick device is a game controller, I see it inspects the BTN_GAMEPAD bit in capabilities/key of the device.
  2. Where is the code/How do you: obtain the relevant data from the device and generate parameters for snd_pcm_open()?