JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Console access utilities

Console-related utility and helper functions.

Collaboration diagram for Console access utilities:

Functions

bool jevois::isInputDevice (int fd)
 Indicate whether this fd (which should be from /dev/input/eventX) is keyboard, mouse, etc. More...
 
int jevois::getConsoleFd ()
 Get a file descriptor to the console. More...
 
int jevois::getActiveTTY ()
 Get current active tty. More...
 
void jevois::muteKeyboard (int tty, int &kb_mode)
 Prevent keystrokes from reaching the tty. More...
 
void jevois::unMuteKeyboard (int tty, int kb_mode)
 Restore the keyboard mode for given tty. More...
 

Function Documentation

◆ getActiveTTY()

int jevois::getActiveTTY ( )

Get current active tty.

Reads /sys/class/tty/tty0/active and open the tty. Caller should close that fd later using close().

Definition at line 121 of file Console.C.

References IS_CONSOLE.

Referenced by jevois::ImGuiBackendMALI::init(), and main().

◆ getConsoleFd()

int jevois::getConsoleFd ( )

Get a file descriptor to the console.

Definition at line 85 of file Console.C.

References NELEMS.

Referenced by jevois::ImGuiBackendMALI::init(), and main().

◆ isInputDevice()

bool jevois::isInputDevice ( int  fd)

Indicate whether this fd (which should be from /dev/input/eventX) is keyboard, mouse, etc.

Inspired from SFML-rpi

Definition at line 36 of file Console.C.

References NBITS, and test_bit.

Referenced by jevois::ImGuiBackendMALI::scanDevices().

◆ muteKeyboard()

void jevois::muteKeyboard ( int  tty,
int &  kb_mode 
)

Prevent keystrokes from reaching the tty.

Useful when doing direct drawing into the linux framebuffer, as in ImGuiBackendMALI. Returned kb_mode is what it was, use it in unMuteKeyboard to restore.

Definition at line 103 of file Console.C.

References IS_CONSOLE, K_OFF, KDSKBMODE, and KDSKBMUTE.

Referenced by jevois::ImGuiBackendMALI::init().

◆ unMuteKeyboard()

void jevois::unMuteKeyboard ( int  tty,
int  kb_mode 
)

Restore the keyboard mode for given tty.

Use kd_mode that was returned by muteKeyboard().

Definition at line 114 of file Console.C.

References KDSKBMODE, and KDSKBMUTE.

Referenced by main(), and jevois::ImGuiBackendMALI::~ImGuiBackendMALI().