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