Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 2024 14:17:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        usb@FreeBSD.org
Subject:   [Bug 272286] When unplugging USB sound card, usbconfig stops working
Message-ID:  <bug-272286-19105-kcWbfvBIKm@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-272286-19105@https.bugs.freebsd.org/bugzilla/>
References:  <bug-272286-19105@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272286

--- Comment #3 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=3D9eff58c6d52b66eb8abe7f724dabcd804=
a566df4

commit 9eff58c6d52b66eb8abe7f724dabcd804a566df4
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-03-31 14:13:43 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-03-31 14:13:43 +0000

    sound: Implement asynchronous device detach

    Hot-unplugging a sound device, such as a USB sound card, whilst being
    consumed by an application, results in an infinite loop until either the
    application closes the device's file descriptor, or the channel
    automatically times out after hw.snd.timeout seconds. In the case of a
    detach however, the timeout approach is still not ideal, since we want
    all resources to be released immediatelly, without waiting for N seconds
    until we can use the bus again.

    The timeout mechanism works by calling chn_sleep() in chn_read() and
    chn_write() (see pcm/channel.c) in order to send the thread to sleep,
    using cv_timedwait_sig(). Since chn_sleep() sets the CHN_F_SLEEPING flag
    while waiting for cv_timedwait_sig() to return, we can test this flag in
    pcm_unregister() (called during detach) and wakeup the sleeping
    thread(s) to immediately kill the channel(s) being consumed.

    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 months
    PR:             194727, 278055, 202275, 220949, 272286
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D43545

 share/man/man4/snd_uaudio.4 | 11 +----------
 sys/dev/sound/pcm/dsp.c     |  2 +-
 sys/dev/sound/pcm/mixer.c   | 11 -----------
 sys/dev/sound/pcm/sound.c   | 24 ++++++++++--------------
 sys/dev/sound/usb/uaudio.c  | 13 +++----------
 5 files changed, 15 insertions(+), 46 deletions(-)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272286-19105-kcWbfvBIKm>