All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] alsactl: skip inactive controls
@ 2007-12-15 19:13 Dave Dillow
  2007-12-17  9:24 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Dillow @ 2007-12-15 19:13 UTC (permalink / raw)
  To: alsa-devel

When using alsactl to save or restore the card settings, it currently
skips over controls that don't have the appropriate read/write
permissions. It should also skip over inactive controls, otherwise it
will get an error when it tries to access that control, and will fail to
save the card state (or fully restore it.)
---
I noticed this while adding surround support to SiS7019. I think the
problem affects other cards, as I am following the pattern used by
trident, rme*, cmipci,  emu10k1 and others.

This is only for discussion, since I've not tested this (nor even
compiled it) but I think it will fix the issue.

diff -r d3ba62cd2776 alsactl/state.c
--- a/alsactl/state.c	Fri Dec 14 15:29:51 2007 +0100
+++ b/alsactl/state.c	Sat Dec 15 14:06:35 2007 -0500
@@ -250,7 +250,8 @@ static int get_control(snd_ctl_t *handle
 		return err;
 	}
 
-	if (!snd_ctl_elem_info_is_readable(info))
+	if (snd_ctl_elem_info_is_inactive(info) ||
+				!snd_ctl_elem_info_is_readable(info))
 		return 0;
 	snd_ctl_elem_value_set_id(ctl, id);
 	err = snd_ctl_elem_read(handle, ctl);
@@ -1306,7 +1307,8 @@ static int set_control(snd_ctl_t *handle
 		}
 	}
 
-	if (!snd_ctl_elem_info_is_writable(info))
+	if (snd_ctl_elem_info_is_inactive(info) ||
+				!snd_ctl_elem_info_is_writable(info))
 		return 0;
 	snd_ctl_elem_value_set_numid(ctl, numid1);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] alsactl: skip inactive controls
  2007-12-15 19:13 [RFC PATCH] alsactl: skip inactive controls Dave Dillow
@ 2007-12-17  9:24 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2007-12-17  9:24 UTC (permalink / raw)
  To: Dave Dillow; +Cc: alsa-devel

At Sat, 15 Dec 2007 14:13:41 -0500,
Dave Dillow wrote:
> 
> When using alsactl to save or restore the card settings, it currently
> skips over controls that don't have the appropriate read/write
> permissions. It should also skip over inactive controls, otherwise it
> will get an error when it tries to access that control, and will fail to
> save the card state (or fully restore it.)
> ---
> I noticed this while adding surround support to SiS7019. I think the
> problem affects other cards, as I am following the pattern used by
> trident, rme*, cmipci,  emu10k1 and others.
> 
> This is only for discussion, since I've not tested this (nor even
> compiled it) but I think it will fix the issue.

This is obviously a right fix.  I applied it to HG tree now.
Thanks.


Takashi

> 
> diff -r d3ba62cd2776 alsactl/state.c
> --- a/alsactl/state.c	Fri Dec 14 15:29:51 2007 +0100
> +++ b/alsactl/state.c	Sat Dec 15 14:06:35 2007 -0500
> @@ -250,7 +250,8 @@ static int get_control(snd_ctl_t *handle
>  		return err;
>  	}
>  
> -	if (!snd_ctl_elem_info_is_readable(info))
> +	if (snd_ctl_elem_info_is_inactive(info) ||
> +				!snd_ctl_elem_info_is_readable(info))
>  		return 0;
>  	snd_ctl_elem_value_set_id(ctl, id);
>  	err = snd_ctl_elem_read(handle, ctl);
> @@ -1306,7 +1307,8 @@ static int set_control(snd_ctl_t *handle
>  		}
>  	}
>  
> -	if (!snd_ctl_elem_info_is_writable(info))
> +	if (snd_ctl_elem_info_is_inactive(info) ||
> +				!snd_ctl_elem_info_is_writable(info))
>  		return 0;
>  	snd_ctl_elem_value_set_numid(ctl, numid1);
>  
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-17 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-15 19:13 [RFC PATCH] alsactl: skip inactive controls Dave Dillow
2007-12-17  9:24 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.