public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: PALAK SHAH <palak.shah@raritan.com>,
	Maynard CABIENTE <maynard.cabiente@raritan.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: usb: gadget: dwc2: not getting audio data
Date: Fri, 19 May 2023 13:22:41 +0000	[thread overview]
Message-ID: <f3f95e78-20e6-41a0-fe21-ae2c78f305e4@synopsys.com> (raw)
In-Reply-To: <PAXPR06MB8531CF37474902FAD1CBF6AF8D7F9@PAXPR06MB8531.eurprd06.prod.outlook.com>

Hi Palak,

On 5/18/23 22:32, PALAK SHAH wrote:
> Hi Minas,
> Please see below how I test - our device name is KX4-101
> 
> On HOST machine,
> [palakshah@localhost ~]$ aplay -L
> sysdefault:CARD=KX4101
>      KX4-101, USB Audio
>      Default Audio Device
> iec958:CARD=KX4101,DEV=0
>      KX4-101, USB Audio
>      IEC958 (S/PDIF) Digital Audio Output
> 
> [palakshah@localhost Downloads]$ aplay -f S16_LE --rate=48000 --device iec958:CARD=KX4101,DEV=0 retro-city-14099.wav
> Playing raw data 'retro-city-14099.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
> 
> LINUX DEVICE AS USB GADGET -
> # arecord --rate 48000 -f S16_LE -D plughw:CARD=UAC1Gadget,DEV=0 test.wav
> 
> pcm_hw.c - file name - /dev/snd/pcmC0D0c
> 
> Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
> ^CAborted by signal Interrupt...
> 
> arecord: pcm_read:2220: read error: Interrupted system call
> # ls -la
> drwxr-xr-x    1 1001     1001            82 May 18 13:26 .
> drwxr-xr-x    1 1001     1001           322 May  4 10:36 ..
> -rw-rw-rw-    1 root     root             0 Feb 27 14:59 events
> -rw-rw-rw-    1 root     root             0 Feb 27 14:59 fast_ops-
> -rw-rw-rw-    1 root     root             0 Feb 27 14:59 fd
> -rw-rw-rw-    1 root     root             0 Feb 27 14:59 poll_descriptors
> -rw-r--r--    1 root     root            44 May 18 13:26 test.wav // only 44 bytes
> 
> # vi test.wav
> RIFF$^@^@.WAVEfmt ^P^@^@^@^A^@^A^@@^_^@^@@^_^@^@^A^@^H^@data^@^@^@.
> 
> As you can see, I am playing retro-city*.wav file on the HOST. And trying to capture it on the DEVICE.
> 
> But the test.wav file only is 44 bytes. If the end point is receiving data and the aplay is playing wav file, then why is the arecord not getting data?
> 
> Thanks,
> Palak
> 

Sorry, but this is out of scope of my maintenance/support of core+dwc2.
By fixing request count in function driver we didn't see any more issue 
in core+dwc2, which confirmed by latest logs and using testusb. On my 
setup aplay/arecord works fine. I can't do anything more for this case.
FYI, next week I'm on vacation.

Thanks,
Minas


