diff mbox

[v3] amixer: skip showing asoc tlv byte controls

Message ID 1453965966-27661-1-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul Jan. 28, 2016, 7:26 a.m. UTC
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>
---
 amixer/amixer.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Takashi Iwai Jan. 28, 2016, 7:29 a.m. UTC | #1
On Thu, 28 Jan 2016 08:26:06 +0100,
Vinod Koul wrote:
> 
> 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

Use semicolon instead.


Takashi

> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  amixer/amixer.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index db1849333da3..e059c176f958 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -682,6 +682,14 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
>  	      __skip_read:
>  		if (!snd_ctl_elem_info_is_tlv_readable(info))
>  			goto __skip_tlv;
> +		/* skip ASoC ext bytes controls that may have huge binary TLV data */
> +		if (type == SND_CTL_ELEM_TYPE_BYTES &&
> +				!snd_ctl_elem_info_is_readable(info) &&
> +				!snd_ctl_elem_info_is_writable(info)) {
> +			printf("%s: ASoC TLV Byte control, skipping bytes dump\n", space);
> +			goto __skip_tlv;
> +		}
> +
>  		tlv = malloc(4096);
>  		if ((err = snd_hctl_elem_tlv_read(elem, tlv, 4096)) < 0) {
>  			error("Control %s element TLV read error: %s\n", card, snd_strerror(err));
> -- 
> 1.9.1
>
Vinod Koul Jan. 28, 2016, 8:24 a.m. UTC | #2
On Thu, Jan 28, 2016 at 08:29:57AM +0100, Takashi Iwai wrote:
> On Thu, 28 Jan 2016 08:26:06 +0100,
> Vinod Koul wrote:
> > 
> > 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
> 
> Use semicolon instead.

Sure, I tried to use the existing style, what is the interpretation of
these?
diff mbox

Patch

diff --git a/amixer/amixer.c b/amixer/amixer.c
index db1849333da3..e059c176f958 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -682,6 +682,14 @@  static int show_control(const char *space, snd_hctl_elem_t *elem,
 	      __skip_read:
 		if (!snd_ctl_elem_info_is_tlv_readable(info))
 			goto __skip_tlv;
+		/* skip ASoC ext bytes controls that may have huge binary TLV data */
+		if (type == SND_CTL_ELEM_TYPE_BYTES &&
+				!snd_ctl_elem_info_is_readable(info) &&
+				!snd_ctl_elem_info_is_writable(info)) {
+			printf("%s: ASoC TLV Byte control, skipping bytes dump\n", space);
+			goto __skip_tlv;
+		}
+
 		tlv = malloc(4096);
 		if ((err = snd_hctl_elem_tlv_read(elem, tlv, 4096)) < 0) {
 			error("Control %s element TLV read error: %s\n", card, snd_strerror(err));