It may be possible that the controls are quickly added and
removed, thus the "hard" fail is not optimal here.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Add missing channel params to the amixer man page. Also call out that
the channel param must come before the value to take effect.
signed-off-by: Matthew Campbell <mcampbell@izotope.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In commit "ae9ddeb63443cc2c46e0f0b915466cca0f800372" the rint() was
changed to ceil(). Revert it back. The rint() rounding is more precise
for most cases.
Also, handle the special case where the percentual value is greather
then zero. Set the min + 1 value in this case.
At last, fix the return value in convert_prange() when range is zero.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The `L` length modifier only applies to floating-point conversion
specifiers, and `ll` is used for `long long` integers.
Although glibc accepts %Li, musl does not and returns EINVAL.
Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Get rid of a warning about implicit declaration of exp10, which is
behind _GNU_SOURCE as a non-standard feature. The same problem was fixed
for alsamixer in commit 116488e5f2.
Signed-off-by: Milton Vandersloot <miltonvandersloot@fake-box.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ASoC TLV Byte controls are very large size controls so we should add new
options for these. So skip dumping contents for these.
$amixer -c0 cget numid=16
numid=16,iface=MIXER,name='mdl params'
; type=BYTES,access=-----RW-,values=30336
; ASoC TLV Byte control, skipping bytes dump
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
According to kernel code (snd_ctl_elem_init_enum_names() in
sound/core/control.c), the maximum length of item name is 63 characters
(+ 1 terminator = 64 bytes). But current amixer implementation
uses 40 bytes. This causes name truncation and fail to operation.
This commit fixes this bug by expanding the length of local variables.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So far amixer allows some unexpected suffix and assumes as a raw
absolute value without returning an error. This is rather dangerous,
e.g. user might not notice that a completely wrong value was set when
the command line included a typo.
This patch makes the parser a bit more strict: it doesn't allow any
longer invalid suffixes, instead either returns an error or skips the
invalid value, depending on the operation mode.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
decode_tlv() adds indentation in the beginning, with the expectation
that the TLV will be printed on the line afterwards in a switch-case.
However, in the case of a container TLV the switch-case simply adds
another level of indentation and calls decode_tlv() for the inner TLVs.
This causes the first inner TLV to be printed with too much indentation
and double '|'.
Fix that by printing "container" and a newline for container TLVs, so
that the result is as follows:
: values=0,0,0,0,0,0,0,0
| container
| chmap-variable=FL,FR
| chmap-variable=FL,FR,LFE
| chmap-variable=FL,FR,FC
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Due to a wrong indexing of tlv[] decode_tlv() always skips to the end of
the container TLV since the used tlv[1] contains the container TLV size
instead of the intended element size.
This causes, for example, only the first HDMI channel map TLV to be
shown.
Fix the indexing to actually use the element size.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Previously these were written as "unk-25..." which wasn't very user friendly.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The first number is 0 when input dB (hundreds) is in range -99 .. -1 .
The printed number was positive in this case. This patch fixes this issue.
Reported-by: Tom Becker <GTBecker@RighTime.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fix many occurrences of unescaped “-”.
Fix minor English issue.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix the wrong calculation of the size of a container TLV entry, which
resulted in "TLV size error" messages.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When doing control changes by a relative amount, amixer used the wrong
rounding direction, which would make it possible to stay at the same raw
value if the step was not big enough to reach the next value.
Reported-by: Honza Javorek <jan.javorek@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
When -M option is given, amixer handles the volumes in percent unit
with the mapping more intuitive to human ears just like in alsamixer.
The -R option is to take the raw value as the volume percentage.
This mode is still used as default.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Current support for handling SND_CTL_TLVT_DB_RANGE in amixer is completely
broken. This patch fixes it.
Reported-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When an element is marked as not readble, do not try to read it and then
complain about the error, but just ignore it.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.
The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
This way the compiler can assume more information about their
interface for optimisation.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
cset accepts only integer values as indices, so far, but it's a bit
unfriendly. Now it accepts the item name as a string argument, too.
The index can be given using numbers as fallback.
The item names with channel specifier cannot be chosen correctly
via amixer sset. For example, 'Front Mic' is handled as 'Mic' since
the channel specificier 'Front' is omitted.
The idea of channel specifier is basically non-sense for enum items,
and this also makes the code very messy.
The patch fixes the behavior of enum items and gives the code clean-up
for sset command.