Skip to contentSkip to conversation

Support for Power/Status LED on Creative USB X-Fi S51

PATCH In review [email protected] 3 participants 6 messages Nov 2, 2010 – Feb 13, 2011 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support for Power/Status LED on Creative USB X-Fi S51

From: Mandar Joshi <[email protected]>

This patch adds support for Power/Status LED on Creative USB X-Fi S51.
There is just one LED on the device. The LED can either be On or it can be set to Blink. There doesn't seem to be a way to switch it off.
The control message to change LED status is similar to that of audigy2nx except that the index is to be set to 0 and value is 1 for Blink and 0 for On.
The 'Power LED' control in alsamixer when muted will cause the LED to Blink continuously. When unmuted the LED will stay On. The Creative driver under Windows sets the LED to blink whenever audio is muted. This LED can be treated as the CMSS LED but I figured since there is just one LED, it should be treated as the Power LED. Is that alright?
I've also changed the comment "Usb X-Fi" to "Usb X-Fi S51" as there are other external X-Fi devices from Creative like Usb X-Fi Go and Xmod. The volume knob and LED support patch doesn't apply to them.

sound/usb/mixer_quirks.c +16 -4
index e7df1e5..aea92d6 100644
@@ -60,6 +60,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3000), 0, 1, 2, 1,  18, 0x0013 }, /* Extigy       */
 	{ USB_ID(0x041e, 0x3020), 2, 1, 6, 6,  18, 0x0013 }, /* Audigy 2 NX  */
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
+	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
@@ -182,10 +183,16 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	if (value > 1)
 		return -EINVAL;
 	changed = value != mixer->audigy2nx_leds[index];
-	err = snd_usb_ctl_msg(mixer->chip->dev,
-			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
-			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
-			      value, index + 2, NULL, 0, 100);
+	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+				usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+				USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+				!value, 0, NULL, 0, 100);
+	else
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+				usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+				USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+				value, index + 2, NULL, 0, 100);
 	if (err < 0)
 		return err;
 	mixer->audigy2nx_leds[index] = value;
@@ -224,8 +231,12 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 	int i, err;
 
 	for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
+		/* USB X-Fi S51 doesn't have a CMSS LED */
+		if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
+			continue;
 		if (i > 1 && /* Live24ext has 2 LEDs only */
 			(mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+			 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 			 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
 			break; 
 		err = snd_ctl_add(mixer->chip->card,
@@ -364,6 +375,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 
 	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+	    mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
 		if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
 			return err;
Signature · 1 line
1.7.1
#1 lore raw

At Tue, 2 Nov 2010 12:02:23 +0000,

Quoted 16 lines · [email protected] wrote:

From: Mandar Joshi <[email protected]>

This patch adds support for Power/Status LED on Creative USB X-Fi S51.
There is just one LED on the device. The LED can either be On or it can be set to Blink. There doesn't seem to be a way to switch it off.
The control message to change LED status is similar to that of audigy2nx except that the index is to be set to 0 and value is 1 for Blink and 0 for On.
The 'Power LED' control in alsamixer when muted will cause the LED to Blink continuously. When unmuted the LED will stay On. The Creative driver under Windows sets the LED to blink whenever audio is muted. This LED can be treated as the CMSS LED but I figured since there is just one LED, it should be treated as the Power LED. Is that alright?
I've also changed the comment "Usb X-Fi" to "Usb X-Fi S51" as there are other external X-Fi devices from Creative like Usb X-Fi Go and Xmod. The volume knob and LED support patch doesn't apply to them.

Quoted 1 line

This patch conflicts with your previous patch that was already merged. Could you rebase?

thanks,

Takashi

Quoted 57 lines
sound/usb/mixer_quirks.c +16 -4
index e7df1e5..aea92d6 100644
@@ -60,6 +60,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3000), 0, 1, 2, 1,  18, 0x0013 }, /* Extigy       */
 	{ USB_ID(0x041e, 0x3020), 2, 1, 6, 6,  18, 0x0013 }, /* Audigy 2 NX  */
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
+	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
@@ -182,10 +183,16 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	if (value > 1)
 		return -EINVAL;
 	changed = value != mixer->audigy2nx_leds[index];
-	err = snd_usb_ctl_msg(mixer->chip->dev,
-			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
-			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
-			      value, index + 2, NULL, 0, 100);
+	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+				usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+				USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+				!value, 0, NULL, 0, 100);
+	else
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+				usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+				USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+				value, index + 2, NULL, 0, 100);
 	if (err < 0)
 		return err;
 	mixer->audigy2nx_leds[index] = value;
@@ -224,8 +231,12 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 	int i, err;
 
 	for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
