Blame SOURCES/alsa-utils-1.1.8-post.patch

681a73
From 116488e5f2f1b897084bd151381ee254e1cc177d Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Fri, 18 Jan 2019 09:24:12 +0100
681a73
Subject: [PATCH 01/20] alsamixer: define _GNU_SOURCE to get exp10
681a73
681a73
Fixes Master, Headphones and Speaker stuck at -8 percentage after
681a73
building with Clang 7.0.1 and getting warned about implicit declaration
681a73
of exp10, which is behind _GNU_SOURCE as a non-standard feature. Thanks
681a73
Takashi Iwai for the CFLAGS suggestion on the mailing list. GCC build is
681a73
not affected, so not adding a compiler check to the configure script.
681a73
681a73
uClibc-ng has got exp10 since 1.0.12, so the fallback macro is no longer
681a73
needed. However, alsa-utils relies on gettext so might need further
681a73
patches to actually work on uClibc systems.
681a73
681a73
Signed-off-by: makepost <makepost@firemail.cc>
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 alsamixer/Makefile.am      | 2 +-
681a73
 alsamixer/volume_mapping.c | 5 -----
681a73
 2 files changed, 1 insertion(+), 6 deletions(-)
681a73
681a73
diff --git a/alsamixer/Makefile.am b/alsamixer/Makefile.am
681a73
index 259b29e..249e8f8 100644
681a73
--- a/alsamixer/Makefile.am
681a73
+++ b/alsamixer/Makefile.am
681a73
@@ -1,4 +1,4 @@
681a73
-AM_CFLAGS = @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
681a73
+AM_CFLAGS = -D_GNU_SOURCE @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
681a73
 LDADD = @CURSESLIB@
681a73
 
681a73
 bin_PROGRAMS = alsamixer
681a73
diff --git a/alsamixer/volume_mapping.c b/alsamixer/volume_mapping.c
681a73
index 94bd0fe..48cfbe2 100644
681a73
--- a/alsamixer/volume_mapping.c
681a73
+++ b/alsamixer/volume_mapping.c
681a73
@@ -36,11 +36,6 @@
681a73
 #include <stdbool.h>
681a73
 #include "volume_mapping.h"
681a73
 
681a73
-#ifdef __UCLIBC__
681a73
-/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
681a73
-#define exp10(x) (exp((x) * log(10)))
681a73
-#endif /* __UCLIBC__ */
681a73
-
681a73
 #define MAX_LINEAR_DB_SCALE	24
681a73
 
681a73
 static inline bool use_linear_dB_scale(long dBmin, long dBmax)
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 83bce86c26be6c04bcef584fbe00f320b3582c92 Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 14:27:11 +0900
681a73
Subject: [PATCH 02/20] axfer: add a section about unit test
681a73
681a73
Two unit tests are available to check internal implementation of axfer.
681a73
They perform file I/O for many times and take much time to finish.
681a73
681a73
This commit adds a section about it.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 16 ++++++++++++++++
681a73
 axfer/axfer.1          |  7 +++++++
681a73
 2 files changed, 23 insertions(+)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index 4ff6082..02e5b4c 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -971,6 +971,22 @@ some scenarios below, no copying occurs between modules.
681a73
  - xfer(mmap/interleaved), mapper(single), container(any)
681a73
  - xfer(mmap/non\-interleaved), mapper(multiple), containers(any)
681a73
 
681a73
+.SS Unit test
681a73
+
681a73
+For each of the
681a73
+.I mapper
681a73
+and
681a73
+.I container
681a73
+module, unit test is available. To run the tests, execute below command:
681a73
+
681a73
+.nf
681a73
+$ make test
681a73
+.fi
681a73
+
681a73
+Each test iterates writing to file and reading to the file for many times and it
681a73
+takes long time to finish. Please take care of the execution time if running on
681a73
+any CI environment.
681a73
+
681a73
 .SH SEE ALSO
681a73
 \fB
681a73
 axfer(1),
681a73
diff --git a/axfer/axfer.1 b/axfer/axfer.1
681a73
index bfcd15d..3ae9c8e 100644
681a73
--- a/axfer/axfer.1
681a73
+++ b/axfer/axfer.1
681a73
@@ -75,6 +75,13 @@ Operates for playback transmission.
681a73
 .I EXIT_FAILURE
681a73
 (1).
681a73
 
681a73
+.SH UNIT TEST
681a73
+
681a73
+This program has unit tests for internal implementation. Please refer to the
681a73
+manual of
681a73
+.I axfer-transfer
681a73
+for details.
681a73
+
681a73
 .SH COMPATIBILITY TO APLAY
681a73
 
681a73
 The
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From b6142611c68a380644ce34f885e2d67da084b538 Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 14:39:18 +0900
681a73
Subject: [PATCH 03/20] axfer: fulfill section for backward compatibitity for
681a73
 chmap option
681a73
681a73
At present, axfer losts backward compatibility to aplay in a point of
681a73
'chmap' option.
681a73
681a73
This commit filfills a section to describe lose of backward compatibility
681a73
of chmap option.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 9 +++++++++
681a73
 1 file changed, 9 insertions(+)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index 02e5b4c..1fdfc91 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -872,6 +872,15 @@ according to pushed enter key. However, this feature requires an additional
681a73
 input handling in main loop and leave bothersome operation to maintain PCM
681a73
 substream.
681a73
 
681a73
+.TP
681a73
+.I \-m, \-\-chmap=CH1,CH2,...
681a73
+ALSA PCM core and control core doesn't support this feature, therefore
681a73
+remapping should be done in userspace. This brings overhead to align audio
681a73
+data frames, especially for mmap operation. Furthermore, as of alsa-lib v1.1.8,
681a73
+some plugins don't support this feature expectedly, thus this option is a lack
681a73
+of transparent operation. At present, this option is not supported yet not to
681a73
+confuse users.
681a73
+
681a73
 .TP
681a73
 .I SIGTSTP, SIGCONT
681a73
 This performs suspend/resume of PCM substream. In aplay(1) implementation,
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 827ed7d1933ee9a0ce052d9eb2c0b1c79770dff2 Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 14:48:33 +0900
681a73
Subject: [PATCH 04/20] axfer: correct description about snoop mode of libffado
681a73
681a73
The libffado library can listen to isochronous channels to which unit on
681a73
IEEE 1394 bus transfers packets as long as the unit allows software to
681a73
read the channel from its register.
681a73
681a73
This commit corrects description about snoop mode.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 5 +++--
681a73
 1 file changed, 3 insertions(+), 2 deletions(-)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index 1fdfc91..89df3cc 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -560,8 +560,9 @@ audio data frame.
681a73
 .B \-\-snoop
681a73
 
681a73
 This option allows this program to run snoop mode. In this mode, libffado
681a73
-listens all isochronous channels. When isochronous communication starts
681a73
-by any unit on the same bus, the packets can be handled by this program.
681a73
+listens isochronous channels to which device transfers isochronous packet. When
681a73
+isochronous communication starts by any unit on the same bus, the packets can
681a73
+be handled by this program.
681a73
 
681a73
 .TP
681a73
 .B \-\-sched\-priority
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 1848b38ca94a52e4539e27526b2c028aa487053b Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 14:49:43 +0900
681a73
Subject: [PATCH 05/20] axfer: correct message to notice that help text is
681a73
 implemented
681a73
681a73
Now help message is available to give help option to command line.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 2 +-
681a73
 1 file changed, 1 insertion(+), 1 deletion(-)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index 89df3cc..d631f72 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -100,7 +100,7 @@ is not allowed except for paths listed below:
681a73
 
681a73
 .TP
681a73
 .B \-h, \-\-help
681a73
-Print help messages and finish run time. Not yet implemented.
681a73
+Print help messages and finish run time.
681a73
 
681a73
 .TP
681a73
 .B \-q, \-\-quiet
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From fb038252d49b31e77f56a9c62527bb108cc965ad Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Tue, 15 Jan 2019 08:49:58 +0900
681a73
Subject: [PATCH 06/20] axfer: supplement value of options for the manual of
681a73
 transfer subcommand
681a73
681a73
This commit supplements value of options for the manual of transfer
681a73
subcommand.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 40 ++++++++++++++++++++--------------------
681a73
 1 file changed, 20 insertions(+), 20 deletions(-)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index d631f72..a8bf9c7 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -203,7 +203,7 @@ and
681a73
 is used as a default.
681a73
 
681a73
 .TP
681a73
-.B \-t, \-\-file\-type=TYPES
681a73
+.B \-t, \-\-file\-type=TYPE
681a73
 Indicate the type of file. This is required for capture transmission. Available
