31 lines
997 B
C++
31 lines
997 B
C++
#ifndef NUI_ATTACH_LINUX_VHCI_LIFECYCLE_H
|
|
#define NUI_ATTACH_LINUX_VHCI_LIFECYCLE_H
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace attach::linux_attach {
|
|
|
|
struct CommandResult {
|
|
bool succeeded;
|
|
int exit_code;
|
|
std::string output;
|
|
};
|
|
|
|
// Each wraps the stock `usbip` client CLI (not reimplemented here: the
|
|
// client side of USB/IP is the kernel vhci-hcd driver plus the usbip
|
|
// userspace tool, both out of this shim's scope per todo 9's "no out-of-tree
|
|
// kernel modules beyond stock usbip/vhci"). This shim is the SERVER half
|
|
// (UsbipServer); these functions only drive the matching client commands.
|
|
CommandResult usbip_attach(const std::string& host, uint16_t port, const std::string& busid);
|
|
CommandResult usbip_detach(int vhci_port);
|
|
CommandResult usbip_list_ports();
|
|
CommandResult modprobe_vhci();
|
|
|
|
std::optional<int> parse_attached_port(const std::string& usbip_attach_output);
|
|
|
|
} // namespace attach::linux_attach
|
|
|
|
#endif // NUI_ATTACH_LINUX_VHCI_LIFECYCLE_H
|