Project

General

Profile

Bug #1031

Minor audioctl save-controls issue with newlines in hardware info

Added by Albert Lee over 9 years ago. Updated over 1 year ago.

Status:
New
Priority:
Low
Category:
cmd - userland programs
Start date:
2011-05-13
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
audio, good-first-bug
Gerrit CR:

Description

When a newline is encountered in the hw info string, audioctl just prints it without processing.

# audioctl show-device
Device: /dev/sound/audiohd:0mixer
  Name    = audiohd#0
  Config  = onboard1 (a)
  HW Info = Unknown HD codec: 0x10ec0269
Unknown HD codec: 0x80862804

This becomes a problem when save-controls is used, as it results in a missing comment prefix:

# Device: /dev/sound/audiohd:0mixer
# Name    = audiohd#0
# Config  = onboard1 (a)
# HW Info = Unknown HD codec: 0x10ec0269
Unknown HD codec: 0x80862804
#
#CONTROL                 VALUE     
volume                   24        
speaker                  75:75     
headphones               75:75     
rear                     75:75     
mic                      50:50     
record-source            mic       

load-controls complains but seems to load the configuration anyway:

# audioctl load-controls somefile
No such control: Unknown

History

#1

Updated by green hat over 9 years ago

fuction: int do_save_controls(int argc, char **argv)
file: /illumos-gate/usr/src/cmd/audio/audioctl/audioctl.c

Replace lines
- Hide quoted text
1059 if (strlen(d
>card.hw_info)) {
1060 (void) fprintf(fp, "# HW Info = %s", d->card.hw_info);
1061 }
1062 (void) fprintf(fp, "#\n");

with lines below

char *hwInfo;

if (strlen(d->card.hw_info)) {
hwInfo = strtok (d->card.hw_info, "\n");
while (hwInfo != NULL) {
(void) fprintf(fp, "# HW Info = %s\n", hwInfo);
hwInfo = strtok(NULL, "\n");
}
}
(void) fprintf(fp, "#\n");

#2

Updated by Albert Lee over 9 years ago

Did you see the discussion on list and the updated patch from Yuri? "# HW Info =" should be printed once, with "#<tab>" following.

#3

Updated by Hans Rosenfeld over 1 year ago

  • Assignee set to Hans Rosenfeld

Also available in: Atom PDF