mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-08 21:18:03 +03:00
cfg2cmd: set audiodev parameter only on qemu >= 4.2
fixes commit 940e2a3a06
QEMU 4.1 will fail to start a guest with an audio device set with:
> Property '.audiodev' not found
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
058531889f
commit
1cc5ed1bc4
@ -2752,19 +2752,22 @@ sub conf_has_audio {
|
||||
}
|
||||
|
||||
sub audio_devs {
|
||||
my ($audio, $audiopciaddr) = @_;
|
||||
my ($audio, $audiopciaddr, $machine_version) = @_;
|
||||
|
||||
my $devs = [];
|
||||
|
||||
my $id = $audio->{dev_id};
|
||||
my $audiodev = "audiodev=$audio->{backend_id}";
|
||||
my $audiodev = "";
|
||||
if (min_version($machine_version, 4, 2)) {
|
||||
$audiodev = ",audiodev=$audio->{backend_id}";
|
||||
}
|
||||
|
||||
if ($audio->{dev} eq 'AC97') {
|
||||
push @$devs, '-device', "AC97,id=${id}${audiopciaddr},$audiodev";
|
||||
push @$devs, '-device', "AC97,id=${id}${audiopciaddr}$audiodev";
|
||||
} elsif ($audio->{dev} =~ /intel\-hda$/) {
|
||||
push @$devs, '-device', "$audio->{dev},id=${id}${audiopciaddr}";
|
||||
push @$devs, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0,$audiodev";
|
||||
push @$devs, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1,$audiodev";
|
||||
push @$devs, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0$audiodev";
|
||||
push @$devs, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1$audiodev";
|
||||
} else {
|
||||
die "unkown audio device '$audio->{dev}', implement me!";
|
||||
}
|
||||
@ -3276,7 +3279,7 @@ sub config_to_command {
|
||||
|
||||
if (min_version($machine_version, 4, 0) && (my $audio = conf_has_audio($conf))) {
|
||||
my $audiopciaddr = print_pci_addr("audio0", $bridges, $arch, $machine_type);
|
||||
my $audio_devs = audio_devs($audio, $audiopciaddr);
|
||||
my $audio_devs = audio_devs($audio, $audiopciaddr, $machine_version);
|
||||
push @$devices, @$audio_devs;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user