Skip to content

Commit db5731c

Browse files
committed
[otlib] Add support for QEMU unix sockets
Signed-off-by: James Wainwright <[email protected]>
1 parent 0220a50 commit db5731c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sw/host/opentitanlib/src/transport/qemu/monitor.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ pub struct Chardev {
271271
#[derive(Clone, Debug)]
272272
pub enum ChardevKind {
273273
Pty { path: PathBuf },
274+
Socket { path: PathBuf },
274275
Other,
275276
}
276277

@@ -281,6 +282,13 @@ impl TryFrom<ChardevJson> for Chardev {
281282
let kind = if let Some(path) = json.filename.strip_prefix("pty:") {
282283
let path = PathBuf::from(path);
283284
ChardevKind::Pty { path }
285+
} else if let Some(sock) = json.filename.strip_prefix("disconnected:unix:") {
286+
let path = sock
287+
.split(',')
288+
.next()
289+
.with_context(|| format!("bad socket path format: {sock}"))?;
290+
let path = PathBuf::from(path);
291+
ChardevKind::Socket { path }
284292
} else {
285293
ChardevKind::Other
286294
};

0 commit comments

Comments
 (0)