diff --git a/vhost-device-sound/CHANGELOG.md b/vhost-device-sound/CHANGELOG.md index 1394bab..15ce864 100644 --- a/vhost-device-sound/CHANGELOG.md +++ b/vhost-device-sound/CHANGELOG.md @@ -3,6 +3,7 @@ ### Added +- [[#806]](https://github.com/rust-vmm/vhost-device/pull/806) Add controls field in VirtioSoundConfig - [[#746]](https://github.com/rust-vmm/vhost-device/pull/746) Add new sampling rates 12000Hz and 24000Hz ### Changed diff --git a/vhost-device-sound/src/device.rs b/vhost-device-sound/src/device.rs index 3d7db21..f2e3abb 100644 --- a/vhost-device-sound/src/device.rs +++ b/vhost-device-sound/src/device.rs @@ -573,6 +573,7 @@ impl VhostUserSoundBackend { jacks: 0.into(), streams: Le32::from(streams_no as u32), chmaps: 1.into(), + controls: 0.into(), }, exit_event: EventFd::new(EFD_NONBLOCK).map_err(Error::EventFdCreate)?, audio_backend: RwLock::new(audio_backend), diff --git a/vhost-device-sound/src/virtio_sound.rs b/vhost-device-sound/src/virtio_sound.rs index 8ddca68..8801805 100644 --- a/vhost-device-sound/src/virtio_sound.rs +++ b/vhost-device-sound/src/virtio_sound.rs @@ -163,6 +163,8 @@ pub struct VirtioSoundConfig { pub streams: Le32, /// total number of all available channel maps pub chmaps: Le32, + /// total number of all available control elements + pub controls: Le32, } // SAFETY: The layout of the structure is fixed and can be initialized by @@ -350,8 +352,9 @@ mod tests { let val = VirtioSoundConfig::default(); let debug_output = format!("{:?}", val); - let expected_debug = - "VirtioSoundConfig { jacks: Le32(0), streams: Le32(0), chmaps: Le32(0) }".to_string(); + let expected_debug = "VirtioSoundConfig { jacks: Le32(0), streams: Le32(0), chmaps: \ + Le32(0), controls: Le32(0) }" + .to_string(); assert_eq!(debug_output, expected_debug); let val = VirtioSoundHeader::default();