+		/* USB X-Fi S51 doesn't have a CMSS LED */
+		if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
+			continue;
 		if (i > 1 && /* Live24ext has 2 LEDs only */
 			(mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+			 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 			 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
 			break; 
 		err = snd_ctl_add(mixer->chip->card,
@@ -364,6 +375,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 
 	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+	    mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
 		if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
 			return err;
Signature · 1 line
1.7.1
#2 lore raw
Quoted 3 lines · Takashi Iwai

This patch conflicts with your previous patch that was already merged. Could you rebase?

I created the patch against the alsa-kernel repository
git://git.alsa-project.org/alsa-kernel.git where the previous patch hasn't been merged.
I'll create the patch against
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
where it has been merged.
Is that ok?

-Mandar Joshi

#3 lore raw

PATCH 1/1 Support for Power/Status LED on Creative USB X-Fi S51

From: Mandar Joshi <[email protected]>

Sending patch for sound-2.6 tree
This patch adds support for Power/Status LED on Creative USB X-Fi S51.
There is just one LED on the device. The LED can either be On or it can be set to Blink. There doesn't seem to be a way to switch it off.
The control message to change LED status is similar to that of audigy2nx except that the index is to be set to 0 and value is 1 for Blink and 0 for On.
The 'Power LED' control in alsamixer when muted will cause the LED to Blink continuously. When unmuted the LED will stay On. The Creative driver under Windows sets the LED to blink whenever audio is muted. This LED can be treated as the CMSS LED but I figured since there is just one LED, it should be treated as the Power LED. Is that alright?
I've also changed the comment "Usb X-Fi" to "Usb X-Fi S51" as there are other external X-Fi devices from Creative like Usb X-Fi Go and Xmod. The volume knob and LED support patch doesn't apply to them.

sound/usb/mixer_quirks.c +13 -2
index 7dae05d..8ed0194 100644
@@ -60,7 +60,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3000), 0, 1, 2, 1,  18, 0x0013 }, /* Extigy       */
 	{ USB_ID(0x041e, 0x3020), 2, 1, 6, 6,  18, 0x0013 }, /* Audigy 2 NX  */
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
-	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi */
+	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
@@ -183,7 +183,13 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	if (value > 1)
 		return -EINVAL;
 	changed = value != mixer->audigy2nx_leds[index];
-	err = snd_usb_ctl_msg(mixer->chip->dev,
+	if (mixer->chip->usb_id == USB_ID(0x041e,0x3042))
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+			      !value, 0, NULL, 0, 100);
+	else
+		err = snd_usb_ctl_msg(mixer->chip->dev,
 			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
 			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
 			      value, index + 2, NULL, 0, 100);
@@ -225,8 +231,12 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 	int i, err;
 
 	for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
+		/* USB X-Fi S51 doesn't have a CMSS LED */
+		if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
+			continue;
 		if (i > 1 && /* Live24ext has 2 LEDs only */
 			(mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+			 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 			 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
 			break; 
 		err = snd_ctl_add(mixer->chip->card,
@@ -365,6 +375,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 
 	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+	    mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
 		if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
 			return err;
Signature · 1 line
1.7.1
#4 lore raw

At Tue, 2 Nov 2010 14:43:19 +0000,

Quoted 17 lines · [email protected] wrote:

From: Mandar Joshi <[email protected]>

Sending patch for sound-2.6 tree
This patch adds support for Power/Status LED on Creative USB X-Fi S51.
There is just one LED on the device. The LED can either be On or it can be set to Blink. There doesn't seem to be a way to switch it off.
The control message to change LED status is similar to that of audigy2nx except that the index is to be set to 0 and value is 1 for Blink and 0 for On.
The 'Power LED' control in alsamixer when muted will cause the LED to Blink continuously. When unmuted the LED will stay On. The Creative driver under Windows sets the LED to blink whenever audio is muted. This LED can be treated as the CMSS LED but I figured since there is just one LED, it should be treated as the Power LED. Is that alright?
I've also changed the comment "Usb X-Fi" to "Usb X-Fi S51" as there are other external X-Fi devices from Creative like Usb X-Fi Go and Xmod. The volume knob and LED support patch doesn't apply to them.

Quoted 1 line

Applied now. Thanks.

Takashi

Quoted 52 lines
sound/usb/mixer_quirks.c +13 -2
index 7dae05d..8ed0194 100644
@@ -60,7 +60,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3000), 0, 1, 2, 1,  18, 0x0013 }, /* Extigy       */
 	{ USB_ID(0x041e, 0x3020), 2, 1, 6, 6,  18, 0x0013 }, /* Audigy 2 NX  */
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
-	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi */
+	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
@@ -183,7 +183,13 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	if (value > 1)
 		return -EINVAL;
 	changed = value != mixer->audigy2nx_leds[index];
-	err = snd_usb_ctl_msg(mixer->chip->dev,
+	if (mixer->chip->usb_id == USB_ID(0x041e,0x3042))
+		err = snd_usb_ctl_msg(mixer->chip->dev,
+			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
+			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
+			      !value, 0, NULL, 0, 100);
+	else
+		err = snd_usb_ctl_msg(mixer->chip->dev,
 			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
 			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
 			      value, index + 2, NULL, 0, 100);
@@ -225,8 +231,12 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 	int i, err;
 
 	for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
+		/* USB X-Fi S51 doesn't have a CMSS LED */
+		if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
+			continue;
 		if (i > 1 && /* Live24ext has 2 LEDs only */
 			(mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+			 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 			 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
 			break; 
 		err = snd_ctl_add(mixer->chip->card,
@@ -365,6 +375,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 
 	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
+	    mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
 	    mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) {
 		if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
 			return err;
Signature · 1 line
1.7.1
#5 lore raw
In reply to [email protected]

I guess "S51" stands for "surround 5.1" ( Creative SB1090 ). Having vol. knob working is wonderful (though software volume reduces dynamic range by cutting from the resolution), but I have bigger problem with this card.
In my configuration the card shuts down ( dies ) in 40..90 min. of playback. Doing so it "kills" the port in the kernel. So neither it nor other device can work there until next reboot. The whole usb subsystem fails - if I plug it to another port - the port dies without powering the card on. Under WinXP it works o.k. but as usb hi-speed device. On linux its fullspeed device. Im 90% sure it`s linux kernel/alsa bug.