Skip to contentSkip to conversation

snd-usb-caiaq: Send the correct command when setting controls

PATCH Applied Mark Hills 2 participants 6 messages Feb 4, 2009 – Feb 5, 2009

lore
Share & tools
lore

Mark Hills

author
#0 lore raw

PATCH 1/5 snd-usb-caiaq: Send the correct command when setting controls

Fixes a bug where an incorrect command was sent which had no effect on the device.

---
 usb/caiaq/caiaq-control.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
usb/caiaq/caiaq-control.c +1 -1
index 6ac5489..1f9531d 100644
@@ -94,7 +94,7 @@ static int control_put(struct snd_kcontrol *kcontrol,
 	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,
+		snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
 				dev->control_state, sizeof(dev->control_state));
 	} else {
 		if (ucontrol->value.integer.value[0])
Signature · 1 line
1.6.1.2
author
#1 lore raw

PATCH 2/5 snd-usb-caiaq: Set default input mode of A4DJ

Do not start the device with input mode undefined. Mimic the behaviour of the Audio 8 DJ and start in phono input mode.

---
 usb/caiaq/caiaq-device.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
usb/caiaq/caiaq-device.c +6 -0
index 2464614..769321d 100644
@@ -312,6 +312,12 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
 		}
 
 		break;
+	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
+		/* Audio 4 DJ - default input mode to phono */
+		dev->control_state[0] = 2;
+		snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
+			dev->control_state, 1);
+		break;
 	}
 	
 	if (dev->spec.num_analog_audio_out +
Signature · 1 line
1.6.1.2
author
#2 lore raw

PATCH 3/5 snd-usb-caiaq: Do not expose hardware input mode 0 of A4DJ

In the context of the Audio 4 DJ (when compared to Audio 8 DJ), hardware input mode 0 is not used. Expose modes 1 (line) and 2 (phono) to the user as modes 0 and 1 respectively.

---
 usb/caiaq/caiaq-control.c |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)
usb/caiaq/caiaq-control.c +29 -3
index 1f9531d..136ef34 100644
@@ -44,16 +44,24 @@ static int control_info(struct snd_kcontrol *kcontrol,
 	uinfo->count = 1;
 	pos &= ~CNT_INTVAL;
 
-	if (((id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) ||
-	     (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)))
+	if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)
 		&& (pos == 0)) {
-		/* current input mode of A8DJ and A4DJ */
+		/* current input mode of A8DJ */
 		uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
 		uinfo->value.integer.min = 0;
 		uinfo->value.integer.max = 2;
 		return 0;
 	}
 
+	if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)
+		&& (pos == 0)) {
+		/* current input mode of A4DJ */
+		uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+		uinfo->value.integer.min = 0;
+		uinfo->value.integer.max = 1;
+		return 0;
+	}
+
 	if (is_intval) {
 		uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
 		uinfo->value.integer.min = 0;
@@ -74,6 +82,14 @@ static int control_get(struct snd_kcontrol *kcontrol,
 	struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
 	int pos = kcontrol->private_value;
 
+	if (dev->chip.usb_id ==
+		USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) {
+		/* A4DJ has only one control */
+		/* do not expose hardware input mode 0 */
+		ucontrol->value.integer.value[0] = dev->control_state[0] - 1;
+		return 0;
+	}
+
 	if (pos & CNT_INTVAL)
 		ucontrol->value.integer.value[0]
 			= dev->control_state[pos & ~CNT_INTVAL];
@@ -91,6 +107,16 @@ static int control_put(struct snd_kcontrol *kcontrol,
 	struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
 	int pos = kcontrol->private_value;
 
+	if (dev->chip.usb_id ==
+		USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) {
+		/* A4DJ has only one control */
+		/* do not expose hardware input mode 0 */
+		dev->control_state[0] = ucontrol->value.integer.value[0] + 1;
+		snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
+				dev->control_state, sizeof(dev->control_state));
+		return 1;
+	}
+
 	if (pos & CNT_INTVAL) {
 		dev->control_state[pos & ~CNT_INTVAL]
 			= ucontrol->value.integer.value[0];
Signature · 1 line
1.6.1.2
author
#3 lore raw

PATCH 4/5 snd-usb-caiaq: Remove duplicate A8DJ control

Remove a duplicate control which causes an error when it is registered, and causes later controls to not be registered. The device does not have a fourth ground lift control.

---
 usb/caiaq/caiaq-control.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
usb/caiaq/caiaq-control.c +0 -1
index 136ef34..e92c2bb 100644
@@ -270,7 +270,6 @@ static struct caiaq_controller a8dj_controller[] = {
 	{ "GND lift for TC Vinyl mode", 	24 + 0 		},
 	{ "GND lift for TC CD/Line mode", 	24 + 1 		},
 	{ "GND lift for phono mode", 		24 + 2 		},
-	{ "GND lift for TC Vinyl mode", 	24 + 3 		},
 	{ "Software lock", 			40 		}
 };
 
Signature · 1 line
1.6.1.2
author
#4 lore raw

PATCH 5/5 snd-usb-caiaq: Increase version number to 1.3.12

Indicates fixes affecting control messages and switching of input mode on Audio 8 DJ and Audio 4 DJ.

---
 usb/caiaq/caiaq-device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
usb/caiaq/caiaq-device.c +1 -1
index 769321d..5cf841e 100644
@@ -42,7 +42,7 @@
 #endif
 
 MODULE_AUTHOR("Daniel Mack <[email protected]>");
-MODULE_DESCRIPTION("caiaq USB audio, version 1.3.11");
+MODULE_DESCRIPTION("caiaq USB audio, version 1.3.12");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
 			 "{Native Instruments, RigKontrol3},"
Signature · 1 line
1.6.1.2