: Control devices created before driver ready for devices to be opened
A NOTE has been added to this issue.
======================================================================
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=742>
======================================================================
Reported By: jdthood
Assigned To:
======================================================================
Project: ALSA - driver Issue ID: 742 Category: CORE - control Reproducibility: random Severity: minor Priority: normal Status: new Distribution: Kernel Version: ====================================================================== Date Submitted: 12-22-2004 16:24 CET Last Modified: 12-23-2004 12:48 CET
======================================================================
Summary: Control devices created before driver ready for
devices to be opened
Description:
"alsactl restore" is run by a dev script, which is run by udev, which is run by hotplug, which is run by the kernel when /dev/snd/controlC0 is created. Multiple users are reporting that this fails. However, "alsactl restore" does not fail when run from the command line. It helps to add a "sleep" to the dev script. This leads one to the conclusion that there is a race condition: the driver is creating the device file before it is ready for the file to be opened.
In Debian bug report
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=279325 the submitter reports this behavior:
Quoted 1 line
/usr/sbin/alsactl: set_controls:986:snd_ctl_openerror: No such
device
Quoted 9 lines
This is the code which fails, from
set_controls()inalsa-utils-1.0.7/alsactl/alsactl.c:sprintf(name, "hw:%d", card); err = snd_ctl_open(&handle, name, 0); if (err < 0) { error("snd_ctl_open error: %s", snd_strerror(err)); return err; }
I get messages like this in my syslog:
Quoted 2 lines
Dec 22 15:05:09 thanatos kernel:ALSA
/usr/src/modules/alsa-driver/alsa-kernel/p
ci/cs46xx/cs46xx_lib.c:413:
Quoted 1 line
cs46xx: failure waiting for FIFO command to complete
Signature · 16 lines
Thomas Hood ====================================================================== ---------------------------------------------------------------------- tiwai - 12-23-04 12:47 ---------------------------------------------------------------------- Well, my test is still not clear. Let me rephrase. udev is started via hotplug, when class_simple_add_device() is called in the driver at the modprobe time. And this call is asynchronous. The function (kobject hotplug) doesn't wait for the finish of hotplug. Thus, the control gets back to alsasound before udev (hotplug) finishes its job. ---------------------------------------------------------------------- jdthood - 12-23-04 12:48 ----------------------------------------------------------------------
Quoted 4 lines
Yes, of course, udev is started from hotplug (what else? :) I meant udev is indepent from modprobe (i.e. the alsasound init script which calls modprobe), invoked asynchornously. modprobe returns before hotplug finishes.
We are running "alsactl restore" in a dev.d script; this gets run by the kernel when ALSA registers the control device. The exact stack is:
kernel
/sbin/hotplug /etc/hotplug.d/default/10-udev.hotplug -> /sbin/udevsend udevd /etc/dev.d/snd/snd/controlC0/alsa-base.dev ->/etc/alsa/dev.d/alsa-base.dev
alsactl restore
Issue History
Date Modified Username Field Change
======================================================================
12-22-04 16:24 jdthood New Issue 12-22-04 16:59 tiwai Note Added: 0002909 12-22-04 17:00 tiwai File Added: control-device-fix.diff
12-23-04 10:42 jdthood Note Added: 0002911 12-23-04 12:05 tiwai Note Added: 0002912 12-23-04 12:25 jdthood Note Added: 0002913 12-23-04 12:35 tiwai Note Added: 0002914 12-23-04 12:47 tiwai Note Added: 0002915 12-23-04 12:48 jdthood Note Added: 0002916
======================================================================
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/