From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9749C432BE for ; Fri, 13 Aug 2021 16:29:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A53BB610EA for ; Fri, 13 Aug 2021 16:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235761AbhHMQaN (ORCPT ); Fri, 13 Aug 2021 12:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbhHMQaK (ORCPT ); Fri, 13 Aug 2021 12:30:10 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93EF8C061756; Fri, 13 Aug 2021 09:29:43 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id n7so16506940ljq.0; Fri, 13 Aug 2021 09:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=Oquwslrv0iZO0iE4+rg2oqrPU9W7lCXWmZo8U1byMsIeJqu7KOK/WmqadDlVomPZ3Z NUvTbj8Mlso65qDPO523wiGbXwH/sTgFXJuqIb5kplbAz3s69wJ+TaHPXpZIjy9OiSvF 8lcu89HaYJwEEO75RNV4jgueP7YS/2YdnToXR2fgEUuVQKWBgAqS8E7vYjsgRXXi0lla Bj5frT1giO08YsBWMmdsCsdRHBZgSvZeoMmKFckysmdWn6nIySXuIGQo7/RN/Kt++rFJ BG8GLADvjfgqW0wrFovbCeq4if/pFdveRNZYNlMnOYhaLvKnad1eSvf91x87zaweD6Gn RLpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=pjgFUuLH2vwcqKfIXPZrsqulEX2FuhkUQoIR4IRcYsem8ISInBDzTP9QkJ0CEnO/dw KPQ2Itj93i7G5pUWRLEnnjY01F9j1BHsO6rtspGqTbXyc56NAXjwhwcXfAXTP9aRw67s qbZfXjs9wJP2zN6W1arjQOPenqDtXe8DZ/iy4qv231ufQfnLyJjumsq8Kl7BXnQFFzdk g7EW45jI3W7Mtl29NEnoy1iVH8zx7yLyEKbHH1KM/QHlddkHURL4gYGGF2zsgio/9YHl JuACD3bLvKg/XE7WZa4ib1uj6ssR8k5N+eEvklsAzOFvjdnJBLgOC38Z36WDXyau7HhC 5NMA== X-Gm-Message-State: AOAM5336oHowoR0mAsBx/3kdMChYMBkQRtE3KokHK3CxiEPbvWjk02Z3 4ao/mMwq3Zx/oulbka9+WQkH02ubV8i5s/ZU/jc= X-Google-Smtp-Source: ABdhPJw7IU0i3kJszwAd/r6LZDHpmqyuenklMvUuyjDAEcVXEQ5w6NynYbqNk6S0sprJyfm2fRUjHi3oxxQANr8xgoc= X-Received: by 2002:a2e:3607:: with SMTP id d7mr2452450lja.481.1628872181924; Fri, 13 Aug 2021 09:29:41 -0700 (PDT) MIME-Version: 1.0 References: <41bebccc-7940-8379-0108-047bd1cc92f9@perex.cz> In-Reply-To: From: Muni Sekhar Date: Fri, 13 Aug 2021 21:59:30 +0530 Message-ID: Subject: Re: USB-Audio: Device or resource busy (strace log) To: vishnu Cc: Jaroslav Kysela , alsa-devel , linux-usb@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, kernelnewbies Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 11, 2021 at 6:48 PM Muni Sekhar wrote: > > On Wed, Aug 11, 2021 at 6:19 PM vishnu wrote: > > > > can you paste output of > > arecord -l (list of capture devices). > $ arecord -l > **** List of CAPTURE Hardware Devices **** > card 0: USB [Plantronics .Audio 628 USB], device 0: USB Audio [USB Audio] > Subdevices: 1/1 > Subdevice #0: subdevice #0 > > > > Which device you are using and os. > > Does this instance is already open by default? like any video playing or something like that? > lsof does not catch it. > > > > > Yes you can stop pulse audio and try.. > > > > On Wed, Aug 11, 2021 at 6:17 PM Jaroslav Kysela wrote: > >> > >> On 11. 08. 21 14:36, Muni Sekhar wrote: > >> > Hi All, > >> > > >> > $ cat /proc/asound/cards > >> > 0 [USB ]: USB-Audio - Plantronics .Audio 628 USB > >> > Plantronics Plantronics .Audio 628 USB at > >> > usb-0000:00:14.0-2, full speed > >> > > >> > I am using a Plantronics USB Audio headset. > >> > > >> > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > >> > arecord: main:722: audio open error: Device or resource busy > >> > > >> > > >> > 'arecord' command always fails the first time after system boot in my > >> > system. But subsequent execution of the 'arecord' command runs fine. > >> > > >> > > >> > I've attached the strace log for the "audio open error: Device or > >> > resource busy" failure. Is there any fix available for this issue? > >> > >> You may check which other task blocks the PCM device: > >> > >> lsof /dev/snd/pcmC0D0c > It does not output any process. > $ lsof /dev/snd/pcmC0D0c > > 1st run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > arecord: main:722: audio open error: Device or resource busy > > 2nd run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo > ^CAborted by signal Interrupt... > > > >> > >> I guess that it will be pulseaudio (device enumeration). I see that pulseaudio is getting loaded on invoking the 1st run of 'arecord' command. Here is the log: After system boot I verified that pulseaudio is not in the memory. test@test594:~$ uptime 21:39:27 up 0 min, 1 user, load average: 0.70, 0.25, 0.09 test@test594:~$ ls -ltr /dev/snd/controlC1 crw-rw---- 1 root audio 116, 2 Aug 13 21:38 /dev/snd/controlC1 test@test594:~$ ls -ltr /dev/snd/ total 0 crw-rw---- 1 root audio 116, 33 Aug 13 21:38 timer crw-rw---- 1 root audio 116, 1 Aug 13 21:38 seq crw-rw---- 1 root audio 116, 3 Aug 13 21:38 pcmC1D0p crw-rw---- 1 root audio 116, 4 Aug 13 21:38 pcmC1D0c crw-rw---- 1 root audio 116, 2 Aug 13 21:38 controlC1 drwxr-xr-x 2 root root 60 Aug 13 21:38 by-path drwxr-xr-x 2 root root 60 Aug 13 21:38 by-id test@test594:~$ lsof /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0c test@test594:~$ 1st run of 'arecord': ------------------------- I triggered 'arecord' after 2 mins of the system boot. In the 1st run, it failed with "Device or resource busy" and I see that pulseaudio loaded in the memory. Why does pulseaudio get triggered on running the alsa-utils command? How is the failure message "Device or resource busy" from the kernel code? test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav arecord: main:722: audio open error: Device or resource busy test@test594:~$ test@test594:~$ lsof /dev/snd/pcmC1D0c COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test mem CHR 116,4 463 /dev/snd/pcmC1D0c pulseaudi 1550 test 27u CHR 116,4 0t0 463 /dev/snd/pcmC1D0c test@test594:~$ lsof /dev/snd/controlC1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test 20u CHR 116,2 0t0 461 /dev/snd/controlC1 pulseaudi 1550 test 26u CHR 116,2 0t0 461 /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0p test@test594:~$ test@test594:~$ uptime 21:41:06 up 2 min, 1 user, load average: 0.20, 0.19, 0.08 2nd run of 'arecord': ------------------------- The subsequent run of arecord runs fine without any issues even though pulseaudio is still in memory. test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ^CAborted by signal Interrupt... test@test594:~$ uptime 21:41:22 up 2 min, 1 user, load average: 0.14, 0.18, 0.08 test@test594:~$ What is the role of pulseaudio? Is there a way to disable it from running it? Disabling pulseaudio causes any issues while testing audio drivers? > >> > >> Jaroslav > >> > >> -- > >> Jaroslav Kysela > >> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. > > > > -- > Thanks, > Sekhar -- Thanks, Sekhar From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 572BCC4338F for ; Fri, 13 Aug 2021 16:31:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 882AC6103A for ; Fri, 13 Aug 2021 16:31:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 882AC6103A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2EC131845; Fri, 13 Aug 2021 18:30:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2EC131845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1628872263; bh=1mZiTEvvyEZOq8d6CZbFmNJ7wuQd8bICUyH00oJGrkI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ry5W71V18d04sEAKbtECDOsRmG21ZmRSB2Zsn8KMW4Kx/4EmzM6jRWgSUKrrLV0iK eBMgU/c+3zW6OqpzlXVvLaFB7b+eRNYZS/u9Mf4neQKymwN0TJ7JuLyVk/BrKKu0nG sEZcG+sR8V0g+M4Om9HUCxokyENaW/Ob4o1xNEMU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E8F17F8020D; Fri, 13 Aug 2021 18:30:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 480A6F802D2; Fri, 13 Aug 2021 18:29:57 +0200 (CEST) Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B855EF800E5 for ; Fri, 13 Aug 2021 18:29:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B855EF800E5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oquwslrv" Received: by mail-lj1-x233.google.com with SMTP id y7so16446340ljp.3 for ; Fri, 13 Aug 2021 09:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=Oquwslrv0iZO0iE4+rg2oqrPU9W7lCXWmZo8U1byMsIeJqu7KOK/WmqadDlVomPZ3Z NUvTbj8Mlso65qDPO523wiGbXwH/sTgFXJuqIb5kplbAz3s69wJ+TaHPXpZIjy9OiSvF 8lcu89HaYJwEEO75RNV4jgueP7YS/2YdnToXR2fgEUuVQKWBgAqS8E7vYjsgRXXi0lla Bj5frT1giO08YsBWMmdsCsdRHBZgSvZeoMmKFckysmdWn6nIySXuIGQo7/RN/Kt++rFJ BG8GLADvjfgqW0wrFovbCeq4if/pFdveRNZYNlMnOYhaLvKnad1eSvf91x87zaweD6Gn RLpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=KalwLOgySVamTlzx1mlysFx/6SKl23iD5mWyT7gflXD02NiEL/v/jsRm7iiBzLKrW6 R8XSmu9kZBOw0EEeZuUJKuttNy4tmbL3aBapospJRou3PEtr8Hr07Wx4thsciJJBGn63 17Fy/HhZRvd2pTfqJk64siIHfH9qvxPIfahxfTupHZoIXCBCLyInGa93fh+pVP0KzyGQ QcJLLhPyIk/nknkigCPLH+72OaFJDXrtkeQgZ9TYD97CeFS6iW+iGOLph9vFpgTZWfdx YSRs8m4qVOF4Epyp0aRmY4ra0X7YzLDrD6vHhcNku/vBYgrwcPefmLvAmS5rtl8X5DZz iyxQ== X-Gm-Message-State: AOAM531+erwytmsHgrmqRY3UwHfMPIU+COoKqJToLsyjcvqLKRneoNMd upLSYuwgp70ZGnv1EidM0XxneTdR+d1yYUThQp4= X-Google-Smtp-Source: ABdhPJw7IU0i3kJszwAd/r6LZDHpmqyuenklMvUuyjDAEcVXEQ5w6NynYbqNk6S0sprJyfm2fRUjHi3oxxQANr8xgoc= X-Received: by 2002:a2e:3607:: with SMTP id d7mr2452450lja.481.1628872181924; Fri, 13 Aug 2021 09:29:41 -0700 (PDT) MIME-Version: 1.0 References: <41bebccc-7940-8379-0108-047bd1cc92f9@perex.cz> In-Reply-To: From: Muni Sekhar Date: Fri, 13 Aug 2021 21:59:30 +0530 Message-ID: Subject: Re: USB-Audio: Device or resource busy (strace log) To: vishnu Content-Type: text/plain; charset="UTF-8" Cc: alsa-devel , kernelnewbies , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, Aug 11, 2021 at 6:48 PM Muni Sekhar wrote: > > On Wed, Aug 11, 2021 at 6:19 PM vishnu wrote: > > > > can you paste output of > > arecord -l (list of capture devices). > $ arecord -l > **** List of CAPTURE Hardware Devices **** > card 0: USB [Plantronics .Audio 628 USB], device 0: USB Audio [USB Audio] > Subdevices: 1/1 > Subdevice #0: subdevice #0 > > > > Which device you are using and os. > > Does this instance is already open by default? like any video playing or something like that? > lsof does not catch it. > > > > > Yes you can stop pulse audio and try.. > > > > On Wed, Aug 11, 2021 at 6:17 PM Jaroslav Kysela wrote: > >> > >> On 11. 08. 21 14:36, Muni Sekhar wrote: > >> > Hi All, > >> > > >> > $ cat /proc/asound/cards > >> > 0 [USB ]: USB-Audio - Plantronics .Audio 628 USB > >> > Plantronics Plantronics .Audio 628 USB at > >> > usb-0000:00:14.0-2, full speed > >> > > >> > I am using a Plantronics USB Audio headset. > >> > > >> > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > >> > arecord: main:722: audio open error: Device or resource busy > >> > > >> > > >> > 'arecord' command always fails the first time after system boot in my > >> > system. But subsequent execution of the 'arecord' command runs fine. > >> > > >> > > >> > I've attached the strace log for the "audio open error: Device or > >> > resource busy" failure. Is there any fix available for this issue? > >> > >> You may check which other task blocks the PCM device: > >> > >> lsof /dev/snd/pcmC0D0c > It does not output any process. > $ lsof /dev/snd/pcmC0D0c > > 1st run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > arecord: main:722: audio open error: Device or resource busy > > 2nd run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo > ^CAborted by signal Interrupt... > > > >> > >> I guess that it will be pulseaudio (device enumeration). I see that pulseaudio is getting loaded on invoking the 1st run of 'arecord' command. Here is the log: After system boot I verified that pulseaudio is not in the memory. test@test594:~$ uptime 21:39:27 up 0 min, 1 user, load average: 0.70, 0.25, 0.09 test@test594:~$ ls -ltr /dev/snd/controlC1 crw-rw---- 1 root audio 116, 2 Aug 13 21:38 /dev/snd/controlC1 test@test594:~$ ls -ltr /dev/snd/ total 0 crw-rw---- 1 root audio 116, 33 Aug 13 21:38 timer crw-rw---- 1 root audio 116, 1 Aug 13 21:38 seq crw-rw---- 1 root audio 116, 3 Aug 13 21:38 pcmC1D0p crw-rw---- 1 root audio 116, 4 Aug 13 21:38 pcmC1D0c crw-rw---- 1 root audio 116, 2 Aug 13 21:38 controlC1 drwxr-xr-x 2 root root 60 Aug 13 21:38 by-path drwxr-xr-x 2 root root 60 Aug 13 21:38 by-id test@test594:~$ lsof /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0c test@test594:~$ 1st run of 'arecord': ------------------------- I triggered 'arecord' after 2 mins of the system boot. In the 1st run, it failed with "Device or resource busy" and I see that pulseaudio loaded in the memory. Why does pulseaudio get triggered on running the alsa-utils command? How is the failure message "Device or resource busy" from the kernel code? test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav arecord: main:722: audio open error: Device or resource busy test@test594:~$ test@test594:~$ lsof /dev/snd/pcmC1D0c COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test mem CHR 116,4 463 /dev/snd/pcmC1D0c pulseaudi 1550 test 27u CHR 116,4 0t0 463 /dev/snd/pcmC1D0c test@test594:~$ lsof /dev/snd/controlC1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test 20u CHR 116,2 0t0 461 /dev/snd/controlC1 pulseaudi 1550 test 26u CHR 116,2 0t0 461 /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0p test@test594:~$ test@test594:~$ uptime 21:41:06 up 2 min, 1 user, load average: 0.20, 0.19, 0.08 2nd run of 'arecord': ------------------------- The subsequent run of arecord runs fine without any issues even though pulseaudio is still in memory. test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ^CAborted by signal Interrupt... test@test594:~$ uptime 21:41:22 up 2 min, 1 user, load average: 0.14, 0.18, 0.08 test@test594:~$ What is the role of pulseaudio? Is there a way to disable it from running it? Disabling pulseaudio causes any issues while testing audio drivers? > >> > >> Jaroslav > >> > >> -- > >> Jaroslav Kysela > >> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. > > > > -- > Thanks, > Sekhar -- Thanks, Sekhar From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AACF4C4338F for ; Fri, 13 Aug 2021 16:30:16 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17B1D60EB2 for ; Fri, 13 Aug 2021 16:30:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 17B1D60EB2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mEa42-00044e-PV; Fri, 13 Aug 2021 12:29:46 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1mEa40-00043w-Px for kernelnewbies@kernelnewbies.org; Fri, 13 Aug 2021 12:29:44 -0400 Received: by mail-lj1-x230.google.com with SMTP id m17so12653503ljp.7 for ; Fri, 13 Aug 2021 09:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=Oquwslrv0iZO0iE4+rg2oqrPU9W7lCXWmZo8U1byMsIeJqu7KOK/WmqadDlVomPZ3Z NUvTbj8Mlso65qDPO523wiGbXwH/sTgFXJuqIb5kplbAz3s69wJ+TaHPXpZIjy9OiSvF 8lcu89HaYJwEEO75RNV4jgueP7YS/2YdnToXR2fgEUuVQKWBgAqS8E7vYjsgRXXi0lla Bj5frT1giO08YsBWMmdsCsdRHBZgSvZeoMmKFckysmdWn6nIySXuIGQo7/RN/Kt++rFJ BG8GLADvjfgqW0wrFovbCeq4if/pFdveRNZYNlMnOYhaLvKnad1eSvf91x87zaweD6Gn RLpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lSjANMOkeDV/0UvMiD3d/wgPXF81D4gziwyjM+awd5c=; b=C1hvzeVE2jkPG8JzIm2K8IJ57Mzu2vt/FOi3jDTCuVdkWEa8J0bpAK3nkedFxkZwx/ 1Tw1zpNwgNjc7QTxmXb443ctdH+nG/k6aeDiLDZNoq6Gbwi59zj8HGnmLcEywek7Fdd2 MDHNI10E0A97UI3XEj5/9QshsswVmO5QN2/u6dYUnhZGYGLuGi9fAKRjC+VbgBuX3kqX jHOxSv1pIqOhJVofZl69jQyDJJnINLVx9e0CmPMLQwJHQagRHXxixKwvckG72bbR0T7Y gYenqqu8C72zn9hwjA+/y9wSf0R0NJ0eeB08mGanjJtLrO2fFU+gSicItbLXTtwi1gIg UlZg== X-Gm-Message-State: AOAM53141a8KXHOVnClurUTimJR72FFE1iVVKNYKsJoSdREVW7GIHo94 CK8KaHlnbO1tPiAIxe0EreKmayK0r3Z+1eVJbQU= X-Google-Smtp-Source: ABdhPJw7IU0i3kJszwAd/r6LZDHpmqyuenklMvUuyjDAEcVXEQ5w6NynYbqNk6S0sprJyfm2fRUjHi3oxxQANr8xgoc= X-Received: by 2002:a2e:3607:: with SMTP id d7mr2452450lja.481.1628872181924; Fri, 13 Aug 2021 09:29:41 -0700 (PDT) MIME-Version: 1.0 References: <41bebccc-7940-8379-0108-047bd1cc92f9@perex.cz> In-Reply-To: From: Muni Sekhar Date: Fri, 13 Aug 2021 21:59:30 +0530 Message-ID: Subject: Re: USB-Audio: Device or resource busy (strace log) To: vishnu Cc: alsa-devel , kernelnewbies , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, Jaroslav Kysela X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Wed, Aug 11, 2021 at 6:48 PM Muni Sekhar wrote: > > On Wed, Aug 11, 2021 at 6:19 PM vishnu wrote: > > > > can you paste output of > > arecord -l (list of capture devices). > $ arecord -l > **** List of CAPTURE Hardware Devices **** > card 0: USB [Plantronics .Audio 628 USB], device 0: USB Audio [USB Audio] > Subdevices: 1/1 > Subdevice #0: subdevice #0 > > > > Which device you are using and os. > > Does this instance is already open by default? like any video playing or something like that? > lsof does not catch it. > > > > > Yes you can stop pulse audio and try.. > > > > On Wed, Aug 11, 2021 at 6:17 PM Jaroslav Kysela wrote: > >> > >> On 11. 08. 21 14:36, Muni Sekhar wrote: > >> > Hi All, > >> > > >> > $ cat /proc/asound/cards > >> > 0 [USB ]: USB-Audio - Plantronics .Audio 628 USB > >> > Plantronics Plantronics .Audio 628 USB at > >> > usb-0000:00:14.0-2, full speed > >> > > >> > I am using a Plantronics USB Audio headset. > >> > > >> > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > >> > arecord: main:722: audio open error: Device or resource busy > >> > > >> > > >> > 'arecord' command always fails the first time after system boot in my > >> > system. But subsequent execution of the 'arecord' command runs fine. > >> > > >> > > >> > I've attached the strace log for the "audio open error: Device or > >> > resource busy" failure. Is there any fix available for this issue? > >> > >> You may check which other task blocks the PCM device: > >> > >> lsof /dev/snd/pcmC0D0c > It does not output any process. > $ lsof /dev/snd/pcmC0D0c > > 1st run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > arecord: main:722: audio open error: Device or resource busy > > 2nd run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo > ^CAborted by signal Interrupt... > > > >> > >> I guess that it will be pulseaudio (device enumeration). I see that pulseaudio is getting loaded on invoking the 1st run of 'arecord' command. Here is the log: After system boot I verified that pulseaudio is not in the memory. test@test594:~$ uptime 21:39:27 up 0 min, 1 user, load average: 0.70, 0.25, 0.09 test@test594:~$ ls -ltr /dev/snd/controlC1 crw-rw---- 1 root audio 116, 2 Aug 13 21:38 /dev/snd/controlC1 test@test594:~$ ls -ltr /dev/snd/ total 0 crw-rw---- 1 root audio 116, 33 Aug 13 21:38 timer crw-rw---- 1 root audio 116, 1 Aug 13 21:38 seq crw-rw---- 1 root audio 116, 3 Aug 13 21:38 pcmC1D0p crw-rw---- 1 root audio 116, 4 Aug 13 21:38 pcmC1D0c crw-rw---- 1 root audio 116, 2 Aug 13 21:38 controlC1 drwxr-xr-x 2 root root 60 Aug 13 21:38 by-path drwxr-xr-x 2 root root 60 Aug 13 21:38 by-id test@test594:~$ lsof /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0c test@test594:~$ 1st run of 'arecord': ------------------------- I triggered 'arecord' after 2 mins of the system boot. In the 1st run, it failed with "Device or resource busy" and I see that pulseaudio loaded in the memory. Why does pulseaudio get triggered on running the alsa-utils command? How is the failure message "Device or resource busy" from the kernel code? test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav arecord: main:722: audio open error: Device or resource busy test@test594:~$ test@test594:~$ lsof /dev/snd/pcmC1D0c COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test mem CHR 116,4 463 /dev/snd/pcmC1D0c pulseaudi 1550 test 27u CHR 116,4 0t0 463 /dev/snd/pcmC1D0c test@test594:~$ lsof /dev/snd/controlC1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test 20u CHR 116,2 0t0 461 /dev/snd/controlC1 pulseaudi 1550 test 26u CHR 116,2 0t0 461 /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0p test@test594:~$ test@test594:~$ uptime 21:41:06 up 2 min, 1 user, load average: 0.20, 0.19, 0.08 2nd run of 'arecord': ------------------------- The subsequent run of arecord runs fine without any issues even though pulseaudio is still in memory. test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ^CAborted by signal Interrupt... test@test594:~$ uptime 21:41:22 up 2 min, 1 user, load average: 0.14, 0.18, 0.08 test@test594:~$ What is the role of pulseaudio? Is there a way to disable it from running it? Disabling pulseaudio causes any issues while testing audio drivers? > >> > >> Jaroslav > >> > >> -- > >> Jaroslav Kysela > >> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. > > > > -- > Thanks, > Sekhar -- Thanks, Sekhar _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies From mboxrd@z Thu Jan 1 00:00:00 1970 From: Muni Sekhar Date: Fri, 13 Aug 2021 16:41:30 +0000 Subject: Re: USB-Audio: Device or resource busy (strace log) Message-Id: List-Id: References: <41bebccc-7940-8379-0108-047bd1cc92f9@perex.cz> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: vishnu Cc: Jaroslav Kysela , alsa-devel , linux-usb@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, kernelnewbies On Wed, Aug 11, 2021 at 6:48 PM Muni Sekhar wrote: > > On Wed, Aug 11, 2021 at 6:19 PM vishnu wrote: > > > > can you paste output of > > arecord -l (list of capture devices). > $ arecord -l > **** List of CAPTURE Hardware Devices **** > card 0: USB [Plantronics .Audio 628 USB], device 0: USB Audio [USB Audio] > Subdevices: 1/1 > Subdevice #0: subdevice #0 > > > > Which device you are using and os. > > Does this instance is already open by default? like any video playing or something like that? > lsof does not catch it. > > > > > Yes you can stop pulse audio and try.. > > > > On Wed, Aug 11, 2021 at 6:17 PM Jaroslav Kysela wrote: > >> > >> On 11. 08. 21 14:36, Muni Sekhar wrote: > >> > Hi All, > >> > > >> > $ cat /proc/asound/cards > >> > 0 [USB ]: USB-Audio - Plantronics .Audio 628 USB > >> > Plantronics Plantronics .Audio 628 USB at > >> > usb-0000:00:14.0-2, full speed > >> > > >> > I am using a Plantronics USB Audio headset. > >> > > >> > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > >> > arecord: main:722: audio open error: Device or resource busy > >> > > >> > > >> > 'arecord' command always fails the first time after system boot in my > >> > system. But subsequent execution of the 'arecord' command runs fine. > >> > > >> > > >> > I've attached the strace log for the "audio open error: Device or > >> > resource busy" failure. Is there any fix available for this issue? > >> > >> You may check which other task blocks the PCM device: > >> > >> lsof /dev/snd/pcmC0D0c > It does not output any process. > $ lsof /dev/snd/pcmC0D0c > > 1st run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > arecord: main:722: audio open error: Device or resource busy > > 2nd run: > ---------- > $ arecord --device hw:0,0 --channels 2 --format S16_LE --rate 44100Hz x.wav > Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo > ^CAborted by signal Interrupt... > > > >> > >> I guess that it will be pulseaudio (device enumeration). I see that pulseaudio is getting loaded on invoking the 1st run of 'arecord' command. Here is the log: After system boot I verified that pulseaudio is not in the memory. test@test594:~$ uptime 21:39:27 up 0 min, 1 user, load average: 0.70, 0.25, 0.09 test@test594:~$ ls -ltr /dev/snd/controlC1 crw-rw---- 1 root audio 116, 2 Aug 13 21:38 /dev/snd/controlC1 test@test594:~$ ls -ltr /dev/snd/ total 0 crw-rw---- 1 root audio 116, 33 Aug 13 21:38 timer crw-rw---- 1 root audio 116, 1 Aug 13 21:38 seq crw-rw---- 1 root audio 116, 3 Aug 13 21:38 pcmC1D0p crw-rw---- 1 root audio 116, 4 Aug 13 21:38 pcmC1D0c crw-rw---- 1 root audio 116, 2 Aug 13 21:38 controlC1 drwxr-xr-x 2 root root 60 Aug 13 21:38 by-path drwxr-xr-x 2 root root 60 Aug 13 21:38 by-id test@test594:~$ lsof /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0c test@test594:~$ 1st run of 'arecord': ------------------------- I triggered 'arecord' after 2 mins of the system boot. In the 1st run, it failed with "Device or resource busy" and I see that pulseaudio loaded in the memory. Why does pulseaudio get triggered on running the alsa-utils command? How is the failure message "Device or resource busy" from the kernel code? test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav arecord: main:722: audio open error: Device or resource busy test@test594:~$ test@test594:~$ lsof /dev/snd/pcmC1D0c COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test mem CHR 116,4 463 /dev/snd/pcmC1D0c pulseaudi 1550 test 27u CHR 116,4 0t0 463 /dev/snd/pcmC1D0c test@test594:~$ lsof /dev/snd/controlC1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME pulseaudi 1550 test 20u CHR 116,2 0t0 461 /dev/snd/controlC1 pulseaudi 1550 test 26u CHR 116,2 0t0 461 /dev/snd/controlC1 test@test594:~$ lsof /dev/snd/pcmC1D0p test@test594:~$ test@test594:~$ uptime 21:41:06 up 2 min, 1 user, load average: 0.20, 0.19, 0.08 2nd run of 'arecord': ------------------------- The subsequent run of arecord runs fine without any issues even though pulseaudio is still in memory. test@test594:~$ arecord --device hw:1,0 --channels 2 --format S16_LE --rate 44100Hz x.wav Recording WAVE 'x.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ^CAborted by signal Interrupt... test@test594:~$ uptime 21:41:22 up 2 min, 1 user, load average: 0.14, 0.18, 0.08 test@test594:~$ What is the role of pulseaudio? Is there a way to disable it from running it? Disabling pulseaudio causes any issues while testing audio drivers? > >> > >> Jaroslav > >> > >> -- > >> Jaroslav Kysela > >> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. > > > > -- > Thanks, > Sekhar -- Thanks, Sekhar