Add function to pause (temporarily) reading data from vhci. This can be used to synchronously pause handling of btdev commands from the kernel. --- emulator/vhci.c | 9 +++++++++ emulator/vhci.h | 1 + 2 files changed, 10 insertions(+) diff --git a/emulator/vhci.c b/emulator/vhci.c index ecf1db3c7..c6a5caa5e 100644 --- a/emulator/vhci.c +++ b/emulator/vhci.c @@ -178,6 +178,15 @@ void vhci_close(struct vhci *vhci) vhci_destroy(vhci); } +bool vhci_pause_input(struct vhci *vhci, bool paused) +{ + if (paused) + return io_set_read_handler(vhci->io, NULL, NULL, NULL); + else + return io_set_read_handler(vhci->io, vhci_read_callback, vhci, + NULL); +} + struct btdev *vhci_get_btdev(struct vhci *vhci) { if (!vhci) diff --git a/emulator/vhci.h b/emulator/vhci.h index 68eae4c4a..12c4b55a0 100644 --- a/emulator/vhci.h +++ b/emulator/vhci.h @@ -31,3 +31,4 @@ int vhci_set_emu_opcode(struct vhci *vhci, uint16_t opcode); int vhci_set_force_static_address(struct vhci *vhci, bool enable); int vhci_force_devcd(struct vhci *vhci, const void *data, size_t len); int vhci_read_devcd(struct vhci *vhci, void *buf, size_t size); +bool vhci_pause_input(struct vhci *vhci, bool paused); -- 2.41.0