Commit 7a2fbd30 authored by kollo's avatar kollo

added commandline options for framebuffer version

little improvement strncpy
parent afa7b39e
......@@ -68,18 +68,15 @@ G_CONTEXT screen;
void textscreen_redraw(int x, int y, int w,int h);
extern int bigfont;
/*TODO:
Evtl. moechte man verschiedene framebufferdevices ansprechen, z.B.
beim sense Hat für Raspberry Pi (/dev/fb1)
Momentan muss FB_DEVICENAME dafuer geaendert werden.
*/
#ifndef ANDROID
char fbdevname[256]=FB_DEVICENAME;
#endif
void Fb_Open() {
#ifndef ANDROID
fbfd=open(FB_DEVICENAME, O_RDWR);
fbfd=open(fbdevname, O_RDWR);
if(fbfd<0) {
printf("ERROR: could not open framebuffer device %s.\n",FB_DEVICENAME);
perror(FB_DEVICENAME);
printf("ERROR: could not open framebuffer device %s.\n",fbdevname);
perror(fbdevname);
exit(EX_OSFILE);
}
// Get fixed screen information
......
......@@ -95,6 +95,11 @@ static void intro() {
xbasic_name,version,vdate,libversion,libvdate);
}
#endif
#if defined FRAMEBUFFER && !defined ANDROID
extern char fbdevname[];
extern char mousedevname[];
extern char keyboarddevname[];
#endif
static void usage() {
......@@ -114,7 +119,14 @@ static void usage() {
" -h --help\t--- Usage\n"
" --help <topic>\t--- Print help on topic\n"
#endif
#if defined FRAMEBUFFER && !defined ANDROID
" --framebuffer <dev>\t--- set framebuffer device for output [%s]\n"
" --mouse <dev>\t--- set mouse device [/dev/input/mice]\n"
" --keyboard <dev>\t--- set keyboard device [/dev/input/event4]\n"
,xbasic_name,ifilename,fbdevname);
#else
,xbasic_name,ifilename);
#endif
}
#ifdef WINDOWS
......@@ -180,6 +192,14 @@ void kommandozeile(int anzahl, char *argumente[]) {
verbose++;
} else if (strcmp(argumente[count],"-q")==FALSE) {
verbose--;
#if defined FRAMEBUFFER && !defined ANDROID
} else if (strcmp(argumente[count],"--framebuffer")==FALSE) {
strncpy(fbdevname,argumente[++count],256);
} else if (strcmp(argumente[count],"--mouse")==FALSE) {
strncpy(mousedevname,argumente[++count],256);
} else if (strcmp(argumente[count],"--keyboard")==FALSE) {
strncpy(keyboarddevname,argumente[++count],256);
#endif
} else {
if(!loadfile) {
loadfile=TRUE;
......
......@@ -27,6 +27,8 @@ void FB_keyboard_events(int onoff) {do_keyboard_events=onoff;}
#ifndef ANDROID
char keyboarddevname[256]=KEYBOARD_DEVICE;
static int keyboard_fd=-1;
static pthread_t keyboard_thread;
......@@ -112,12 +114,12 @@ void FB_close_keyboard() {
}
int Fb_Keyboard_Open() {
FB_close_keyboard();
keyboard_fd=open(KEYBOARD_DEVICE, O_RDONLY);
keyboard_fd=open(keyboarddevname, O_RDONLY);
/* Jetzt einen Interrupthandler / thread starten, welcher die
Event-Ereignisse verarbeitet.*/
if(keyboard_fd>0) {
pthread_create(&keyboard_thread, NULL,keyboard_handler, (void*) NULL);
} else perror(KEYBOARD_DEVICE);
} else perror(keyboarddevname);
return keyboard_fd;
}
#endif
......@@ -32,7 +32,6 @@ typedef struct MOUSE_EVENT {
signed char dx;
signed char dy;
} MOUSE_EVENT;
#endif
#include "bitmaps/mauspfeil.bmp"
......@@ -253,14 +252,17 @@ void FB_close_mouse() {
mouse_fd = -1;
}
}
char mousedevname[256]=MOUSE_DEVICE;
int Fb_Mouse_Open() {
FB_close_mouse();
mouse_fd=open(MOUSE_DEVICE, O_RDONLY );
mouse_fd=open(mousedevname, O_RDONLY );
/* Jetzt einen Interrupthandler / thread starten, welcher die
Maus-Ereignisse verarbeitet.*/
if(mouse_fd>0) {
pthread_create(&mouse_thread, NULL,mouse_handler, (void*) NULL);
} else perror(MOUSE_DEVICE);
} else perror(mousedevname);
return mouse_fd;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment