Print this page
1031 Minor audioctl save-controls issue with newlines in hardware info
10620 audioctl: don't return failure because of illegal enum value
10617 audiohd: don't create record-source control if there is none

@@ -497,11 +497,17 @@
         case MIXT_ENUM:
                 str = get_enum_str(cinfop, cval.value);
                 if (str == NULL) {
                         warn(_("Bad enum index %d for control '%s'\n"),
                             cval.value, cinfop->ci.extname);
-                        return (EINVAL);
+                        /*
+                         * Apparently the driver gave us bogus data for this
+                         * control, so we will ignore it.
+                         *
+                         * Don't confuse the user by returning an error status.
+                         */
+                        return (0);
                 }
 
                 (void) snprintf(valbuf, sizeof (valbuf), "%s", str);
                 break;
 

@@ -830,10 +836,12 @@
 int
 do_show_device(int argc, char **argv)
 {
         int             optc;
         char            *devname = NULL;
+        char            *p, *n;
+        const char      *m;
         device_t        *d;
 
         while ((optc = getopt(argc, argv, "d:v")) != EOF) {
                 switch (optc) {
                 case 'd':

@@ -859,12 +867,16 @@
 
         msg(_("Device: %s\n"), d->mixer.devnode);
         msg(_("  Name    = %s\n"), d->card.shortname);
         msg(_("  Config  = %s\n"), d->card.longname);
 
-        if (strlen(d->card.hw_info)) {
-                msg(_("  HW Info = %s"), d->card.hw_info);
+        for (m = "  HW Info = %s\n", p = d->card.hw_info;
+            p != NULL && strlen(p) != 0;
+            m = "\t    %s\n", p = n) {
+                if ((n = strchr(p, '\n')) != NULL)
+                        *n++ = '\0';
+                msg(_(m), p);
         }
 
         return (0);
 }
 

@@ -1008,10 +1020,12 @@
         int             rv;
         cinfo_t         *cinfop;
         FILE            *fp;
         int             fd;
         int             mode;
+        char            *p, *n;
+        const char      *m;
 
         mode = O_WRONLY | O_CREAT | O_EXCL;
 
         while ((optc = getopt(argc, argv, "d:f")) != EOF) {
                 switch (optc) {

@@ -1054,12 +1068,16 @@
 
         (void) fprintf(fp, "# Device: %s\n", d->mixer.devnode);
         (void) fprintf(fp, "# Name    = %s\n", d->card.shortname);
         (void) fprintf(fp, "# Config  = %s\n", d->card.longname);
 
-        if (strlen(d->card.hw_info)) {
-                (void) fprintf(fp, "# HW Info = %s", d->card.hw_info);
+        for (m = "# HW Info = %s\n", p = d->card.hw_info;
+            p != NULL && strlen(p) != 0;
+            m = "#\t    %s\n", p = n) {
+                if ((n = strchr(p, '\n')) != NULL)
+                        *n++ = '\0';
+                fprintf(fp, m, p);
         }
         (void) fprintf(fp, "#\n");
 
         print_header(fp, 0);