681a73
 types are listed below:
681a73
  - wav: Microsoft/IBM RIFF/Wave format
681a73
@@ -242,7 +242,7 @@ Select backend of transmission from a list below. The default is libasound.
681a73
 .SS Backend options for libasound
681a73
 
681a73
 .TP
681a73
-.B \-D, \-\-device
681a73
+.B \-D, \-\-device=NODE
681a73
 
681a73
 This option is used to select PCM node in libasound configuration space.
681a73
 Available nodes are listed by
681a73
@@ -271,7 +271,7 @@ This option implicitly uses
681a73
 option as well to prevent heavy consumption of CPU time.
681a73
 
681a73
 .TP
681a73
-.B \-F, \-\-period\-size
681a73
+.B \-F, \-\-period\-size=#
681a73
 
681a73
 This option configures given value to
681a73
 .I period_size
681a73
@@ -288,7 +288,7 @@ intervals of hardware interrupt, thus the same amount of audio data frame as
681a73
 the value is expected to be available for one I/O operation.
681a73
 
681a73
 .TP
681a73
-.B \-\-period\-time
681a73
+.B \-\-period\-time=#
681a73
 
681a73
 This option configures given value to
681a73
 .I period_time
681a73
@@ -297,7 +297,7 @@ hardware parameter of PCM substream. This option is similar to
681a73
 option, however its unit is micro\-second.
681a73
 
681a73
 .TP
681a73
-.B \-B, \-\-buffer\-size
681a73
+.B \-B, \-\-buffer\-size=#
681a73
 
681a73
 This option configures given value to
681a73
 .I buffer_size
681a73
@@ -311,7 +311,7 @@ the size of period. Actually, it is not, depending on implementation of the PCM
681a73
 plugins, in\-kernel driver and PCM I/O plugins.
681a73
 
681a73
 .TP
681a73
-.B \-\-buffer\-time
681a73
+.B \-\-buffer\-time=#
681a73
 
681a73
 This option configures given value to
681a73
 .I buffer_time
681a73
@@ -320,7 +320,7 @@ hardware parameter of PCM substream. This option is similar to
681a73
 option, however its unit is micro\-second.
681a73
 
681a73
 .TP
681a73
-.B \-\-waiter\-type
681a73
+.B \-\-waiter\-type=TYPE
681a73
 
681a73
 This option indicates the type of waiter for event notification. At present,
681a73
 four types are available;
681a73
@@ -355,7 +355,7 @@ Neither this option nor
681a73
 is available at the same time.
681a73
 
681a73
 .TP
681a73
-.B \-\-sched\-model
681a73
+.B \-\-sched\-model=MODEL
681a73
 
681a73
 This option selects scheduling model for process of this program. One of
681a73
 .I irq
681a73
@@ -368,7 +368,7 @@ When nothing specified,
681a73
 model is used.
681a73
 
681a73
 .TP
681a73
-.B \-A, \-\-avail\-min
681a73
+.B \-A, \-\-avail\-min=#
681a73
 
681a73
 This option configures given value to
681a73
 .I avail\-min
681a73
@@ -386,7 +386,7 @@ value of
681a73
 option is used.
681a73
 
681a73
 .TP
681a73
-.B \-R, \-\-start\-delay
681a73
+.B \-R, \-\-start\-delay=#
681a73
 
681a73
 This option configures given value to
681a73
 .I start_threshold
681a73
@@ -420,7 +420,7 @@ value of
681a73
 option is used.
681a73
 
681a73
 .TP
681a73
-.B \-T, \-\-stop\-delay
681a73
+.B \-T, \-\-stop\-delay=#
681a73
 
681a73
 This option configures given value to
681a73
 .I stop_threshold
681a73
@@ -500,7 +500,7 @@ This backend is automatically available when configure script detects
681a73
 symbol in libffado shared object.
681a73
 
681a73
 .TP
681a73
-.B \-p, \-\-port
681a73
+.B \-p, \-\-port=#
681a73
 
681a73
 This option uses given value to decide which 1394 OHCI controller is used to
681a73
 communicate. When Linux system has two 1394 OHCI controllers,
681a73
@@ -513,7 +513,7 @@ is available at the same time. If nothing specified, libffado performs to
681a73
 communicate to units on IEEE 1394 bus managed by all of 1394 OHCI controller available in Linux system.
681a73
 
681a73
 .TP
681a73
-.B \-n, \-\-node
681a73
+.B \-n, \-\-node=#
681a73
 
681a73
 This option uses given value to decide which unit is used to communicate. This
681a73
 option requires
681a73
@@ -522,7 +522,7 @@ option to indicate which 1394 OHCI controller is used to communicate to the
681a73
 specified unit.
681a73
 
681a73
 .TP
681a73
-.B \-g, \-\-guid
681a73
+.B \-g, \-\-guid=HEXADECIMAL
681a73
 
681a73
 This option uses given value to decide a target unit to communicate. The value
681a73
 should be prefixed with '0x' and consists of hexadecimal literal letters
681a73
@@ -533,7 +533,7 @@ communicate to units on IEEE 1394 bus managed by all of 1394 OHCI controller
681a73
 available in Linux system.
681a73
 
681a73
 .TP
681a73
-.B \-\-frames\-per\-period
681a73
+.B \-\-frames\-per\-period=#
681a73
 
681a73
 This option uses given value to decide the number of audio data frame in one
681a73
 read/write operation. The operation is blocked till the number of available
681a73
@@ -541,7 +541,7 @@ audio data frame exceeds the given value. As a default, 512 audio data frames
681a73
 is used.
681a73
 
681a73
 .TP
681a73
-.B \-\-periods\-per\-buffer
681a73
+.B \-\-periods\-per\-buffer=#
681a73
 
681a73
 This option uses given value to decide the size of intermediate buffer between
681a73
 this program and libffado. As a default, 2 periods per buffer is used.
681a73
@@ -565,7 +565,7 @@ isochronous communication starts by any unit on the same bus, the packets can
681a73
 be handled by this program.
681a73
 
681a73
 .TP
681a73
-.B \-\-sched\-priority
681a73
+.B \-\-sched\-priority=#
681a73
 
681a73
 This option executes
681a73
 .I pthread_setschedparam()
681a73
@@ -796,7 +796,7 @@ supports. As of 2018, PCM buffer of non\-interleaved order is hardly used by
681a73
 sound devices.
681a73
 
681a73
 .TP
681a73
-.I \-A, \-\-avail\-min
681a73
+.I \-A, \-\-avail\-min=#
681a73
 This option indicates threshold to wake up blocked process in a unit of
681a73
 audio data frame. Against aplay(1) implementation, this option has no effect
681a73
 with
681a73
@@ -808,7 +808,7 @@ of
681a73
 option.
681a73
 
681a73
 .TP
681a73
-.I \-R, \-\-start\-delay
681a73
+.I \-R, \-\-start\-delay=#
681a73
 This option indicates threshold to start prepared PCM substream in a unit of
681a73
 audio data frame. Against aplay(1) implementation, this option has no effect
681a73
 with
681a73
@@ -820,7 +820,7 @@ of
681a73
 option.
681a73
 
681a73
 .TP
681a73
-.I \-T, \-\-stop\-delay
681a73
+.I \-T, \-\-stop\-delay=#
681a73
 This option indicates threshold to stop running PCM substream in a unit of
681a73
 audio data frame. Against aplay(1) implementation, this option has no effect
681a73
 with
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 9ed5d7c876a1c11118f2524327c9eac65e7d66dd Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 14:56:12 +0900
681a73
Subject: [PATCH 07/20] axfer: correct invalid usage of escape of itaric text
681a73
681a73
A dot sign is valid for a prefix of instruction.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/axfer-transfer.1 | 2 +-
681a73
 1 file changed, 1 insertion(+), 1 deletion(-)
681a73
681a73
diff --git a/axfer/axfer-transfer.1 b/axfer/axfer-transfer.1
681a73
index a8bf9c7..375678e 100644
681a73
--- a/axfer/axfer-transfer.1
681a73
+++ b/axfer/axfer-transfer.1
681a73
@@ -75,7 +75,7 @@ The standard input or output is used if filepath is not specified or given as
681a73
 \&.
681a73
 
681a73
 For playback transmission, container format of given
681a73
-\I filepath
681a73
+.I filepath
681a73
 is detected automatically and metadata is used for parameters of sample format,
681a73
 channels, rate, duration. If nothing detected, content of given file path is
