Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 3 | * Use of this source code is governed by a BSD-style license that can be |
| 4 | * found in the LICENSE file. |
| 5 | */ |
| 6 | |
| 7 | #ifndef TERM_H |
| 8 | #define TERM_H |
| 9 | |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 10 | #include "fb.h" |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 11 | #include "image.h" |
Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 12 | |
Dominik Behr | da6df41 | 2016-08-02 12:56:42 -0700 | [diff] [blame] | 13 | #define TERM_MAX_TERMINALS 12 |
| 14 | #define TERM_SPLASH_TERMINAL 0 |
| 15 | #define TERM_FIRST_STD_VT 1 |
| 16 | |
Dominik Behr | b23b05b | 2016-08-15 16:29:02 -0700 | [diff] [blame] | 17 | #define FRECON_VT_PATH FRECON_RUN_DIR "/vt%u" |
| 18 | |
Chris Morin | 255d9f0 | 2019-02-04 23:29:27 -0800 | [diff] [blame] | 19 | |
| 20 | /* Maximum length of buffer than can be passed to /dev/kmsg as defined in kernel |
| 21 | * sources. */ |
| 22 | #define KMSG_LINE_MAX (1024 - 32) |
| 23 | |
| 24 | |
Dominik Behr | da6df41 | 2016-08-02 12:56:42 -0700 | [diff] [blame] | 25 | extern unsigned int term_num_terminals; |
Stéphane Marchesin | 08c08e7 | 2016-01-07 16:44:08 -0800 | [diff] [blame] | 26 | |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 27 | typedef struct _terminal_t terminal_t; |
Dominik Behr | da6df41 | 2016-08-02 12:56:42 -0700 | [diff] [blame] | 28 | |
| 29 | void term_set_num_terminals(unsigned new_num); |
| 30 | terminal_t* term_init(unsigned vt, int pts_fd); |
David Sodman | bbcb052 | 2014-09-19 10:34:07 -0700 | [diff] [blame] | 31 | void term_close(terminal_t* terminal); |
David Sodman | bbcb052 | 2014-09-19 10:34:07 -0700 | [diff] [blame] | 32 | void term_close(terminal_t* terminal); |
David Sodman | bf3f284 | 2014-11-12 08:26:58 -0800 | [diff] [blame] | 33 | void term_key_event(terminal_t* terminal, uint32_t keysym, int32_t unicode); |
| 34 | bool term_is_child_done(terminal_t* terminal); |
| 35 | |
| 36 | void term_page_up(terminal_t* terminal); |
| 37 | void term_page_down(terminal_t* terminal); |
| 38 | void term_line_up(terminal_t* terminal); |
| 39 | void term_line_down(terminal_t* terminal); |
| 40 | |
| 41 | bool term_is_valid(terminal_t* terminal); |
| 42 | int term_fd(terminal_t* terminal); |
| 43 | void term_dispatch_io(terminal_t* terminal, fd_set* read_set); |
| 44 | bool term_exception(terminal_t*, fd_set* exception_set); |
| 45 | bool term_is_active(terminal_t*); |
David Sodman | 8ef2006 | 2015-01-06 09:23:40 -0800 | [diff] [blame] | 46 | void term_activate(terminal_t*); |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 47 | void term_deactivate(terminal_t* terminal); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 48 | void term_add_fds(terminal_t* terminal, fd_set* read_set, fd_set* exception_set, int* maxfd); |
David Sodman | 8ef2006 | 2015-01-06 09:23:40 -0800 | [diff] [blame] | 49 | const char* term_get_ptsname(terminal_t* terminal); |
David Sodman | f0a925a | 2015-05-04 11:19:19 -0700 | [diff] [blame] | 50 | void term_set_background(terminal_t* term, uint32_t bg); |
| 51 | int term_show_image(terminal_t* terminal, image_t* image); |
| 52 | void term_write_message(terminal_t* terminal, char* message); |
Dominik Behr | 83010f8 | 2016-03-18 18:43:08 -0700 | [diff] [blame] | 53 | fb_t* term_getfb(terminal_t* terminal); |
Stéphane Marchesin | 08c08e7 | 2016-01-07 16:44:08 -0800 | [diff] [blame] | 54 | terminal_t* term_get_terminal(int num); |
| 55 | void term_set_terminal(int num, terminal_t* terminal); |
Dominik Behr | da6df41 | 2016-08-02 12:56:42 -0700 | [diff] [blame] | 56 | int term_create_splash_term(int pts_fd); |
| 57 | void term_destroy_splash_term(void); |
Dominik Behr | 4defb36 | 2016-01-13 12:36:14 -0800 | [diff] [blame] | 58 | void term_set_current(uint32_t t); |
| 59 | uint32_t term_get_current(void); |
| 60 | terminal_t *term_get_current_terminal(void); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 61 | void term_set_current_terminal(terminal_t* terminal); |
Dominik Behr | 4defb36 | 2016-01-13 12:36:14 -0800 | [diff] [blame] | 62 | void term_set_current_to(terminal_t* terminal); |
Dominik Behr | da6df41 | 2016-08-02 12:56:42 -0700 | [diff] [blame] | 63 | int term_switch_to(unsigned int vt); |
Dominik Behr | 01a7a58 | 2016-01-28 17:02:21 -0800 | [diff] [blame] | 64 | void term_monitor_hotplug(void); |
Dominik Behr | b1abcba | 2016-04-14 14:57:21 -0700 | [diff] [blame] | 65 | void term_redrm(terminal_t* terminal); |
| 66 | void term_clear(terminal_t* terminal); |
Haixia Shi | 9528587 | 2016-11-08 15:26:35 -0800 | [diff] [blame] | 67 | void term_zoom(bool zoom_in); |
Dominik Behr | 3384733 | 2016-12-12 17:27:56 -0800 | [diff] [blame] | 68 | void term_background(bool onetry); |
Dominik Behr | 83864df | 2016-04-21 12:35:08 -0700 | [diff] [blame] | 69 | void term_foreground(void); |
Dominik Behr | 1883c04 | 2016-04-27 12:31:02 -0700 | [diff] [blame] | 70 | void term_suspend_done(void*); |
Dominik Behr | da55e6c | 2017-02-28 18:12:10 -0800 | [diff] [blame] | 71 | void term_input_enable(terminal_t* terminal, bool input_enable); |
Stéphane Marchesin | ae37e6c | 2014-08-08 18:19:40 -0700 | [diff] [blame] | 72 | #endif |