From 0f23d50c8291b23799e55c8653c15f16c0d752d0 Mon Sep 17 00:00:00 2001 From: pk33 Date: Sun, 3 Nov 2024 03:41:54 +0100 Subject: VT switcher fix --- README.html | 8 +++++--- include/options.h | 22 +++------------------- include/system.h | 16 +++++++++++++--- makefile | 3 ++- src/display.c | 11 +++-------- src/main.c | 2 +- 6 files changed, 27 insertions(+), 35 deletions(-) diff --git a/README.html b/README.html index 5758e47..940a743 100644 --- a/README.html +++ b/README.html @@ -6,18 +6,20 @@

COMPILING


-

bmake

+

Set CC in the makefile. Then bmake.



USAGE


-

run ./bin/engine33 on a TTY with a display connected to the integrated graphics. Can you find the green pixel on your screen? Well done.

+

You need a monitor connected to an on-board connector.
+Run ./bin/engine33 on a TTY.
+Can you see the green pixel on your screen? Well done.



BUGS




diff --git a/include/options.h b/include/options.h index 4b6f765..2e71ad6 100644 --- a/include/options.h +++ b/include/options.h @@ -2,25 +2,9 @@ #define __OPTIONS_H__ -/**/ -#define DRM_DEVICE "/dev/dri/card0" -#define DRM_MODE "1024x768" -#define DRM_RATE 75 -/**/ - - -#define NEAR 1.0; -#define FAR 24.0 - -#define TRANSPARENT 0x0 -#define BLACK 0xff000000 -#define WHITE 0xffffffff -#define RED 0xffff0000 -#define GREEN 0xff00ff00 -#define BLUE 0xff0000ff -#define YELLOW 0xffffff00 -#define MAGENTA 0xffff00ff -#define CYAN 0xff00ffff +#define DRM_DEVICE "/dev/dri/card1" +#define DRM_MODE "1366x768" +#define DRM_RATE 60 #endif /* __OPTIONS_H */ diff --git a/include/system.h b/include/system.h index 6260013..b97daff 100644 --- a/include/system.h +++ b/include/system.h @@ -3,12 +3,22 @@ #include "types.h" +#define NEAR 1.0 +#define FAR 24.0 + +#define TRANSPARENT 0x0 +#define BLACK 0xff000000 +#define WHITE 0xffffffff +#define RED 0xffff0000 +#define GREEN 0xff00ff00 +#define BLUE 0xff0000ff +#define YELLOW 0xffffff00 +#define MAGENTA 0xffff00ff +#define CYAN 0xff00ffff + err e33_ioctl( Size fd, unsigned long req, void *arg ); boolean strcomp( String s1, String s2 ); -void clear_tty( void); -void vprint_tty( String fmt, ... ); -err get_line (char *buff, size_t sz, char *fmt, ...); #endif /** __SYSTEM_H__ **/ diff --git a/makefile b/makefile index 0990286..d3255f2 100644 --- a/makefile +++ b/makefile @@ -22,8 +22,9 @@ CFLAGS = -march=native -mtune=native -std=c99 -static -w -Wall -Werror -Wextra - $(PROJECT): $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o $(.TARGET) $(.OODATE) + mkdir -p $(PDIR) mv $(.TARGET) $(.ALLSRC:T) $(PDIR) clean: - rm bin/*.out + rm bin/*.o diff --git a/src/display.c b/src/display.c index 1e68f89..25c6437 100644 --- a/src/display.c +++ b/src/display.c @@ -52,7 +52,7 @@ typedef struct { static DRMData_d drmData = {0,}; -static Size vtPipe[2] = { -1, -1 }; +static int vtPipe[2] = { -1, -1 }; static struct termios termOldConfig; @@ -538,11 +538,10 @@ static Size _init_vt_switch( void ) struct vt_mode vt_mode = {0,}; sigset_t set; - __display.ttyfd = -1; + __display.ttyfd = -1; - /* Init VT pipes */ - if (pipe(vtPipe) != 0) + if( pipe(vtPipe) == -1 ) { vtPipe[0] = vtPipe[1] = -1; loge( "Could not set VT pipes"); @@ -557,7 +556,6 @@ static Size _init_vt_switch( void ) loge( "Could not set VT write pipe" ); return E33_EXIT_FAILURE; } - /**/ if( __display.ttyfd = open("/dev/tty", O_RDWR ) < 0 ) { @@ -566,7 +564,6 @@ static Size _init_vt_switch( void ) } - /* Setup signals */ if( _has_signal(REL_SIGNAL) ) { loge( "VT release signal is already in use"); return E33_EXIT_FAILURE; @@ -584,8 +581,6 @@ static Size _init_vt_switch( void ) loge( "Could not set acquire signal handler"); return E33_EXIT_FAILURE; } - /**/ - if( ioctl(__display.ttyfd, VT_GETMODE, &vt_mode) < 0 ) { diff --git a/src/main.c b/src/main.c index 2d345ba..150f16c 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,7 @@ #include "display.h" #include "clock.h" #include "logger.h" -#include "options.h" +#include "system.h" int main(int argc, char *argv[]) -- cgit v1.2.3