681a73
 handled as raw data. In this case, the parameters should be indicated as
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 2ba2066008c0fbe98374cc22e8a2eaa4e4e1b2bd Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 18:03:11 +0900
681a73
Subject: [PATCH 08/20] axfer: add an entry of axfer to README
681a73
681a73
Axfer has beed added as a rework of aplay with robust design to
681a73
support recent features of Linux sound subsystem.
681a73
681a73
This commit adds an entry to README.
681a73
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 README.md | 1 +
681a73
 1 file changed, 1 insertion(+)
681a73
681a73
diff --git a/README.md b/README.md
681a73
index bee2e94..c28e2ea 100644
681a73
--- a/README.md
681a73
+++ b/README.md
681a73
@@ -11,6 +11,7 @@ alsaconf	| the ALSA driver configurator script
681a73
 alsa-info       | a script to gather information about ALSA subsystem
681a73
 alsactl		| an utility for soundcard settings management
681a73
 aplay/arecord	| an utility for the playback / capture of .wav,.voc,.au files
681a73
+axfer		| an utility to transfer audio data frame (enhancement of aplay)
681a73
 amixer		| a command line mixer
681a73
 alsamixer	| a ncurses mixer
681a73
 amidi		| a utility to send/receive sysex dumps or other MIDI data
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 257be19c47e62cd0553e740599802cec9182b37c Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 17:36:22 +0900
681a73
Subject: [PATCH 09/20] axfer: allow to be compiled with glibc-2.11 or former
681a73
681a73
The program, axfer, was developed in userspace with glibc-2.28. This
681a73
userspace is mostly compliant to POSIX:2008 and some additional macros
681a73
for poll event are officially available. The glibc supports them as a
681a73
default since its v2.12 release. It will be failed to be compiled with
681a73
old glibc or the other libraries for C standard APIs.
681a73
681a73
One of the purpose of axfer is an better alternative of aplay. In a
681a73
point of the purpose, it's preferable to be compiled with the old
681a73
libraries.
681a73
681a73
This commit adds conditional macros to be compiled with libraries for
681a73
old compliance level of POSIX.
681a73
681a73
Reported-by: Jay Foster <jay@systech.com>
681a73
Fixes: fce16d9279b6 ('axfer: add an implementation of waiter for select(2)')
681a73
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/waiter-select.c | 13 +++++++++++--
681a73
 1 file changed, 11 insertions(+), 2 deletions(-)
681a73
681a73
diff --git a/axfer/waiter-select.c b/axfer/waiter-select.c
681a73
index a35ea85..a2776e5 100644
681a73
--- a/axfer/waiter-select.c
681a73
+++ b/axfer/waiter-select.c
681a73
@@ -15,10 +15,19 @@
681a73
 #include <sys/select.h>
681a73
 
681a73
 // Except for POLLERR.
681a73
-#define POLLIN_SET	(POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP)
681a73
-#define POLLOUT_SET	(POLLWRBAND | POLLWRNORM | POLLOUT)
681a73
+#ifdef POLLRDNORM
681a73
+// This program is for userspace compliant to POSIX 2008 (IEEE 1003.1:2008).
681a73
+// This is the default compliance level since glibc-2.12 or later.
681a73
+# define POLLIN_SET	(POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP)
681a73
+# define POLLOUT_SET	(POLLWRBAND | POLLWRNORM | POLLOUT)
681a73
+#else
681a73
+// However it's allowed to be for old compliance levels.
681a73
+# define POLLIN_SET	(POLLIN | POLLHUP)
681a73
+# define POLLOUT_SET	(POLLOUT)
681a73
+#endif
681a73
 #define POLLEX_SET	(POLLPRI)
681a73
 
681a73
+
681a73
 struct select_state {
681a73
 	fd_set rfds_rd;
681a73
 	fd_set rfds_wr;
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 6fdaa0c52412205017a9a71872169c75f3d3a542 Mon Sep 17 00:00:00 2001
681a73
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
681a73
Date: Sun, 27 Jan 2019 11:24:53 +0900
681a73
Subject: [PATCH 10/20] axfer: add missing header file of unit test to
681a73
 distribution
681a73
681a73
The file 'axfer/test/generator.h' is missing in distribution and brings
681a73
FTBFS for unit tests of axfer.
681a73
681a73
This commit fixes to add it.
681a73
681a73
Reported-by: Elimar Riesebieter <riesebie@lxtec.de>
681a73
Fixes: b878df1ff0b0: ('axfer: add unit test for container interface')
681a73
Fixes: 39d1ab8a0cb4: ('axfer: add a unit test for mapper interface')
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 axfer/test/Makefile.am | 2 ++
681a73
 1 file changed, 2 insertions(+)
681a73
681a73
diff --git a/axfer/test/Makefile.am b/axfer/test/Makefile.am
681a73
index 76a93bf..6521134 100644
681a73
--- a/axfer/test/Makefile.am
681a73
+++ b/axfer/test/Makefile.am
681a73
@@ -14,6 +14,7 @@ container_test_SOURCES = \
681a73
 	../container-voc.c \
681a73
 	../container-raw.c \
681a73
 	generator.c \
681a73
+	generator.h \
681a73
 	container-test.c
681a73
 
681a73
 mapper_test_SOURCES = \
681a73
@@ -28,4 +29,5 @@ mapper_test_SOURCES = \
681a73
 	../mapper-single.c \
681a73
 	../mapper-multiple.c \
681a73
 	generator.c \
681a73
+	generator.h \
681a73
 	mapper-test.c
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 52c9cc9571659377800fea026cf31b24e2f31394 Mon Sep 17 00:00:00 2001
681a73
From: Prashant Malani <pmalani@chromium.org>
681a73
Date: Tue, 29 Jan 2019 01:58:26 -0800
681a73
Subject: [PATCH 11/20] seq: arecordmidi: Add num-events option
681a73
681a73
Add a command line option to automatically exit after recording a fixed
681a73
number of MIDI events. This allows a program using arecordmidi to expect
681a73
a MIDI file to be written automatically when the specified number of
681a73
events have been received, instead of having to send a SIGINT or SIGTERM
681a73
programmatically.
681a73
681a73
It also avoids the need to have the arecordmidi process running in the
681a73
background, and then constantly stat the output file to check if any
681a73
bytes have been written to it (this makes for less predictable and
681a73
longer-running tests).
681a73
681a73
This functionality finds use in Chrome OS functional testing, since
681a73
having to send SIGTERM/SIGINT programmatically and then wait for the
681a73
output file adds unpredictability and delay to the tests.
681a73
681a73
The addition of this command-line option should (hopefully) not break
681a73
any existing usage.
681a73
681a73
Signed-off-by: Prashant Malani <pmalani@chromium.org>
681a73
Signed-off-by: Takashi Iwai <tiwai@suse.de>
681a73
---
681a73
 seq/aplaymidi/arecordmidi.c | 47 ++++++++++++++++++++++++++++++++++---
681a73
 1 file changed, 44 insertions(+), 3 deletions(-)
681a73
681a73
diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c
681a73
index 19dbb7d..c0d0569 100644
681a73
--- a/seq/aplaymidi/arecordmidi.c
681a73
+++ b/seq/aplaymidi/arecordmidi.c
681a73
@@ -86,6 +86,25 @@ static int ts_num = 4; /* time signature: numerator */
681a73
 static int ts_div = 4; /* time signature: denominator */
681a73
 static int ts_dd = 2; /* time signature: denominator as a power of two */
681a73
 
681a73
+/* Parse a decimal number from a command line argument. */
681a73
+static long arg_parse_decimal_num(const char *str, int *err)
681a73
+{
681a73
+	long val;
681a73
+	char *endptr;
681a73
+
681a73
+	errno = 0;
681a73
+	val = strtol(str, &endptr, 0);
681a73
+	if (errno > 0) {
681a73
+		*err = -errno;
681a73
+		return 0;
681a73
+	}
681a73
+	if (*endptr != '\0') {
681a73
+		*err = -EINVAL;
681a73
+		return 0;
681a73
+	}
681a73
+
681a73
+	return val;
681a73
+}
681a73
 
681a73
 /* prints an error message to stderr, and dies */
681a73
 static void fatal(const char *msg, ...)
681a73
@@ -690,7 +709,8 @@ static void help(const char *argv0)
681a73
 		"  -t,--ticks=ticks           resolution in ticks per beat or frame\n"
681a73
 		"  -s,--split-channels        create a track for each channel\n"
681a73
 		"  -m,--metronome=client:port play a metronome signal\n"
681a73
-		"  -i,--timesig=nn:dd         time signature\n",
681a73
+		"  -i,--timesig=nn:dd         time signature\n"
681a73
+		"  -n,--num-events=events     fixed number of events to record, then exit\n",
681a73
 		argv0);
