[alsa-devel] [PATCH 2/2] caiaq/NativeInstruments: control support

Takashi Iwai tiwai at suse.de
Wed Nov 21 11:01:54 CET 2007


At Tue, 20 Nov 2007 14:37:46 +0100,
Daniel Mack wrote:
> 
> --- /dev/null
> +++ b/sound/usb/caiaq/caiaq-control.c
(snip)
> +#ifdef CONFIG_SND_USB_CAIAQ_INPUT
> +#include <linux/input.h>
> +#endif

Do you really need ifdef here?

> +static int control_put(struct snd_kcontrol *kcontrol,
> +		       struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
> +	struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
> +	int pos = kcontrol->private_value;
> +
> +	if (pos & CNT_INTVAL) {
> +		dev->control_state[pos & ~CNT_INTVAL] 
> +			= ucontrol->value.integer.value[0];
> +		snd_usb_caiaq_send_command(dev, EP1_CMD_DIMM_LEDS,
> +				dev->control_state, sizeof(dev->control_state));
> +	} else {
> +		if (ucontrol->value.integer.value[0])
> +			dev->control_state[pos / 8] |= 1 << (pos % 8);
> +		else
> +			dev->control_state[pos / 8] &= ~(1 << (pos % 8));
> +	
> +		snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
> +				dev->control_state, sizeof(dev->control_state));
> +	}
> +	
> +
> +	return 0;
> +}

The put callback is supposed to return 1 if a value is changed.
It's no strict requirement, so far, but if this still doesn't follow
put a comment like FIXME. 

> +/*
> + *
> + * 0
> + * 1 << 1
> + * 1 << 0 | 1 << 1
> + * 1 << 0 | 1 << 1 | 1 << 2
> + * 1 << 0
> + * 0
> + *
> + */

What's this? :)


thanks,

Takashi


More information about the Alsa-devel mailing list