gpio: give better names to MockGpioDevice pins

This will help later with info!() output.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée 2023-04-13 10:33:23 +01:00 committed by Alex Bennée
parent e020f33842
commit 2298cc980b

View File

@ -27,9 +27,14 @@ pub(crate) struct MockGpioDevice {
impl MockGpioDevice {
pub(crate) fn new(ngpio: u16) -> Self {
let mut gpio_names = Vec::with_capacity(ngpio.into());
for i in 0..ngpio {
gpio_names.push(format!("dummy{}", i));
}
Self {
ngpio,
gpio_names: vec!['\0'.to_string(); ngpio.into()],
gpio_names,
state: RwLock::new(vec![
GpioState {
dir: VIRTIO_GPIO_DIRECTION_NONE,