> -----Original Message-----
> From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
> Sent: Thursday, May 18, 2023 7:23 AM
> To: PALAK SHAH <palak.shah@raritan.com>; Maynard CABIENTE <maynard.cabiente@raritan.com>
> Cc: linux-usb@vger.kernel.org
> Subject: Re: usb: gadget: dwc2: not getting audio data
> 
> Hi Palak,
> 
> On 5/17/23 23:02, PALAK SHAH wrote:
>> Hi Minas,
>>
>> Minas wrote:
>>
>>> So, to set req num to 32 resolve time gap issue and ISOC OUT transfers
>>> (aplay) going OK. Please keep this 32 setting always.
>>
>> I will keep UAC1_DEF_REQ_NUM at 32.
>>
>> Please note that I am NOT DOING APLAY here. We are currently only testing SPEAKERS, not microphone. The 5.10.100 kernel has some parameter checks (f_audio_validate_opts ), so I had to enable microphone (EP4(IN)). But I am not testing microphone.
>>
>> I am trying to CAPTURE AUDIO on my Linux device (acting as an audio gadget). I am playing some audio using you tube on the host machine. And it sending the data to my device, which is target. The endpoint from which I want to capture data is EP1(OUT).
>>
>>
>> Minas wrote:
>>
>>> Arecord. In latest log I see that function driver, besides EP1OUT (which for aplay and it normally works),
>>
>>> queued 32 requests to EP4IN, which I assume endpoint for ISOC IN for arecord. But transfer on EP4IN never > start. Please provide me log and usb trace when you doing aplay with arecord.
>>
>>
>> Again, I am not running aplay yet. I am testing only arecord to make sure that the audio data from the USB target (host machine) can be retrieved.
>>
>> Before changing the number of request to 32, the dwc2 isochronous transfers will stop. With the count 32, the endpoint isn’t shutting down, BUT I want to capture the data using ARECORD in a file and that is not happening. The file is only 44 bytes.
>>
>> Below is the example of what I am doing -
>>
>> HOST MACHINE -
>>
>> PLAY AUDIO USING YOUTUBE, DEVICE SOUND SETTINGS SELECT LINUX AUDIO GADGET
>>
>>
>>
>> LINUX DEVICE (USB AUD GADGET)
>>
>> ARECORD -f S32_LE -c 2 test.wav // try to capture the data coming on EP1(OUT)
>>
>> Even though I am seeing data on EP1(OUT), the test.wav is only 44 bytes.
>>
>> I have attached USB trace file. The logs are the same as I sent yesterday.
>>
>> Thanks,
>> Palak
>>
>> -----Original Message-----
>> From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
>> Sent: Wednesday, May 17, 2023 2:05 AM
>> To: PALAK SHAH <palak.shah@raritan.com>; Maynard CABIENTE <maynard.cabiente@raritan.com>
>> Cc: linux-usb@vger.kernel.org
>> Subject: Re: usb: gadget: dwc2: not getting audio data
>>
>> Hi Palak,
>>
>> On 5/17/23 00:43, PALAK SHAH wrote:
>>> Hi Minas,
>>> 1. Depend on which uac(uac1 or uac2) you use, increase 2 to 32
>>>
>>> I change the #define UAC1_DEF_REQ_NUM       32.
>>>
>>> When I do this, what I see is, that when I play audio on the target, I don’t see the ENDPOINT shutdown. HOWEVER, when I try to record the data, I DO NOT RECORD any data.
>>> The arecord file is empty with only 44 bytes. I saw the same behavior 2 months ago with the older version of kernel.
>>>
>>
>> So, to set req num to 32 resolve time gap issue and ISOC OUT transfers
>> (aplay) going OK. Please keep this 32 setting always.
>>
>> Arecord. In latest log I see that function driver, besides EP1OUT (which for aplay and it normally works), queued 32 requests to EP4IN, which I assume endpoint for ISOC IN for arecord. But transfer on EP4IN never start. Please provide me log and usb tarce when you doing aplay with arecord.
>>
>>> The logs show that the data comes on EP1(OUT) and the buffer queues upto #255 and then wraps around to 0. USB sniffer also shows data coming in.
>> Wrapping from #255 to #0 is Ok, driver allocate 256 descriptors
>>
>>
>> Thanks,
>> Minas
>>
>>>
> 
> On device machine run recording by follow command:
> arecord -D plughw:CARD=UAC2Gadget,DEV=0 test.wav
> 
> On host machine playing audio by follow command:
> aplay -D plughw:CARD=audiogadget,DEV=0
> /usr/share/sounds/alsa/Front_Center.wav
> 
> On play finish terminated arecord by CTRL-C
> 
> Recorded test.wav file contain audio data.
> 
> Thanks,
> Minas
> 
> ________________________________
> 
> Ce message, ainsi que tous les fichiers joints à ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas être divulguées. Si vous n'êtes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier immédiatement à son expéditeur, et de détruire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autorisée, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
> 
> 
> This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.

  reply	other threads:[~2023-05-19 13:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <HE1PR0601MB25868E34AF4BA6CEAFE06F5F8DA39@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2023-02-22  6:39 ` usb: gadget: dwc2: not getting audio data Minas Harutyunyan
     [not found]   ` <HE1PR0601MB2586BFAE94813BA86BAB12708DAA9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2023-02-23  6:31     ` Minas Harutyunyan
     [not found]       ` <HE1PR0601MB25868FC836C3CD2D07B342958DAB9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2023-02-24 10:32         ` Minas Harutyunyan
2023-02-27  2:02           ` Palak SHAH
2023-02-27 10:18             ` Minas Harutyunyan
     [not found]               ` <HE1PR0601MB2586DB1CA3D0B4B45E7720A68DAF9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2023-03-01 19:29                 ` Palak SHAH
2023-03-02 21:38                 ` Palak SHAH
2023-03-03  4:35                 ` Minas Harutyunyan
2023-03-06 16:25                   ` Palak SHAH
2023-03-07  4:30                     ` Minas Harutyunyan
2023-03-08 21:42                       ` Palak SHAH
2023-03-09 10:03                         ` Minas Harutyunyan
2023-03-09 16:21                           ` Palak SHAH
2023-03-10  9:03                             ` Minas Harutyunyan
2023-04-06  1:42                               ` PALAK SHAH
2023-04-06  4:56                                 ` Minas Harutyunyan
2023-04-06 18:06                                   ` PALAK SHAH
     [not found]       ` <PAXPR06MB85319DCC50F69D0790D5F4198D719@PAXPR06MB8531.eurprd06.prod.outlook.com>
     [not found]         ` <PAXPR06MB8531E23298F9BA26C1E651AC8D769@PAXPR06MB8531.eurprd06.prod.outlook.com>
     [not found]           ` <PAXPR06MB8531BF29DA170252843DD5598D769@PAXPR06MB8531.eurprd06.prod.outlook.com>
     [not found]             ` <PAXPR06MB8531D31F642598C1D9B8555B8D749@PAXPR06MB8531.eurprd06.prod.outlook.com>
2023-05-16  7:51               ` Minas Harutyunyan
2023-05-16  7:53               ` Minas Harutyunyan
2023-05-16 20:43                 ` PALAK SHAH
2023-05-17  6:04                   ` Minas Harutyunyan
2023-05-17 19:02                     ` PALAK SHAH
2023-05-18 11:22                       ` Minas Harutyunyan
2023-05-18 18:32                         ` PALAK SHAH
2023-05-19 13:22                           ` Minas Harutyunyan [this message]
     [not found]                     ` <PAXPR06MB85314C9FAD4BFEA5ED1B6F828D0DA@PAXPR06MB8531.eurprd06.prod.outlook.com>
2023-08-14 14:47                       ` PALAK SHAH
2023-08-15  8:44                       ` Minas Harutyunyan
     [not found]                         ` <PAXPR06MB85318E88964FE24F74139C678D14A@PAXPR06MB8531.eurprd06.prod.outlook.com>
2023-08-25 18:32                           ` PALAK SHAH
2023-08-28 10:46                             ` Minas Harutyunyan
     [not found] <HE1PR0601MB2586962582F222B5B889416A8D1B9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
     [not found] ` <AS8PR06MB7976A91E44D7DCDAACC723F7971B9@AS8PR06MB7976.eurprd06.prod.outlook.com>
     [not found]   ` <HE1PR0601MB258625B74749B2DB1242E0048D1B9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
     [not found]     ` <HE1PR0601MB2586E4A641ECA0D0D043A3798D1D9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
     [not found]       ` <HE1PR0601MB258685C64D46C08C978C37EB8D1D9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2022-12-09 11:32         ` Minas Harutyunyan
     [not found]           ` <HE1PR0601MB25861FC1248FF0A61DDBC8F58D1C9@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2022-12-12 12:27             ` Minas Harutyunyan
     [not found]               ` <HE1PR0601MB2586D03B6D11FDF5F513E2488DE29@HE1PR0601MB2586.eurprd06.prod.outlook.com>
     [not found]                 ` <HE1PR0601MB2586AFC1102D078A26615CBC8DE29@HE1PR0601MB2586.eurprd06.prod.outlook.com>
2022-12-14  6:11                   ` Minas Harutyunyan
2022-12-15 21:16               ` Palak SHAH
2022-12-16  7:03                 ` Minas Harutyunyan
2023-01-06 21:37                   ` Palak SHAH
2023-01-12 10:52                     ` Minas Harutyunyan
2023-01-12 20:22                       ` Palak SHAH
2023-01-13  8:08                         ` Minas Harutyunyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3f95e78-20e6-41a0-fe21-ae2c78f305e4@synopsys.com \
    --to=minas.harutyunyan@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=maynard.cabiente@raritan.com \
    --cc=palak.shah@raritan.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox