JeVois  1.18
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Console.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2020 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
20 #ifdef JEVOIS_PRO
21 
22 namespace jevois
23 {
24  /*! \defgroup console Console access utilities
25 
26  Console-related utility and helper functions. \ingroup utils */
27 
28  /*! @{ */ // **********************************************************************
29 
30  //! Indicate whether this fd (which should be from /dev/input/eventX) is keyboard, mouse, etc
31  /*! Inspired from SFML-rpi */
32  bool isInputDevice(int fd);
33 
34  //! Get a file descriptor to the console
35  int getConsoleFd();
36 
37  //! Get current active tty
38  /*! Reads /sys/class/tty/tty0/active and open the tty. Caller should close that fd later using close(). */
39  int getActiveTTY();
40 
41  //! Prevent keystrokes from reaching the tty
42  /*! Useful when doing direct drawing into the linux framebuffer, as in ImGuiBackendMALI. Returned kb_mode is what it
43  was, use it in unMuteKeyboard to restore. */
44  void muteKeyboard(int tty, int & kb_mode);
45 
46  //! Restore the keyboard mode for given tty
47  /*! Use kd_mode that was returned by muteKeyboard(). */
48  void unMuteKeyboard(int tty, int kb_mode);
49 
50  /*! @} */ // **********************************************************************
51 
52 } // namespace jevois
53 
54 #endif // JEVOIS_PRO
jevois::unMuteKeyboard
void unMuteKeyboard(int tty, int kb_mode)
Restore the keyboard mode for given tty.
Definition: Console.C:114
jevois::getActiveTTY
int getActiveTTY()
Get current active tty.
Definition: Console.C:121
jevois
Definition: Concepts.dox:1
jevois::isInputDevice
bool isInputDevice(int fd)
Indicate whether this fd (which should be from /dev/input/eventX) is keyboard, mouse,...
Definition: Console.C:36
jevois::muteKeyboard
void muteKeyboard(int tty, int &kb_mode)
Prevent keystrokes from reaching the tty.
Definition: Console.C:103
jevois::getConsoleFd
int getConsoleFd()
Get a file descriptor to the console.
Definition: Console.C:85