mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
xfree86: common infrastructure for platform specific console drivers
These callbacks will be used platform specific code for VT backend specific functions, so we get rid of complicated #ifdef-zoos and demuxing. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
8cbf96e7b4
commit
33d77f8413
25
hw/xfree86/common/console.c
Normal file
25
hw/xfree86/common/console.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: MIT OR X11
|
||||
*
|
||||
* @copyright Enrico Weigelt, metux IT consult <info@metux.net>
|
||||
* @brief console driver interface
|
||||
*/
|
||||
#include <xorg-config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "xf86_console_priv.h"
|
||||
|
||||
/* user requested VT number (-1 = unspecified) */
|
||||
int xf86_console_requested_vt = -1;
|
||||
|
||||
/* close callback of current console backend - may be NULL */
|
||||
void (*xf86_console_proc_close)(void) = NULL;
|
||||
|
||||
/* reactivation callback (eg. on server regeneration) - may be NULL */
|
||||
void (*xf86_console_proc_reactivate)(void) = NULL;
|
||||
|
||||
/* ring the system bell */
|
||||
void (*xf86_console_proc_bell)(int loudness, int pitch, int duration) = NULL;
|
||||
|
||||
/* switch away from VT */
|
||||
bool (*xf86_console_proc_switch_away)(void) = NULL;
|
||||
@@ -1,4 +1,5 @@
|
||||
srcs_xorg_common = [
|
||||
'console.c',
|
||||
'xf86fbBus.c',
|
||||
'xf86noBus.c',
|
||||
'xf86Configure.c',
|
||||
|
||||
26
hw/xfree86/common/xf86_console_priv.h
Normal file
26
hw/xfree86/common/xf86_console_priv.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* SPDX-License-Identifier: MIT OR X11
|
||||
*
|
||||
* @copyright Enrico Weigelt, metux IT consult <info@metux.net>
|
||||
* @brief definitions for XF86 console driver interface
|
||||
*/
|
||||
#ifndef __XSERVER_XFREE86_XF86_CONSOLE_PRIV_H
|
||||
#define __XSERVER_XFREE86_XF86_CONSOLE_PRIV_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* user requested VT number (-1 = unspecified) */
|
||||
extern int xf86_console_requested_vt;
|
||||
|
||||
/* close callback of current console backend - may be NULL */
|
||||
extern void (*xf86_console_proc_close)(void);
|
||||
|
||||
/* reactivation callback (eg. on server regeneration) - may be NULL */
|
||||
extern void (*xf86_console_proc_reactivate)(void);
|
||||
|
||||
/* ring the system bell */
|
||||
extern void (*xf86_console_proc_bell)(int loudness, int pitch, int duration);
|
||||
|
||||
/* switch away from VT */
|
||||
extern bool (*xf86_console_proc_switch_away)(void);
|
||||
|
||||
#endif /* __XSERVER_XFREE86_XF86_CONSOLE_PRIV_H */
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "compiler.h"
|
||||
#include "xf86.h"
|
||||
#include "xf86_console_priv.h"
|
||||
#include "xf86Priv.h"
|
||||
#include "xf86_os_support.h"
|
||||
#include "xf86_OSlib.h"
|
||||
@@ -46,7 +47,6 @@
|
||||
static Bool KeepTty = FALSE;
|
||||
|
||||
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
|
||||
static int VTnum = -1;
|
||||
static int initialVT = -1;
|
||||
#endif
|
||||
|
||||
@@ -300,7 +300,7 @@ xf86OpenSyscons(void)
|
||||
syscons_version = 0;
|
||||
}
|
||||
|
||||
xf86Info.vtno = VTnum;
|
||||
xf86Info.vtno = xf86_console_requested_vt;
|
||||
from = X_CMDLINE;
|
||||
|
||||
#ifdef VT_GETACTIVE
|
||||
@@ -424,7 +424,7 @@ xf86OpenPcvt(void)
|
||||
" not supported.", CHECK_DRIVER_MSG);
|
||||
}
|
||||
|
||||
xf86Info.vtno = VTnum;
|
||||
xf86Info.vtno = xf86_console_requested_vt;
|
||||
|
||||
if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
|
||||
initialVT = -1;
|
||||
@@ -577,11 +577,12 @@ xf86ProcessArgument(int argc, char *argv[], int i)
|
||||
}
|
||||
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
|
||||
if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
|
||||
int VTnum = -1;
|
||||
if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) {
|
||||
UseMsg();
|
||||
VTnum = -1;
|
||||
return 0;
|
||||
}
|
||||
xf86_console_requested_vt = VTnum;
|
||||
return 1;
|
||||
}
|
||||
#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "../../../../os/cmdline.h"
|
||||
|
||||
#include "xf86_priv.h"
|
||||
#include "xf86_console_priv.h"
|
||||
#include "xf86Priv.h"
|
||||
#include "xf86_os_support.h"
|
||||
#include "xf86_OSlib.h"
|
||||
@@ -59,7 +60,6 @@ static Bool KeepTty = FALSE;
|
||||
static Bool UseConsole = FALSE;
|
||||
|
||||
#ifdef HAS_USL_VTS
|
||||
static int VTnum = -1;
|
||||
static int xf86StartVT = -1;
|
||||
static int vtEnabled = 0;
|
||||
#endif
|
||||
@@ -169,8 +169,8 @@ xf86OpenConsole(void)
|
||||
|
||||
xf86StartVT = vtinfo.v_active;
|
||||
|
||||
if (VTnum != -1) {
|
||||
xf86Info.vtno = VTnum;
|
||||
if (xf86_console_requested_vt != -1) {
|
||||
xf86Info.vtno = xf86_console_requested_vt;
|
||||
from = X_CMDLINE;
|
||||
}
|
||||
else if (xf86Info.ShareVTs) {
|
||||
@@ -377,12 +377,12 @@ xf86ProcessArgument(int argc, char **argv, int i)
|
||||
#ifdef HAS_USL_VTS
|
||||
|
||||
if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
|
||||
int VTnum;
|
||||
if (sscanf(argv[i], "vt%d", &VTnum) == 0) {
|
||||
UseMsg();
|
||||
VTnum = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
xf86_console_requested_vt = VTnum;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user