aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-05-10 08:47:38 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:06:34 -0400
commitaafad5629a949d0ad41180f8a746b6cd7654e317 (patch)
tree7ed566d6890bb4b45abacb5539dde09c6ea799fb /sound/usb
parentf55a655bf9eeb1431633bd313f47c8e4dadcf47c (diff)
[ALSA] usb-audio - add a proc file for Audigy 2 NX jack status
USB generic driver This patch adds a proc file for the SB Audigy 2 NX which shows the connection status of the various jacks. Unfortunately, no SPDIF input frequency (yet). Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/usbmixer.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 4a49e1930a1a..83ba665e5c6e 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -36,6 +36,7 @@
36#include <sound/core.h> 36#include <sound/core.h>
37#include <sound/control.h> 37#include <sound/control.h>
38#include <sound/hwdep.h> 38#include <sound/hwdep.h>
39#include <sound/info.h>
39 40
40#include "usbaudio.h" 41#include "usbaudio.h"
41 42
@@ -1622,11 +1623,22 @@ static void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer,
1622static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer, 1623static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer,
1623 int unitid) 1624 int unitid)
1624{ 1625{
1625 /* SB remote control */ 1626 if (mixer->rc_type == RC_NONE)
1626 if (mixer->rc_type != RC_NONE && unitid == 0) { 1627 return;
1627 /* read control code from device memory */ 1628 /* unit ids specific to Extigy/Audigy 2 NX: */
1629 switch (unitid) {
1630 case 0: /* remote control */
1628 mixer->rc_urb->dev = mixer->chip->dev; 1631 mixer->rc_urb->dev = mixer->chip->dev;
1629 usb_submit_urb(mixer->rc_urb, GFP_ATOMIC); 1632 usb_submit_urb(mixer->rc_urb, GFP_ATOMIC);
1633 break;
1634 case 4: /* digital in jack */
1635 case 7: /* line in jacks */
1636 case 19: /* speaker out jacks */
1637 case 20: /* headphones out jack */
1638 break;
1639 default:
1640 snd_printd(KERN_DEBUG "memory change in unknown unit %d\n", unitid);
1641 break;
1630 } 1642 }
1631} 1643}
1632 1644
@@ -1894,6 +1906,37 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
1894 return 0; 1906 return 0;
1895} 1907}
1896 1908
1909static void snd_audigy2nx_proc_read(snd_info_entry_t *entry,
1910 snd_info_buffer_t *buffer)
1911{
1912 static const struct {
1913 int unitid;
1914 const char *name;
1915 } jacks[] = {
1916 {4, "dig in "},
1917 {7, "line in"},
1918 {19, "spk out"},
1919 {20, "hph out"},
1920 };
1921 struct usb_mixer_interface *mixer = entry->private_data;
1922 int i, err;
1923 u8 buf[3];
1924
1925 snd_iprintf(buffer, "%s jacks\n\n", mixer->chip->card->shortname);
1926 for (i = 0; i < ARRAY_SIZE(jacks); ++i) {
1927 snd_iprintf(buffer, "%s: ", jacks[i].name);
1928 err = snd_usb_ctl_msg(mixer->chip->dev,
1929 usb_rcvctrlpipe(mixer->chip->dev, 0),
1930 GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
1931 USB_RECIP_INTERFACE, 0,
1932 jacks[i].unitid << 8, buf, 3, 100);
1933 if (err == 3 && buf[0] == 3)
1934 snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
1935 else
1936 snd_iprintf(buffer, "?\n");
1937 }
1938}
1939
1897int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) 1940int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
1898{ 1941{
1899 static snd_device_ops_t dev_ops = { 1942 static snd_device_ops_t dev_ops = {
@@ -1926,8 +1969,13 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
1926 goto _error; 1969 goto _error;
1927 1970
1928 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) { 1971 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) {
1972 snd_info_entry_t *entry;
1973
1929 if ((err = snd_audigy2nx_controls_create(mixer)) < 0) 1974 if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
1930 goto _error; 1975 goto _error;
1976 if (!snd_card_proc_new(chip->card, "audigy2nx", &entry))
1977 snd_info_set_text_ops(entry, mixer, 1024,
1978 snd_audigy2nx_proc_read);
1931 } 1979 }
1932 1980
1933 err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops); 1981 err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops);