Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 222393 - media-sound/alsa-utils-1.0.16-r2: too fast for snd-usb-audio
Summary: media-sound/alsa-utils-1.0.16-r2: too fast for snd-usb-audio
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo ALSA team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-16 13:06 UTC by John Feuerstein
Modified: 2009-10-12 17:23 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Alsa RC config (alsasound,1.03 KB, text/plain)
2008-05-16 13:07 UTC, John Feuerstein
Details
The snd-card-0 alias (alsa,1.02 KB, text/plain)
2008-05-16 13:08 UTC, John Feuerstein
Details
Alsa portion of RC-Log (rc.log,1.20 KB, text/plain)
2008-05-16 13:10 UTC, John Feuerstein
Details
The QND approach to fix it.. (sleep_on_snd_usb_audio.patch,544 bytes, patch)
2008-05-16 13:15 UTC, John Feuerstein
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Feuerstein 2008-05-16 13:06:15 UTC
On boot, /etc/init.d/alsasound loads the necessary alsa modules and if
RESTORE_ON_START is set, it runs restore() to restore previous mixer levels.

I've noticed the following problems on two different machines, both using external USB sound cards:

- load_modules() successfully loads all necessary modules,
  however, /proc/asound is not ready directly after the modprobe, which yields
  eerror "ERROR: Failed to load necessary drivers"
- restore() tries to parse /proc/asound/cards which is not ready yet,
  resulting in a wrong command line for 
  alsactl -f "${alsastatedir}/asound.state" restore ${cardnum}, thus
  || ewarn "Errors while restoring defaults, ignoring".

Please have a look at the attached rc.log for the errors.

Since USB devices can take some time to initialize, the solution seems rather simple:

Instead of:
  ebegin "Loading: ${DRIVER}"
  modprobe ${DRIVER}
  eend $?

We would need something like:
  ebegin "Loading: ${DRIVER}"
    modprobe ${DRIVER} ; local E=$?
    if ! (( E )) ; then
      if modprobe -c | grep -q "^alias ${DRIVER} snd-usb-audio$" ; then
        # Wait for slow USB audio devices to initialize
        sleep 1
      fi
    fi
  eend $E

This actually works fine for both of my machines. I'll attach a diff.

Thanks.

Reproducible: Always
Comment 1 John Feuerstein 2008-05-16 13:07:38 UTC
Created attachment 153325 [details]
Alsa RC config
Comment 2 John Feuerstein 2008-05-16 13:08:39 UTC
Created attachment 153327 [details]
The snd-card-0 alias
Comment 3 John Feuerstein 2008-05-16 13:10:20 UTC
Created attachment 153329 [details]
Alsa portion of RC-Log
Comment 4 John Feuerstein 2008-05-16 13:15:29 UTC
Created attachment 153331 [details, diff]
The QND approach to fix it..
Comment 5 Steve Dibb (RETIRED) gentoo-dev 2009-08-13 17:06:22 UTC
USB latency is the worst, however, I would rather put a SLEEP_SECONDS var in alsasound conf.d rather than insert the possiblity of it sleeping forever.

Assuming this is still an issue with newer kernel / ALSA, lemme know.
Comment 6 John Feuerstein 2009-10-12 17:23:06 UTC
Fixed with linux-2.6.31-gentoo-r1. Thanks.