Bug #1031
openMinor audioctl save-controls issue with newlines in hardware info
0%
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
Updated by green hat almost 11 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 >card.hw_info)) {
1059 if (strlen(d
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");
Updated by Albert Lee almost 11 years ago
Did you see the discussion on list and the updated patch from Yuri? "# HW Info =" should be printed once, with "#<tab>" following.
Updated by Hans Rosenfeld about 3 years ago
- Assignee set to Hans Rosenfeld