681a73
 }
681a73
 
681a73
@@ -706,7 +726,7 @@ static void sighandler(int sig)
681a73
 
681a73
 int main(int argc, char *argv[])
681a73
 {
681a73
-	static const char short_options[] = "hVlp:b:f:t:sdm:i:";
681a73
+	static const char short_options[] = "hVlp:b:f:t:sdm:i:n:";
681a73
 	static const struct option long_options[] = {
681a73
 		{"help", 0, NULL, 'h'},
681a73
 		{"version", 0, NULL, 'V'},
681a73
@@ -719,6 +739,7 @@ int main(int argc, char *argv[])
681a73
 		{"dump", 0, NULL, 'd'},
681a73
 		{"metronome", 1, NULL, 'm'},
681a73
 		{"timesig", 1, NULL, 'i'},
681a73
+		{"num-events", 1, NULL, 'n'},
681a73
 		{ }
681a73
 	};
681a73
 
681a73
@@ -727,6 +748,9 @@ int main(int argc, char *argv[])
681a73
 	struct pollfd *pfds;
681a73
 	int npfds;
681a73
 	int c, err;
681a73
+	/* If |num_events| isn't specified, leave it at 0. */
681a73
+	long num_events = 0;
681a73
+	long events_received = 0;
681a73
 
681a73
 	init_seq();
681a73
 
681a73
@@ -775,6 +799,16 @@ int main(int argc, char *argv[])
681a73
 		case 'i':
681a73
 			time_signature(optarg);
681a73
 			break;
681a73
+		case 'n':
681a73
+			err = 0;
681a73
+			num_events = arg_parse_decimal_num(optarg, &err;;
681a73
+			if (err != 0) {
681a73
+				fatal("Couldn't parse num_events argument: %s\n",
681a73
+					strerror(-err));
681a73
+			}
681a73
+			if (num_events <= 0)
681a73
+				fatal("num_events must be greater than 0");
681a73
+			break;
681a73
 		default:
681a73
 			help(argv[0]);
681a73
 			return 1;
681a73
@@ -864,13 +898,20 @@ int main(int argc, char *argv[])
681a73
 			err = snd_seq_event_input(seq, &event);
681a73
 			if (err < 0)
681a73
 				break;
681a73
-			if (event)
681a73
+			if (event) {
681a73
 				record_event(event);
681a73
+				events_received++;
681a73
+			}
681a73
 		} while (err > 0);
681a73
 		if (stop)
681a73
 			break;
681a73
+		if (num_events && (events_received == num_events))
681a73
+			break;
681a73
 	}
681a73
 
681a73
+	if (num_events && events_received < num_events)
681a73
+		fputs("Warning: Received signal before num_events\n", stdout);
681a73
+
681a73
 	finish_tracks();
681a73
 	write_file();
681a73
 
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From a558b71e63a50c045731e032dc35623674848c6c Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Tue, 12 Mar 2019 15:52:49 +0100
681a73
Subject: [PATCH 12/20] alsa-info.sh: cleanups
681a73
681a73
- fix awk arguments
681a73
- backticks/gravemarks removal
681a73
- some cosmetic and indentation changes
681a73
- add REQUIRES to check the basic tools
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 alsa-info/alsa-info.sh | 169 +++++++++++++++++++++--------------------
681a73
 1 file changed, 85 insertions(+), 84 deletions(-)
681a73
681a73
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
681a73
index cda4125..cf7ad89 100755
681a73
--- a/alsa-info/alsa-info.sh
681a73
+++ b/alsa-info/alsa-info.sh
681a73
@@ -22,22 +22,26 @@ CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
681a73
 
681a73
 ##################################################################################
681a73
 
681a73
-#The script was written for 2 main reasons:
681a73
-# 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user.
681a73
-# 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them.
681a73
+# The script was written for 2 main reasons:
681a73
+#  1. Remove the need for the devs/helpers to ask several questions before we can easily help the user.
681a73
+#  2. Allow newer/inexperienced ALSA users to give us all the info we need to help them.
681a73
 
681a73
 #Set the locale (this may or may not be a good idea.. let me know)
681a73
 export LC_ALL=C
681a73
 
681a73
-#Change the PATH variable, so we can run lspci (needed for some distros)
681a73
+# Change the PATH variable, so we can run lspci (needed for some distros)
681a73
 PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
681a73
 BGTITLE="ALSA-Info v $SCRIPT_VERSION"
681a73
 PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
681a73
-#Define some simple functions
681a73
 
681a73
-WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
681a73
+WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)
681a73
+REQUIRES="mktemp grep pgrep whereis ping awk date uname cat dmesg amixer alsactl"
681a73
 
