Listing up to 8 PCM devices
Hi,
I'm currently writting a driver with up to 8 pcm devices, so I turned on "Dynamic device file minor numbers" option. But when I try to list devices through aplay or a record (which are calling ioctl with cmd SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE) I can only list devices from 0 to 7. This is due to this code :
linux/sound/core/pcm.c l.64
------------------------------
case SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE:
{
int device;
if (get_user(device, (int __user *)arg))
return -EFAULT;
mutex_lock(®ister_mutex);
device = device < 0 ? 0 : device + 1;
while (device < SNDRV_PCM_DEVICES) {
if (snd_pcm_search(card, device))
break;
device++;
}
if (device == SNDRV_PCM_DEVICES)
device = -1;
mutex_unlock(®ister_mutex);
if (put_user(device, (int __user *)arg))
return -EFAULT;
return 0;
}------------------------------
because SNDRV_PCM_DEVICES is defined to 8 and do not change even if I selected "Dynamic device file minor numbers" option.
Is there anything I missed ?
At Wed, 19 Nov 2008 08:19:21 +0000 (UTC),
Quoted 31 lines · Gregoire ETIENNE
Hi,
I'm currently writting a driver with up to 8 pcm devices, so I turned on "Dynamic device file minor numbers" option. But when I try to list devices through aplay or a record (which are calling ioctl with cmd
SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE) I can only list devices from 0 to 7. This is due to this code :
linux/sound/core/pcm.cl.64
------------------------------case SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE: { int device; if (get_user(device, (int __user *)arg)) return -EFAULT; mutex_lock(®ister_mutex); device = device < 0 ? 0 : device + 1; while (device < SNDRV_PCM_DEVICES) { if (snd_pcm_search(card, device)) break; device++; } if (device == SNDRV_PCM_DEVICES) device = -1; mutex_unlock(®ister_mutex); if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; }
Quoted 5 lines
------------------------------
becauseSNDRV_PCM_DEVICESis defined to 8 and do not change even if I selected "Dynamic device file minor numbers" option.Is there anything I missed ?
The definition of SNDRV_PCM_DEVICES was changed depending on CONFIG_SND_DYNAMIC_MINORS in the recent version.
I guess you are referring to an old version.
Takashi