19 #ifndef MIR_GRAPHICS_GBM_LINUX_VIRTUAL_TERMINAL_H_
20 #define MIR_GRAPHICS_GBM_LINUX_VIRTUAL_TERMINAL_H_
45 virtual int open(
char const* pathname,
int flags) = 0;
46 virtual int close(
int fd) = 0;
47 virtual int ioctl(
int d,
int request,
int val) = 0;
48 virtual int ioctl(
int d,
int request,
void* p_val) = 0;
49 virtual int tcsetattr(
int d,
int acts,
const struct termios *tcattr) = 0;
50 virtual int tcgetattr(
int d,
struct termios *tcattr) = 0;
63 std::shared_ptr<DisplayReport>
const& report);
69 std::function<
bool()>
const& switch_away,
70 std::function<
bool()>
const& switch_back);
76 FDWrapper(std::shared_ptr<VTFileOperations>
const& fops,
int fd)
80 ~FDWrapper() {
if (fd_ >= 0) fops->close(fd_); }
81 int fd()
const {
return fd_; }
83 std::shared_ptr<VTFileOperations>
const fops;
87 int find_active_vt_number();
88 int open_vt(
int vt_number);
91 std::shared_ptr<VTFileOperations>
const fops;
92 std::shared_ptr<DisplayReport>
const report;
93 FDWrapper
const vt_fd;
95 struct vt_mode prev_vt_mode;
97 struct termios prev_tcattr;