681a73
-pbcheck(){
681a73
+#
681a73
+# Define some simple functions
681a73
+#
681a73
+
681a73
+pbcheck() {
681a73
 	[[ $UPLOAD = "no" ]] && return
681a73
 
681a73
 	if [[ -z $PASTEBIN ]]; then
681a73
@@ -50,9 +54,9 @@ pbcheck(){
681a73
 update() {
681a73
 	test -z "$WGET" -o ! -x "$WGET" && return
681a73
 
681a73
-	SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
681a73
+	SHFILE=$(mktemp -t alsa-info.XXXXXXXXXX) || exit 1
681a73
 	wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
681a73
-	REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
681a73
+	REMOTE_VERSION=$(grep SCRIPT_VERSION $SHFILE | head -n1 | sed 's/.*=//')
681a73
 	if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
681a73
 		if [[ -n $DIALOG ]]
681a73
 		then
681a73
@@ -131,7 +135,7 @@ withlsmod() {
681a73
 	echo "!!All Loaded Modules" >> $FILE
681a73
 	echo "!!------------------" >> $FILE
681a73
 	echo "" >> $FILE
681a73
-	lsmod |awk {'print $1'} >> $FILE
681a73
+	lsmod | awk '{print $1}' >> $FILE
681a73
 	echo "" >> $FILE
681a73
 	echo "" >> $FILE
681a73
 }
681a73
@@ -140,13 +144,13 @@ withamixer() {
681a73
         echo "!!Amixer output" >> $FILE
681a73
         echo "!!-------------" >> $FILE
681a73
         echo "" >> $FILE
681a73
-	for i in `grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1} '` ; do
681a73
-	CARD_NAME=`grep "^ *$i " $TEMPDIR/alsacards.tmp|awk {'print $2'}`
681a73
-	echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE
681a73
-	echo "" >>$FILE
681a73
-	amixer -c$i info>> $FILE 2>&1
681a73
-	amixer -c$i>> $FILE 2>&1
681a73
-        echo "" >> $FILE
681a73
+	for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do
681a73
+		CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }')
681a73
+		echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE
681a73
+		echo "" >>$FILE
681a73
+		amixer -c$i info >> $FILE 2>&1
681a73
+		amixer -c$i >> $FILE 2>&1
681a73
+		echo "" >> $FILE
681a73
 	done
681a73
 	echo "" >> $FILE
681a73
 }
681a73
@@ -155,17 +159,7 @@ withalsactl() {
681a73
 	echo "!!Alsactl output" >> $FILE
681a73
         echo "!!--------------" >> $FILE
681a73
         echo "" >> $FILE
681a73
-        exe=""
681a73
-        if [ -x /usr/sbin/alsactl ]; then
681a73
-        	exe="/usr/sbin/alsactl"
681a73
-        fi
681a73
-        if [ -x /usr/local/sbin/alsactl ]; then
681a73
-        	exe="/usr/local/sbin/alsactl"
681a73
-        fi
681a73
-        if [ -z "$exe" ]; then
681a73
-        	exe=`whereis alsactl | cut -d ' ' -f 2`
681a73
-        fi
681a73
-	$exe -f $TEMPDIR/alsactl.tmp store
681a73
+	alsactl -f $TEMPDIR/alsactl.tmp store
681a73
 	echo "--startcollapse--" >> $FILE
681a73
 	cat $TEMPDIR/alsactl.tmp >> $FILE
681a73
 	echo "--endcollapse--" >> $FILE
681a73
@@ -183,8 +177,7 @@ withdevices() {
681a73
 }
681a73
 
681a73
 withconfigs() {
681a73
-if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] || [[ -e $HOME/.asoundrc.asoundconf ]]
681a73
-then
681a73
+if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] || [[ -e $HOME/.asoundrc.asoundconf ]]; then
681a73
         echo "!!ALSA configuration files" >> $FILE
681a73
         echo "!!------------------------" >> $FILE
681a73
         echo "" >> $FILE
681a73
@@ -268,7 +261,7 @@ withall() {
681a73
 }
681a73
 
681a73
 get_alsa_library_version() {
681a73
-	ALSA_LIB_VERSION=`grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null|awk {'print $3'}|sed 's/"//g'`
681a73
+	ALSA_LIB_VERSION=$(grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null | awk '{ print $3 }' | sed 's/"//g')
681a73
 
681a73
 	if [ -z "$ALSA_LIB_VERSION" ]; then
681a73
 		if [ -f /etc/lsb-release ]; then
681a73
@@ -276,7 +269,7 @@ get_alsa_library_version() {
681a73
 			case "$DISTRIB_ID" in
681a73
 				Ubuntu)
681a73
 					if which dpkg > /dev/null ; then
681a73
-						ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -`
681a73
+						ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
681a73
 					fi
681a73
 
681a73
 					if [ "$ALSA_LIB_VERSION" = "<none>" ]; then
681a73
@@ -290,7 +283,7 @@ get_alsa_library_version() {
681a73
 			esac
681a73
 		elif [ -f /etc/debian_version ]; then
681a73
 			if which dpkg > /dev/null ; then
681a73
-				ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -`
681a73
+				ALSA_LIB_VERSION=$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)
681a73
 			fi
681a73
 
681a73
 			if [ "$ALSA_LIB_VERSION" = "<none>" ]; then
681a73
@@ -301,16 +294,24 @@ get_alsa_library_version() {
681a73
 	fi
681a73
 }
681a73
 
681a73
+# Basic requires
681a73
+for prg in $REQUIRES; do
681a73
+  t=$(which $prg 2> /dev/null)
681a73
+  if test -z "$t"; then
681a73
+    echo "This script requires $prg utility to continue."
681a73
+    exit 1
681a73
+  fi
681a73
+done
681a73
 
681a73
-#Run checks to make sure the programs we need are installed.
681a73
-LSPCI=$(which lspci 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null);
681a73
-TPUT=$(which tput 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null);
681a73
+# Run checks to make sure the programs we need are installed.
681a73
+LSPCI=$(which lspci 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
681a73
+TPUT=$(which tput 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
681a73
 DIALOG=$(which dialog 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null);
681a73
 
681a73
-#Check to see if sysfs is enabled in the kernel. We'll need this later on
681a73
-SYSFS=$(mount |grep sysfs|awk {'print $3'});
681a73
+# Check to see if sysfs is enabled in the kernel. We'll need this later on
681a73
+SYSFS=$(mount | grep sysfs | awk '{ print $3 }');
681a73
 
681a73
-#Check modprobe config files for sound related options
681a73
+# Check modprobe config files for sound related options
681a73
 SNDOPTIONS=$(modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p')
681a73
 
681a73
 KEEP_OUTPUT=
681a73
@@ -386,11 +387,11 @@ else
681a73
 fi # dialog
681a73
 fi # WELCOME
681a73
 
681a73
-#Set the output file
681a73
-TEMPDIR=`mktemp -t -d alsa-info.XXXXXXXXXX` || exit 1
681a73
+# Set the output file
681a73
+TEMPDIR=$(mktemp -t -d alsa-info.XXXXXXXXXX) || exit 1
681a73
 FILE="$TEMPDIR/alsa-info.txt"
681a73
 if [ -z "$NFILE" ]; then
681a73
-	NFILE=`mktemp -t alsa-info.txt.XXXXXXXXXX` || exit 1
681a73
+	NFILE=$(mktemp -t alsa-info.txt.XXXXXXXXXX) || exit 1
681a73
 fi
681a73
 
681a73
 trap cleanup 0
681a73
@@ -404,17 +405,17 @@ if [ -z "$LSPCI" ]; then
681a73
 	fi
681a73
 fi
681a73
 
681a73
-#Fetch the info and store in temp files/variables
681a73
-DISTRO=`grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus" /etc/{issue,*release,*version}`
681a73
-KERNEL_VERSION=`uname -r`
681a73
-KERNEL_PROCESSOR=`uname -p`
681a73
-KERNEL_MACHINE=`uname -m`
681a73
-KERNEL_OS=`uname -o`
681a73
-[[ `uname -v | grep SMP`  ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No" 
681a73
-ALSA_DRIVER_VERSION=`cat /proc/asound/version |head -n1|awk {'print $7'} |sed 's/\.$//'`
681a73
+# Fetch the info and store in temp files/variables
681a73
+TSTAMP=$(LANG=C TZ=UTC date)
681a73
+DISTRO=$(grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus" /etc/{issue,*release,*version})
681a73
+KERNEL_VERSION=$(uname -r)
681a73
+KERNEL_PROCESSOR=$(uname -p)
681a73
+KERNEL_MACHINE=$(uname -m)
681a73
+KERNEL_OS=$(uname -o)
681a73
+[[ $(uname -v | grep SMP) ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No"
681a73
+ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//')
681a73
 get_alsa_library_version
681a73
-ALSA_UTILS_VERSION=`amixer -v |awk {'print $3'}`
681a73
-LAST_CARD=$((`grep "]: " /proc/asound/cards | wc -l` - 1 ))
681a73
+ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }')
681a73
 
681a73
 ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
681a73
 PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
681a73
@@ -451,10 +452,10 @@ if [ -d /sys/bus/acpi/devices ]; then
681a73
     done
681a73
 fi
681a73
 
681a73
-cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
681a73
-cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
681a73
+cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp
681a73
+cat /proc/asound/cards > $TEMPDIR/alsacards.tmp
681a73
 if [[ ! -z "$LSPCI" ]]; then
681a73
-lspci |grep -i "multi\|audio">$TEMPDIR/lspci.tmp
681a73
+  lspci | grep -i "multi\|audio">$TEMPDIR/lspci.tmp
681a73
 fi
681a73
 
681a73
 #Check for HDA-Intel cards codec#*
681a73
@@ -477,7 +478,7 @@ echo "!!################################" >> $FILE
681a73
 echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE
681a73
 echo "!!################################" >> $FILE
681a73
 echo "" >> $FILE
681a73
-echo "!!Script ran on: `LANG=C TZ=UTC date`" >> $FILE
681a73
+echo "!!Script ran on: $TSTAMP" >> $FILE
681a73
 echo "" >> $FILE
681a73
 echo "" >> $FILE
681a73
 echo "!!Linux Distribution" >> $FILE
681a73
@@ -531,35 +532,35 @@ echo "!!Sound Servers on this system" >> $FILE
681a73
 echo "!!----------------------------" >> $FILE
681a73
 echo "" >> $FILE
681a73
 if [[ -n $PAINST ]];then
681a73
-[[ `pgrep '^(.*/)?pulseaudio$'` ]] && PARUNNING="Yes" || PARUNNING="No"
681a73
+[[ $(pgrep '^(.*/)?pulseaudio$') ]] && PARUNNING="Yes" || PARUNNING="No"
681a73
 echo "Pulseaudio:" >> $FILE
681a73
 echo "      Installed - Yes ($PAINST)" >> $FILE
681a73
 echo "      Running - $PARUNNING" >> $FILE
681a73
 echo "" >> $FILE
681a73
 fi
681a73
 if [[ -n $ESDINST ]];then
681a73
-[[ `pgrep '^(.*/)?esd$'` ]] && ESDRUNNING="Yes" || ESDRUNNING="No"
681a73
+[[ $(pgrep '^(.*/)?esd$') ]] && ESDRUNNING="Yes" || ESDRUNNING="No"
681a73
 echo "ESound Daemon:" >> $FILE
681a73
 echo "      Installed - Yes ($ESDINST)" >> $FILE
681a73
 echo "      Running - $ESDRUNNING" >> $FILE
681a73
 echo "" >> $FILE
681a73
 fi
681a73
 if [[ -n $ARTSINST ]];then
681a73
-[[ `pgrep '^(.*/)?artsd$'` ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No"
681a73
+[[ $(pgrep '^(.*/)?artsd$') ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No"
681a73
 echo "aRts:" >> $FILE
681a73
 echo "      Installed - Yes ($ARTSINST)" >> $FILE
681a73
 echo "      Running - $ARTSRUNNING" >> $FILE
681a73
 echo "" >> $FILE
681a73
 fi
681a73
 if [[ -n $JACKINST ]];then
681a73
-[[ `pgrep '^(.*/)?jackd$'` ]] && JACKRUNNING="Yes" || JACKRUNNING="No"
681a73
+[[ $(pgrep '^(.*/)?jackd$') ]] && JACKRUNNING="Yes" || JACKRUNNING="No"
681a73
 echo "Jack:" >> $FILE
681a73
 echo "      Installed - Yes ($JACKINST)" >> $FILE
681a73
 echo "      Running - $JACKRUNNING" >> $FILE
681a73
 echo "" >> $FILE
681a73
 fi
681a73
 if [[ -n $ROARINST ]];then
681a73
-[[ `pgrep '^(.*/)?roard$'` ]] && ROARRUNNING="Yes" || ROARRUNNING="No"
681a73
+[[ $(pgrep '^(.*/)?roard$') ]] && ROARRUNNING="Yes" || ROARRUNNING="No"
681a73
 echo "RoarAudio:" >> $FILE
681a73
 echo "      Installed - Yes ($ROARINST)" >> $FILE
681a73
 echo "      Running - $ROARRUNNING" >> $FILE
681a73
@@ -602,20 +603,20 @@ echo "" >> $FILE
681a73
 echo "" >> $FILE
681a73
 fi
681a73
 
681a73
-if [ -d "$SYSFS" ]
681a73
-then
681a73
-echo "!!Loaded sound module options" >> $FILE
681a73
-echo "!!---------------------------" >> $FILE
681a73
-echo "" >> $FILE
681a73
-for mod in `cat /proc/asound/modules|awk {'print $2'}`;do
681a73
-echo "!!Module: $mod" >> $FILE
681a73
-for params in `echo $SYSFS/module/$mod/parameters/*`; do
681a73
-	echo -ne "\t";
681a73
-	echo "$params : `cat $params`" | sed 's:.*/::';
681a73
-done >> $FILE
681a73
-echo "" >> $FILE
681a73
-done
681a73
-echo "" >> $FILE
681a73
+if [ -d "$SYSFS" ]; then
681a73
+	echo "!!Loaded sound module options" >> $FILE
681a73
+	echo "!!---------------------------" >> $FILE
681a73
+	echo "" >> $FILE
681a73
+	for mod in $(cat /proc/asound/modules | awk '{ print $2 }'); do
681a73
+		echo "!!Module: $mod" >> $FILE
681a73
+		for params in $(echo $SYSFS/module/$mod/parameters/*); do
681a73
+			echo -ne "\t"
681a73
+			value=$(cat $params)
681a73
+			echo "$params : $value" | sed 's:.*/::'
681a73
+		done >> $FILE
681a73
+		echo "" >> $FILE
681a73
+	done
681a73
+	echo "" >> $FILE
681a73
 fi
681a73
 
681a73
 if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then
681a73
@@ -856,8 +857,8 @@ if [ "$UPLOAD" = "no" ]; then
681a73
 
681a73
 fi # UPLOAD
681a73
 
681a73
-#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt. 
681a73
-if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
681a73
+# Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it does not.
681a73
+if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ $(wget --help | grep post-file) ]]
681a73
 then
681a73
 
681a73
 if [[ -n $DIALOG ]]
681a73
@@ -882,7 +883,7 @@ fi
681a73
 dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 
681a73
 DIALOG_EXIT_CODE=$?
681a73
 if [ $DIALOG_EXIT_CODE = 0 ]; then
681a73
-	grep -v "alsa-info.txt" $FILE >$TEMPDIR/uploaded.txt
681a73
+	grep -v "alsa-info.txt" $FILE > $TEMPDIR/uploaded.txt
681a73
 	dialog --backtitle "$BGTITLE" --textbox $TEMPDIR/uploaded.txt 0 0
681a73
 fi
681a73
 
681a73
@@ -911,20 +912,20 @@ done
681a73
 echo -e "\b Done!"
681a73
 echo ""
681a73
 
681a73
-fi #dialog
681a73
+fi # dialog
681a73
 
681a73
-#See if tput is available, and use it if it is.	
681a73
+# See if tput is available, and use it if it is.
681a73
 if [ -n "$TPUT" ]; then
681a73
 	if [[ -z $PASTEBIN ]]; then
681a73
-		FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0`
681a73
+		FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0)
681a73
 	else
681a73
-		FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p';tput sgr0`
681a73
+		FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'; tput sgr0)
681a73
 	fi
681a73
 else
681a73
 	if [[ -z $PASTEBIN ]]; then
681a73
-		FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2`
681a73
+		FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2)
681a73
 	else
681a73
-		FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'`
681a73
+		FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p')
681a73
 	fi
681a73
 fi
681a73
 
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From cf2cc375020a2cd5038332f923d428c8e642b70a Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Tue, 12 Mar 2019 16:05:23 +0100
681a73
Subject: [PATCH 13/20] alsactl: simple coverity fix
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 alsactl/init_parse.c | 4 +++-
681a73
 1 file changed, 3 insertions(+), 1 deletion(-)
681a73
681a73
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
681a73
index f39d80e..562e674 100644
681a73
--- a/alsactl/init_parse.c
681a73
+++ b/alsactl/init_parse.c
681a73
@@ -1675,8 +1675,10 @@ static int parse(struct space *space, const char *filename)
681a73
 	linenum = 0;
681a73
 	linesize = 128;
681a73
 	line = malloc(linesize);
681a73
-	if (line == NULL)
681a73
+	if (line == NULL) {
681a73
+		file_unmap(buf, bufsize);
681a73
 		return -ENOMEM;
681a73
+	}
681a73
 	space->filename = filename;
681a73
 	while (!err && pos < bufsize && !space->quit) {
681a73
 		count = line_width(buf, bufsize, pos);
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 6dc4b1eab578bd4b6608a0118f170cf2f84e0680 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Tue, 12 Mar 2019 16:06:03 +0100
681a73
Subject: [PATCH 14/20] arecordmidi: simple coverity fix
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 seq/aplaymidi/arecordmidi.c | 2 +-
681a73
 1 file changed, 1 insertion(+), 1 deletion(-)
681a73
681a73
diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c
681a73
index c0d0569..f3db65e 100644
681a73
--- a/seq/aplaymidi/arecordmidi.c
681a73
+++ b/seq/aplaymidi/arecordmidi.c
681a73
@@ -631,7 +631,7 @@ static void write_file(void)
681a73
 	fwrite("MThd\0\0\0\6", 1, 8, file);
681a73
 	/* type 0 or 1 */
681a73
 	fputc(0, file);
681a73
-	fputc(used_tracks > 1, file);
681a73
+	fputc(used_tracks > 1 ? 1 : 0, file);
681a73
 	/* number of tracks */
681a73
 	fputc((used_tracks >> 8) & 0xff, file);
681a73
 	fputc(used_tracks & 0xff, file);
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From bc42704c96c02b138849be4af6c90b4755659b56 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Tue, 12 Mar 2019 16:14:50 +0100
681a73
Subject: [PATCH 15/20] aplay: fix the multiple open file descriptors for the
681a73
 raw capture
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 aplay/aplay.c | 18 +++++++-----------
681a73
 1 file changed, 7 insertions(+), 11 deletions(-)
681a73
681a73
diff --git a/aplay/aplay.c b/aplay/aplay.c
681a73
index efc1eb4..8bdf45b 100644
681a73
--- a/aplay/aplay.c
681a73
+++ b/aplay/aplay.c
681a73
@@ -2690,8 +2690,6 @@ static void end_voc(int fd)
681a73
 	bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
681a73
 	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
681a73
 		xwrite(fd, &bt, sizeof(VocBlockType));
681a73
-	if (fd != 1)
681a73
-		close(fd);
681a73
 }
681a73
 
681a73
 static void end_wave(int fd)
681a73
@@ -2712,8 +2710,6 @@ static void end_wave(int fd)
681a73
 		xwrite(fd, &rifflen, 4);
681a73
 	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
681a73
 		xwrite(fd, &cd, sizeof(WaveChunkHeader));
681a73
-	if (fd != 1)
681a73
-		close(fd);
681a73
 }
681a73
 
681a73
 static void end_au(int fd)
681a73
@@ -2725,8 +2721,6 @@ static void end_au(int fd)
681a73
 	ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount);
681a73
 	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
681a73
 		xwrite(fd, &ah.data_size, sizeof(ah.data_size));
681a73
-	if (fd != 1)
681a73
-		close(fd);
681a73
 }
681a73
 
681a73
 static void header(int rtype, char *name)
681a73
@@ -2938,7 +2932,7 @@ static void playback(char *name)
681a73
 		break;
681a73
         }
681a73
 
681a73
-	if (fd != 0)
681a73
+	if (fd != fileno(stdin))
681a73
 		close(fd);
681a73
 }
681a73
 
681a73
@@ -3151,7 +3145,7 @@ static void capture(char *orig_name)
681a73
 	if (!name || !strcmp(name, "-")) {
681a73
 		fd = fileno(stdout);
681a73
 		name = "stdout";
681a73
-		tostdout=1;
681a73
+		tostdout = 1;
681a73
 		if (count > fmt_rec_table[file_type].max_filesize)
681a73
 			count = fmt_rec_table[file_type].max_filesize;
681a73
 	}
681a73
@@ -3159,7 +3153,7 @@ static void capture(char *orig_name)
681a73
 
681a73
 	do {
681a73
 		/* open a file to write */
681a73
-		if(!tostdout) {
681a73
+		if (!tostdout) {
681a73
 			/* upon the second file we start the numbering scheme */
681a73
 			if (filecount || use_strftime) {
681a73
 				filecount = new_capture_file(orig_name, namebuf,
681a73
@@ -3218,8 +3212,10 @@ static void capture(char *orig_name)
681a73
 		}
681a73
 
681a73
 		/* finish sample container */
681a73
-		if (fmt_rec_table[file_type].end && !tostdout) {
681a73
-			fmt_rec_table[file_type].end(fd);
681a73
+		if (!tostdout) {
681a73
+			if (fmt_rec_table[file_type].end)
681a73
+				fmt_rec_table[file_type].end(fd);
681a73
+			close(fd);
681a73
 			fd = -1;
681a73
 		}
681a73
 
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 819e04c7a1958a1c4378d914b38bddaf248d9fc0 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Wed, 13 Mar 2019 14:19:12 +0100
681a73
Subject: [PATCH 16/20] axfer: coverity fixes
681a73
681a73
- container-voc.c - out of array access
681a73
- container-voc.c - handle correctly eof
681a73
- frame_cache.c - correct memory allocation
681a73
- container.c - byte_count might be used uninitialized
681a73
- xfer-libasound-irq-mmap.c - fix avail signess
681a73
- xfer-options.c - fix potential 32-bit wrap for duration
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 axfer/container-voc.c           | 32 +++++++++++++-----------
681a73
 axfer/container.c               |  2 +-
681a73
 axfer/frame-cache.c             | 44 +++++++++++++++++----------------
681a73
 axfer/xfer-libasound-irq-mmap.c |  2 +-
681a73
 axfer/xfer-options.c            |  2 +-
681a73
 5 files changed, 43 insertions(+), 39 deletions(-)
681a73
681a73
diff --git a/axfer/container-voc.c b/axfer/container-voc.c
681a73
index 92e9c83..6fa59c3 100644
681a73
--- a/axfer/container-voc.c
681a73
+++ b/axfer/container-voc.c
681a73
@@ -234,7 +234,7 @@ static int build_time_constant(unsigned int frames_per_second,
681a73
 					frames_per_second)
681a73
 				break;
681a73
 		}
681a73
-		if (i < ARRAY_SIZE(ex_v110_time_consts) ||
681a73
+		if (i < ARRAY_SIZE(ex_v110_time_consts) &&
681a73
 		    frames_per_second <= 192000) {
681a73
 			*code = ex_v110_time_consts[i].code;
681a73
 		} else {
681a73
@@ -520,29 +520,31 @@ static int detect_format_block(struct container_context *cntr)
681a73
 {
681a73
 	struct parser_state *state = cntr->private_data;
681a73
 	struct block_header header;
681a73
-	void *buf = NULL;
681a73
+	void *buf;
681a73
 	int err;
681a73
 
681a73
 again:
681a73
+	buf = NULL;
681a73
 	err = cache_data_block(cntr, &header, &buf;;
681a73
 	if (err < 0)
681a73
 		return err;
681a73
+	if (buf) {
681a73
+		if (header.type == BLOCK_TYPE_EXTENDED_V110_FORMAT) {
681a73
+			err = parse_extended_v110_format(state, buf);
681a73
+		} else if (header.type == BLOCK_TYPE_V120_DATA) {
681a73
+			err = parse_v120_format_block(state, buf);
681a73
+		} else if (header.type == BLOCK_TYPE_V110_DATA) {
681a73
+			err = parse_v110_data(state, buf);
681a73
+		} else {
681a73
+			free(buf);
681a73
+			goto again;
681a73
+		}
681a73
 
681a73
-	if (header.type == BLOCK_TYPE_EXTENDED_V110_FORMAT) {
681a73
-		err = parse_extended_v110_format(state, buf);
681a73
-	} else if (header.type == BLOCK_TYPE_V120_DATA) {
681a73
-		err = parse_v120_format_block(state, buf);
681a73
-	} else if (header.type == BLOCK_TYPE_V110_DATA) {
681a73
-		err = parse_v110_data(state, buf);
681a73
-	} else {
681a73
 		free(buf);
681a73
-		goto again;
681a73
-	}
681a73
-
681a73
-	free(buf);
681a73
 
681a73
-	if (err < 0)
681a73
-		return err;
681a73
+		if (err < 0)
681a73
+			return err;
681a73
+	}
681a73
 
681a73
 	// Expect to detect block_v110_data.
681a73
 	if (header.type == BLOCK_TYPE_EXTENDED_V110_FORMAT)
681a73
diff --git a/axfer/container.c b/axfer/container.c
681a73
index 6b0e42e..7da97c6 100644
681a73
--- a/axfer/container.c
681a73
+++ b/axfer/container.c
681a73
@@ -296,7 +296,7 @@ int container_context_pre_process(struct container_context *cntr,
681a73
 				  unsigned int *frames_per_second,
681a73
 				  uint64_t *frame_count)
681a73
 {
681a73
-	uint64_t byte_count;
681a73
+	uint64_t byte_count = 0;
681a73
 	unsigned int bytes_per_frame;
681a73
 	int err;
681a73
 
681a73
diff --git a/axfer/frame-cache.c b/axfer/frame-cache.c
681a73
index 882568f..417c1e6 100644
681a73
--- a/axfer/frame-cache.c
681a73
+++ b/axfer/frame-cache.c
681a73
@@ -50,13 +50,18 @@ int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access,
681a73
 		     unsigned int samples_per_frame,
681a73
 		     unsigned int frames_per_cache)
681a73
 {
681a73
+	cache->access = access;
681a73
+	cache->remained_count = 0;
681a73
+	cache->bytes_per_sample = bytes_per_sample;
681a73
+	cache->samples_per_frame = samples_per_frame;
681a73
+	cache->frames_per_cache = frames_per_cache;
681a73
+
681a73
 	if (access == SND_PCM_ACCESS_RW_INTERLEAVED)
681a73
 		cache->align_frames = align_frames_in_i;
681a73
 	else if (access == SND_PCM_ACCESS_RW_NONINTERLEAVED)
681a73
 		cache->align_frames = align_frames_in_n;
681a73
 	else
681a73
 		return -EINVAL;
681a73
-	cache->access = access;
681a73
 
681a73
 	if (access == SND_PCM_ACCESS_RW_INTERLEAVED) {
681a73
 		char *buf;
681a73
@@ -64,45 +69,42 @@ int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access,
681a73
 		buf = calloc(frames_per_cache,
681a73
 			     bytes_per_sample * samples_per_frame);
681a73
 		if (buf == NULL)
681a73
-			return -ENOMEM;
681a73
+			goto nomem;
681a73
 		cache->buf = buf;
681a73
 		cache->buf_ptr = buf;
681a73
 	} else {
681a73
-		char **bufs;
681a73
-		char **buf_ptrs;
681a73
+		char **bufs = calloc(samples_per_frame, sizeof(*bufs));
681a73
+		char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs));
681a73
 		int i;
681a73
 
681a73
-		bufs = calloc(samples_per_frame, sizeof(*bufs));
681a73
-		if (bufs == NULL)
681a73
-			return -ENOMEM;
681a73
-		buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs));
681a73
-		if (buf_ptrs == NULL)
681a73
-			return -ENOMEM;
681a73
+		cache->buf = bufs;
681a73
+		cache->buf_ptr = buf_ptrs;
681a73
+		if (bufs == NULL || buf_ptrs == NULL)
681a73
+			goto nomem;
681a73
 		for (i = 0; i < samples_per_frame; ++i) {
681a73
 			bufs[i] = calloc(frames_per_cache, bytes_per_sample);
681a73
 			if (bufs[i] == NULL)
681a73
-				return -ENOMEM;
681a73
+				goto nomem;
681a73
 			buf_ptrs[i] = bufs[i];
681a73
 		}
681a73
-		cache->buf = bufs;
681a73
-		cache->buf_ptr = buf_ptrs;
681a73
 	}
681a73
 
681a73
-	cache->remained_count = 0;
681a73
-	cache->bytes_per_sample = bytes_per_sample;
681a73
-	cache->samples_per_frame = samples_per_frame;
681a73
-	cache->frames_per_cache = frames_per_cache;
681a73
 
681a73
 	return 0;
681a73
+
681a73
+nomem:
681a73
+	frame_cache_destroy(cache);
681a73
+	return -ENOMEM;
681a73
 }
681a73
 
681a73
 void frame_cache_destroy(struct frame_cache *cache)
681a73
 {
681a73
 	if (cache->access == SND_PCM_ACCESS_RW_NONINTERLEAVED) {
681a73
-		int i;
681a73
-		for (i = 0; i < cache->samples_per_frame; ++i) {
681a73
-			char **bufs = cache->buf;
681a73
-			free(bufs[i]);
681a73
+		char **bufs = cache->buf;
681a73
+		if (bufs) {
681a73
+			int i;
681a73
+			for (i = 0; i < cache->samples_per_frame; ++i)
681a73
+				free(bufs[i]);
681a73
 		}
681a73
 		free(cache->buf_ptr);
681a73
 	}
681a73
diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c
681a73
index 0c96ee5..0fbbcc6 100644
681a73
--- a/axfer/xfer-libasound-irq-mmap.c
681a73
+++ b/axfer/xfer-libasound-irq-mmap.c
681a73
@@ -75,7 +75,7 @@ static int irq_mmap_process_frames(struct libasound_state *state,
681a73
 	struct map_layout *layout = state->private_data;
681a73
 	const snd_pcm_channel_area_t *areas;
681a73
 	snd_pcm_uframes_t frame_offset;
681a73
-	snd_pcm_uframes_t avail;
681a73
+	snd_pcm_sframes_t avail;
681a73
 	unsigned int avail_count;
681a73
 	void *frame_buf;
681a73
 	snd_pcm_sframes_t consumed_count;
681a73
diff --git a/axfer/xfer-options.c b/axfer/xfer-options.c
681a73
index 8394d8a..2713027 100644
681a73
--- a/axfer/xfer-options.c
681a73
+++ b/axfer/xfer-options.c
681a73
@@ -395,7 +395,7 @@ void xfer_options_calculate_duration(struct xfer_context *xfer,
681a73
 	uint64_t frame_count;
681a73
 
681a73
 	if (xfer->duration_seconds > 0) {
681a73
-		frame_count = xfer->duration_seconds * xfer->frames_per_second;
681a73
+		frame_count = (uint64_t)xfer->duration_seconds * (uint64_t)xfer->frames_per_second;
681a73
 		if (frame_count < *total_frame_count)
681a73
 			*total_frame_count = frame_count;
681a73
 	}
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 9b6c5e2d5c3119dbb79fc70ac8355424a8893ed0 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Wed, 13 Mar 2019 14:22:22 +0100
681a73
Subject: [PATCH 17/20] aplay: check the return value for
681a73
 snd_pcm_sw_params_current() (coverity)
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 aplay/aplay.c | 6 +++++-
681a73
 1 file changed, 5 insertions(+), 1 deletion(-)
681a73
681a73
diff --git a/aplay/aplay.c b/aplay/aplay.c
681a73
index 8bdf45b..5b3a766 100644
681a73
--- a/aplay/aplay.c
681a73
+++ b/aplay/aplay.c
681a73
@@ -1411,7 +1411,11 @@ static void set_params(void)
681a73
 		      chunk_size, buffer_size);
681a73
 		prg_exit(EXIT_FAILURE);
681a73
 	}
681a73
-	snd_pcm_sw_params_current(handle, swparams);
681a73
+	err = snd_pcm_sw_params_current(handle, swparams);
681a73
+	if (err < 0) {
681a73
+		error(_("Unable to get current sw params."));
681a73
+		prg_exit(EXIT_FAILURE);
681a73
+	}
681a73
 	if (avail_min < 0)
681a73
 		n = chunk_size;
681a73
 	else
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 8c026b9562dbdfc222bcd637dfb85b85f4e95412 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Wed, 13 Mar 2019 14:31:57 +0100
681a73
Subject: [PATCH 18/20] alsactl: monitor - remove dead code in run_dispatcher()
681a73
 (coverity)
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 alsactl/monitor.c | 2 --
681a73
 1 file changed, 2 deletions(-)
681a73
681a73
diff --git a/alsactl/monitor.c b/alsactl/monitor.c
681a73
index 282fb1c..6b090e4 100644
681a73
--- a/alsactl/monitor.c
681a73
+++ b/alsactl/monitor.c
681a73
@@ -369,8 +369,6 @@ static int run_dispatcher(int epfd, int sigfd, int infd, struct list_head *srcs,
681a73
 				remove_source_entry(entry);
681a73
 			}
681a73
 		}
681a73
-		if (err < 0)
681a73
-			break;
681a73
 	}
681a73
 end:
681a73
 	free(epev);
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 8dcc3a1391ade9f714143038cf6f816fad1cc2df Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Wed, 13 Mar 2019 14:47:23 +0100
681a73
Subject: [PATCH 19/20] alsaloop: remove unused assignment warning (coverity)
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 alsaloop/pcmjob.c | 2 +-
681a73
 1 file changed, 1 insertion(+), 1 deletion(-)
681a73
681a73
diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c
681a73
index 4c9517b..29d1aba 100644
681a73
--- a/alsaloop/pcmjob.c
681a73
+++ b/alsaloop/pcmjob.c
681a73
@@ -293,7 +293,7 @@ static int increase_playback_avail_min(struct loopback_handle *lhandle)
681a73
 		/* avoid 100% CPU usage for broken plugins */
681a73
 		ts.tv_sec = 0;
681a73
 		ts.tv_nsec = 10000;
681a73
-		err = nanosleep(&ts, NULL);
681a73
+		nanosleep(&ts, NULL);
681a73
 		return 0;
681a73
 	}
681a73
 	snd_pcm_sw_params_alloca(&swparams);
681a73
-- 
681a73
2.20.1
681a73
681a73
681a73
From 30f9a14a7964c650fb6b2b559d6fc879844b21b4 Mon Sep 17 00:00:00 2001
681a73
From: Jaroslav Kysela <perex@perex.cz>
681a73
Date: Wed, 13 Mar 2019 14:51:12 +0100
681a73
Subject: [PATCH 20/20] axfer: return back unsigned avail variable, do proper
681a73
 retype in xfer-libasound-irq-mmap.c
681a73
681a73
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
681a73
---
681a73
 axfer/xfer-libasound-irq-mmap.c | 4 ++--
681a73
 1 file changed, 2 insertions(+), 2 deletions(-)
681a73
681a73
diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c
681a73
index 0fbbcc6..71ee79f 100644
681a73
--- a/axfer/xfer-libasound-irq-mmap.c
681a73
+++ b/axfer/xfer-libasound-irq-mmap.c
681a73
@@ -75,7 +75,7 @@ static int irq_mmap_process_frames(struct libasound_state *state,
681a73
 	struct map_layout *layout = state->private_data;
681a73
 	const snd_pcm_channel_area_t *areas;
681a73
 	snd_pcm_uframes_t frame_offset;
681a73
-	snd_pcm_sframes_t avail;
681a73
+	snd_pcm_uframes_t avail;
681a73
 	unsigned int avail_count;
681a73
 	void *frame_buf;
681a73
 	snd_pcm_sframes_t consumed_count;
681a73
@@ -110,7 +110,7 @@ static int irq_mmap_process_frames(struct libasound_state *state,
681a73
 	// MEMO: either snd_pcm_avail_update() and snd_pcm_mmap_begin() can
681a73
 	// return the same number of available frames.
681a73
 	avail = snd_pcm_avail_update(state->handle);
681a73
-	if (avail < 0)
681a73
+	if ((snd_pcm_sframes_t)avail < 0)
681a73
 		return (int)avail;
681a73
 	if (*frame_count < avail)
681a73
 		avail = *frame_count;
681a73
-- 
681a73
2.20.1
681a73