diff options
author | vivek mehta <mvivek@codeaurora.org> | 2016-07-29 01:38:52 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-07-29 01:38:52 +0000 |
commit | 90fb75ab8790f2243cd691aab9357657ebad914e (patch) | |
tree | 38f669fe09ec65532fffb00a5507ae273b4ba066 | |
parent | f25a2bf2de97ba15dcbeed2eb0b635f63a3f13dc (diff) | |
parent | 51f47ff38e553ecb1823e44c47315c41e408ca27 (diff) | |
download | tinyalsa-nougat-mr2-security-release.tar.gz |
tinyalsa: pcm: open pcm driver in non blocking modeandroid-7.1.2_r9android-7.1.2_r8android-7.1.2_r6android-7.1.2_r5android-7.1.2_r4android-7.1.2_r39android-7.1.2_r38android-7.1.2_r37android-7.1.2_r36android-7.1.2_r33android-7.1.2_r32android-7.1.2_r30android-7.1.2_r3android-7.1.2_r29android-7.1.2_r28android-7.1.2_r27android-7.1.2_r25android-7.1.2_r24android-7.1.2_r23android-7.1.2_r2android-7.1.2_r19android-7.1.2_r18android-7.1.2_r17android-7.1.2_r16android-7.1.2_r15android-7.1.2_r14android-7.1.2_r13android-7.1.2_r12android-7.1.2_r11android-7.1.2_r10android-7.1.2_r1nougat-mr2.3-releasenougat-mr2.2-releasenougat-mr2.1-releasenougat-mr2-security-releasenougat-mr2-releasenougat-mr2-pixel-releasenougat-mr2-dev
am: 51f47ff38e
Change-Id: Ie0856c473186d18dbe634c6a5a146836adfe6b0d
-rw-r--r-- | pcm.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -855,12 +855,18 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, flags & PCM_IN ? 'c' : 'p'); pcm->flags = flags; - pcm->fd = open(fn, O_RDWR); + pcm->fd = open(fn, O_RDWR|O_NONBLOCK); if (pcm->fd < 0) { oops(pcm, errno, "cannot open device '%s'", fn); return pcm; } + if (fcntl(pcm->fd, F_SETFL, fcntl(pcm->fd, F_GETFL) & + ~O_NONBLOCK) < 0) { + oops(pcm, errno, "failed to reset blocking mode '%s'", fn); + goto fail_close; + } + if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_INFO, &info)) { oops(pcm, errno, "cannot get info"); goto fail_close; @@ -884,7 +890,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, if (flags & PCM_NOIRQ) { if (!(flags & PCM_MMAP)) { oops(pcm, -EINVAL, "noirq only currently supported with mmap()."); - goto fail; + goto fail_close; } params.flags |= SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP; |