#[non_exhaustive]#[repr(u16)]pub enum Device {
DeviceReady = 0,
DeviceAdd = 1,
DeviceRemove = 2,
PortReady = 3,
ConsolePort = 4,
Resize = 5,
PortOpen = 6,
PortName = 7,
Unknown(u16),
}
Expand description
Event
This enum is not ABI-compatible with it’s corresponding field.
Use Device::from
for converting from an integer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DeviceReady = 0
Sent by the driver at initialization to indicate that it is ready to receive control messages.
A value of 1 indicates success, and 0 indicates failure.
The port number id
is unused.
DeviceAdd = 1
Sent by the device, to create a new port.
value
is unused.
DeviceRemove = 2
Sent by the device, to remove an existing port.
value
is unused.
PortReady = 3
Sent by the driver in response to the device’s VIRTIO_CONSOLE_PORT_ADD message, to indicate that the port is ready to be used.
A value
of 1 indicates success, and 0 indicates failure.
ConsolePort = 4
Sent by the device to nominate a port as a console port.
There MAY be more than one console port.
Resize = 5
Sent by the device to indicate a console size change.
value
is unused.
The buffer is followed by the number of columns and rows (virtio_console_resize
).
PortOpen = 6
This message is sent by both the device and the driver.
value
indicates the state: 0 (port closed) or 1 (port open).
This allows for ports to be used directly by guest and host processes to communicate in an application-defined manner.
PortName = 7
Sent by the device to give a tag to the port.
This control command is immediately followed by the UTF-8 name of the port for identification within the guest (without a NUL terminator).