Skip to content

Commit

Permalink
Support for SVGALib 2.0, thanks to Benjamin Joel Stover
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Jun 16, 2001
1 parent d1eca6e commit 8ca59e0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/video/svga/SDL_svgavideo.c
Expand Up @@ -32,6 +32,9 @@ static char rcsid =
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>

#if defined(linux)
#include <linux/vt.h>
Expand Down Expand Up @@ -77,7 +80,11 @@ static int SVGA_Available(void)
{
/* Check to see if we are root and stdin is a virtual console */
int console;

/* SVGALib 1.9.x+ doesn't require root (via /dev/svga) */
int svgalib2 = -1;

/* See if we are connected to a virtual terminal */
console = STDIN_FILENO;
if ( console >= 0 ) {
struct stat sb;
Expand All @@ -88,7 +95,14 @@ static int SVGA_Available(void)
console = -1;
}
}
return((geteuid() == 0) && (console >= 0));

/* See if SVGAlib 2.0 is available */
svgalib2 = open("/dev/svga", O_RDONLY);
if (svgalib2 != -1) {
close(svgalib2);
}

return(((svgalib2 != -1) || (geteuid() == 0)) && (console >= 0));
}

static void SVGA_DeleteDevice(SDL_VideoDevice *device)
Expand Down

0 comments on commit 8ca59e0

Please sign in to comment.