SB Live24-External better handling
PATCH 1/1 SB Live24-External better handling
Hi.
This patch improves support for 'SB Live 24-bit Extarnal' USB card.
1) This card can go into muted state when a headphones connected or disconnected. So notify mixer about changes in headphone jack.
2) Add LED controls and procfs support just as in similar Audigy 2 NX card.
3) Rename 'PCM Capture' conrol to 'Mic Capture' to reflect reality:
the card may adjust microphone input level only.
Regards.
Tim.
alsa-kernel/usb/usbmixer.c +27 -5
@@ -1703,6 +1703,11 @@ static void snd_usb_mixer_memory_change(case 19 :/* speaker out jacks */ case 20 :/* headphones out jack */ break ; +/* live24ext: 4 = line-in jack */ +case 3 :/* hp-out jack (may actuate Mute) */ +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) +snd_usb_mixer_notify_id (mixer, mixer->rc_cfg->mute_mixer_id); +break ;default :snd_printd (KERN_DEBUG "memory change in unknown unit %d\n" , unitid);break ;
@@ -1951,6 +1956,9 @@ static int snd_audigy2nx_controls_createint i, err;for (i =0 ; i <ARRAY_SIZE (snd_audigy2nx_controls); ++i) { +if (i >1 &&/* Live24ext has 2 LEDs only */ + mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) +break ; err =snd_ctl_add (mixer->chip->card,snd_ctl_new1 (&snd_audigy2nx_controls[i], mixer));if (err <0 )
@@ -1963,28 +1971,41 @@ static int snd_audigy2nx_controls_createstatic void snd_audigy2nx_proc_read (struct snd_info_entry *entry,struct snd_info_buffer *buffer) { -static const struct { +static const struct sb_jack {int unitid;const char *name; - } jacks[] = { + } jacks_audigy2nx[] = { {4 ,"dig in " }, {7 ,"line in" }, {19 ,"spk out" }, {20 ,"hph out" }, + {-1 ,0 } + }, jacks_live24ext[] = { + {4 ,"line in" },/* &1=Line, &2=Mic*/ + {3 ,"hph out" },/* headphones */ + {0 ,"RC " },/* last command, 6 bytes see rc_config above */ + {-1 ,0 } }; +const struct sb_jack *jacks;struct usb_mixer_interface *mixer = entry->private_data;int i, err;u8 buf[3 ];snd_iprintf (buffer,"%s jacks\n\n" , mixer->chip->card->shortname); -for (i =0 ; i <ARRAY_SIZE (jacks); ++i) { +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 )) + jacks = jacks_audigy2nx; +else if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) + jacks = jacks_live24ext; +else return ; + +for (i =0 ; jacks[i].name; ++i) {snd_iprintf (buffer,"%s: " , jacks[i].name); err =snd_usb_ctl_msg (mixer->chip->dev,usb_rcvctrlpipe (mixer->chip->dev,0 ),GET_MEM ,USB_DIR_IN |USB_TYPE_CLASS |USB_RECIP_INTERFACE ,0 , jacks[i].unitid <<8 , buf,3 ,100 ); -if (err ==3 && buf[0 ] ==3 ) +if (err ==3 && (buf[0 ] ==3 || buf[0 ] ==6 ))snd_iprintf (buffer,"%02x %02x\n" , buf[1 ], buf[2 ]);else snd_iprintf (buffer,"?\n" );
@@ -2022,7 +2043,8 @@ int snd_usb_create_mixer(struct snd_usb_if ((err =snd_usb_soundblaster_remote_init (mixer)) <0 ) goto _error; -if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 )) { +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 ) || + mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) {struct snd_info_entry *entry;if ((err =snd_audigy2nx_controls_create (mixer)) <0 )
alsa-kernel/usb/usbmixer_maps.c +11 -0
@@ -187,6 +187,13 @@ static struct usbmix_selector_map audigy { 0 } /* terminator */ }; +/* Creative SoundBlaster Live! 24-bit External */ +static struct usbmix_name_map live24ext_map[] = { +/* 2: PCM Playback Volume */ + {5 ,"Mic Capture" },/* FU, default PCM Capture Volume */ + {0 }/* terminator */ +}; +/* LineX FM Transmitter entry - needed to bypass controls bug */ static struct usbmix_name_map linex_map[] = {/* 1: IT pcm */
@@ -273,6 +280,10 @@ static struct usbmix_ctl_map usbmix_ctl_ .map = audigy2nx_map, .selector_map = audigy2nx_selectors, }, + { + .id = USB_ID(0x041e, 0x3040), + .map = live24ext_map, + }, {/* Hercules DJ Console (Windows Edition) */ .id = USB_ID(0x06f8, 0xb000),
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Mon, 29 Oct 2007 17:40:16 +0300,
Quoted 8 lines · Timofei V. Bondarenko
Hi.
This patch improves support for 'SB Live 24-bit Extarnal' USB card.
1) This card can go into muted state when a headphones connected or disconnected. So notify mixer about changes in headphone jack.
Quoted 7 lines
2) Add LED controls and procfs support just as in similar Audigy 2 NX card.
3) Rename 'PCM Capture' conrol to 'Mic Capture' to reflect reality:
the card may adjust microphone input level only.Regards.
Tim.
Thanks for the patch.
The patch looks fine (except for tiny coding-issues, which I fixed already on my tree).
Could you give your sign-off to merge to the upstream tree?
Takashi
Quoted 116 lines
[2 live24ext.patch <text/x-patch (7bit)>]
diff -upralsa-driver-1.0.15/alsa-kernel/usb/usbmixer.calsa-driver/alsa-kernel/usb/usbmixer.calsa-kernel/usb/usbmixer.c +27
-5@@ -1703,6 +1703,11 @@ static void snd_usb_mixer_memory_change(case 19 :/* speaker out jacks */ case 20 :/* headphones out jack */ break ; +/* live24ext: 4 = line-in jack */ +case 3 :/* hp-out jack (may actuate Mute) */ +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) +snd_usb_mixer_notify_id (mixer, mixer->rc_cfg->mute_mixer_id); +break ;default :snd_printd (KERN_DEBUG "memory change in unknown unit %d\n" , unitid);break ;@@ -1951,6 +1956,9 @@ static int snd_audigy2nx_controls_createint i, err;for (i =0 ; i <ARRAY_SIZE (snd_audigy2nx_controls); ++i) { +if (i >1 &&/* Live24ext has 2 LEDs only */ + mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) +break ; err =snd_ctl_add (mixer->chip->card,snd_ctl_new1 (&snd_audigy2nx_controls[i], mixer));if (err <0 )@@ -1963,28 +1971,41 @@ static int snd_audigy2nx_controls_createstatic void snd_audigy2nx_proc_read (struct snd_info_entry *entry,struct snd_info_buffer *buffer) { -static const struct { +static const struct sb_jack {int unitid;const char *name; - } jacks[] = { + } jacks_audigy2nx[] = { {4 ,"dig in " }, {7 ,"line in" }, {19 ,"spk out" }, {20 ,"hph out" }, + {-1 ,0 } + }, jacks_live24ext[] = { + {4 ,"line in" },/* &1=Line, &2=Mic*/ + {3 ,"hph out" },/* headphones */ + {0 ,"RC " },/* last command, 6 bytes see rc_config above */ + {-1 ,0 } }; +const struct sb_jack *jacks;struct usb_mixer_interface *mixer = entry->private_data;int i, err;u8 buf[3 ];snd_iprintf (buffer,"%s jacks\n\n" , mixer->chip->card->shortname); -for (i =0 ; i <ARRAY_SIZE (jacks); ++i) { +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 )) + jacks = jacks_audigy2nx; +else if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) + jacks = jacks_live24ext; +else return ; + +for (i =0 ; jacks[i].name; ++i) {snd_iprintf (buffer,"%s: " , jacks[i].name); err =snd_usb_ctl_msg (mixer->chip->dev,usb_rcvctrlpipe (mixer->chip->dev,0 ),GET_MEM ,USB_DIR_IN |USB_TYPE_CLASS |USB_RECIP_INTERFACE ,0 , jacks[i].unitid <<8 , buf,3 ,100 ); -if (err ==3 && buf[0 ] ==3 ) +if (err ==3 && (buf[0 ] ==3 || buf[0 ] ==6 ))snd_iprintf (buffer,"%02x %02x\n" , buf[1 ], buf[2 ]);else snd_iprintf (buffer,"?\n" );@@ -2022,7 +2043,8 @@ int snd_usb_create_mixer(struct snd_usb_if ((err =snd_usb_soundblaster_remote_init (mixer)) <0 ) goto _error; -if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 )) { +if (mixer->chip->usb_id ==USB_ID (0x041e ,0x3020 ) || + mixer->chip->usb_id ==USB_ID (0x041e ,0x3040 )) {struct snd_info_entry *entry;if ((err =snd_audigy2nx_controls_create (mixer)) <0 )diff -upr
alsa-driver-1.0.15/alsa-kernel/usb/usbmixer_maps.calsa-driver/alsa-kernel/usb/usbmixer_maps.calsa-kernel/usb/usbmixer_maps.c +11
-0@@ -187,6 +187,13 @@ static struct usbmix_selector_map audigy { 0 } /* terminator */ }; +/* Creative SoundBlaster Live! 24-bit External */ +static struct usbmix_name_map live24ext_map[] = { +/* 2: PCM Playback Volume */ + {5 ,"Mic Capture" },/* FU, default PCM Capture Volume */ + {0 }/* terminator */ +}; +/* LineX FM Transmitter entry - needed to bypass controls bug */ static struct usbmix_name_map linex_map[] = {/* 1: IT pcm */ @@ -273,6 +280,10 @@ static struct usbmix_ctl_map usbmix_ctl_ .map = audigy2nx_map, .selector_map = audigy2nx_selectors, }, + { + .id = USB_ID(0x041e, 0x3040), + .map = live24ext_map, + }, {/* Hercules DJ Console (Windows Edition) */ .id = USB_ID(0x06f8, 0xb000),[3 <text/plain; us-ascii (7bit)>]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 17 lines · Takashi Iwai
At Mon, 29 Oct 2007 17:40:16 +0300,
Quoted 7 lines · Timofei V. Bondarenko
Hi.
This patch improves support for 'SB Live 24-bit Extarnal' USB card.
1) This card can go into muted state when a headphones connected or disconnected. So notify mixer about changes in headphone jack.
Quoted 7 lines
2) Add LED controls and procfs support just as in similar Audigy 2 NX card.
3) Rename 'PCM Capture' conrol to 'Mic Capture' to reflect reality:
the card may adjust microphone input level only.Regards.
Tim.
Quoted 6 lines
Thanks for the patch.
The patch looks fine (except for tiny coding-issues, which I fixed already on my tree).
Could you give your sign-off to merge to the upstream tree?
Just forgot it, sorry.
--
Regards,
Tim.
Takashi Iwai
AppliedAt Tue, 30 Oct 2007 17:24:44 +0300,
Quoted 21 lines · Timofei V. Bondarenko
Quoted 19 lines · Takashi Iwai
At Mon, 29 Oct 2007 17:40:16 +0300,
Quoted 7 lines · Timofei V. Bondarenko
Hi.
This patch improves support for 'SB Live 24-bit Extarnal' USB card.
1) This card can go into muted state when a headphones connected or disconnected. So notify mixer about changes in headphone jack.
Quoted 7 lines
2) Add LED controls and procfs support just as in similar Audigy 2 NX card.
3) Rename 'PCM Capture' conrol to 'Mic Capture' to reflect reality:
the card may adjust microphone input level only.Regards.
Tim.Thanks for the patch.
Quoted 8 lines
Quoted 4 lines
The patch looks fine (except for tiny coding-issues, which I fixed already on my tree).
Could you give your sign-off to merge to the upstream tree?
Signed-off-by Timofei Bondarenko <[email protected]>Just forgot it, sorry.
Thanks, applied to ALSA HG tree now.
Takashi