Binary files fbvnc-1.7.1/fbvnc and fbvnc-1.7.1.elpa/fbvnc differ diff -urNp fbvnc-1.7.1/fbvnc.c fbvnc-1.7.1.elpa/fbvnc.c --- fbvnc-1.7.1/fbvnc.c 2004-10-18 21:08:46.000000000 +0200 +++ fbvnc-1.7.1.elpa/fbvnc.c 2008-04-05 22:54:51.000000000 +0200 @@ -12,7 +12,10 @@ #include -#include +//#include +#include +#include +#include #include "vncviewer.h" #include "fbgl.h" @@ -23,6 +26,87 @@ fbvnc_framebuffer_t global_framebuffer; +int fb,len,tty; +unsigned short *sbuf; +#define FB_OPEN_NEW_VC 0 + +void *FBopen( const char *fbname, unsigned short opts ) +{ + struct fb_var_screeninfo vinf; + fb=open("/dev/fb0",O_RDWR ); + ioctl(fb, FBIOGET_VSCREENINFO, &vinf); + len=vinf.xres*vinf.yres*vinf.bits_per_pixel/8; + sbuf=(unsigned short *)mmap(NULL,len,PROT_READ|PROT_WRITE,MAP_SHARED,fb,0); + return((void*)1); +} + +int FBclose( void *v ) +{ + munmap((void*)sbuf,len); + close(fb); + return(0); +} + +/* +FB *FBopen( const char *fbname, unsigned short opts ) +{ + FB *f=(FB *)FBalloc(sizeof(FB)); /-Allocate new FB handle + f->vtchoice = opts & 0x01; //Set open options + f->handle_kbd = (opts & FB_NO_KBD) == 0; + f->use_backing = (opts & FB_NO_BACKING_STORE) == 0; + if ( !fbname ) //Open framebuffer fbname + { + fbname = getenv("FRAMEBUFFER"); //Try to set name from the environment + if ( !fbname ) + { + if ( access("/dev/.devfsd", F_OK) == 0 ) //devfs detected + fbname = "/dev/fb/0"; + else + fbname = "/dev/fb0"; + } + } + if ( (f->fb = open( fbname, O_RDONLY | O_NONBLOCK )) == -1 ) + FBerror( FATAL | SYSERR, "FBopen: open failed on %s", fbname ); + FBgetfix(f); //Get screen info + FBgetvar(f); + (void)close(f->fb); //Open VT + FBVTopen(f); + FBmouseopen(); //Open mouse + FBfontopen(f); //Setup fontinfo + if ( (f->fb = open( fbname, O_RDWR )) == -1 ) + FBerror( FATAL | SYSERR, "FBopen: open failed on %s", fbname ); + FBgetfix(f); + f->vinf.xoffset = 0; //Disable ywrap + f->vinf.yoffset = 0; + f->vinf.vmode &= ~FB_VMODE_YWRAP; + + f->cmap = NULL; //Update screen info + FBputvar(f); + FBmap(f); //Map fb into memory + f->sbak = NULL; + return(f); +} + +int FBclose( FB *f ) +{ + FBunmap(f); //Unmap framebuffer from memory + FBfontclose(f); //Free fontinfo + FBmouseclose(); //Close mouse + FBVTclose(f); //Close VT + if ( close ( f->fb ) == -1 ) //Close framebuffer device + FBerror( WARNING | SYSERR, "FBclose: close fb failed" ); + if(f->cmap) //Free the internal palette + { + FBfree(f->cmap->red); + FBfree(f->cmap->green); + FBfree(f->cmap->blue); + FBfree(f->cmap); + } + FBfree(f); //Free FB + return(1); +} +*/ + static bool quit_requested = 0; struct fb_calibration { @@ -74,12 +158,11 @@ get_fbinfo() { struct fb_fix_screeninfo finf; struct fb_var_screeninfo vinf; - FB *f = global_framebuffer.p_framebuf; - if (ioctl(f->fb, FBIOGET_FSCREENINFO, &finf)) + if (ioctl(fb, FBIOGET_FSCREENINFO, &finf)) cleanup_and_exit("fscreeninfo", EXIT_SYSERROR); - if (ioctl(f->fb, FBIOGET_VSCREENINFO, &vinf)) + if (ioctl(fb, FBIOGET_VSCREENINFO, &vinf)) cleanup_and_exit("vscreeninfo", EXIT_SYSERROR); if (vinf.bits_per_pixel != 8*sizeof(Pixel)) { @@ -98,9 +181,9 @@ get_fbinfo() { global_framebuffer.p_xsize = vinf.xres; global_framebuffer.p_ysize = vinf.yres; - global_framebuffer.p_buf = f->sbuf; + global_framebuffer.p_buf = sbuf; - global_framebuffer.kb_fd = f->tty; + global_framebuffer.kb_fd = tty; } #define FBVNC_CALIBRATION_FILE "/etc/fbvnc-calibration.conf" @@ -134,6 +217,8 @@ ts_save_calibration() { fclose(f); } +#define AXIS_MASK ((1 << ABS_X) || (1 << ABS_Y)) + void init_pointer() { int ts_fd = -1; @@ -172,6 +257,31 @@ init_pointer() { if (ts_fd<0) cleanup_and_exit("Can't open /dev/h3600_tsraw", EXIT_SYSERROR); break; + case TS_TYPE_PS2: + { + int i, r, fd; + char fname[64]; + for (i = 0; i < 32; i++) + { + sprintf(fname, "/sys/class/input/event%d/device/capabilities/abs", i); + fd = open(fname, O_RDONLY); + if (fd < 0) + continue; + r = read(fd, fname, sizeof(fname)); + close(fd); + if (r <= 0) + continue; + fname[r] = '\0'; + if ((atoi(fname) & AXIS_MASK) != AXIS_MASK) + continue; + sprintf(fname, "/dev/input/event%d", i); + ts_fd = open(fname, O_NONBLOCK); + } + + } + if (ts_fd<0) + cleanup_and_exit("Can't open /dev/input/eventX", EXIT_SYSERROR); + break; } if (ts_fd >= 0) { @@ -547,7 +657,7 @@ fbvnc_get_event (fbvnc_event_t *ev, List #ifdef INPUT_PS2MOUSE FD_SET_u(msefd, &rfds); #endif - FD_SET_u(kb_fd, &rfds); + //FD_SET_u(kb_fd, &rfds); /* quick check on input devices without waiting */ fd_copy(&save_rfds, &rfds, max+1); /* save for later */ @@ -652,6 +762,35 @@ fbvnc_get_event (fbvnc_event_t *ev, List t_x = ts.x; t_y = ts.y; pressed = (ts.pressure!= 0); + } else if (ts_type == TS_TYPE_PS2) { + static int x, y, z; + struct input_event ts; + r=read(ts_fd, &ts, sizeof ts); + if (r!=sizeof ts) bad_ts_read(sizeof ts, r); + switch (ts.type) + { + case EV_ABS: + switch (ts.code) + { + case ABS_X: + x = ts.value; + break; + case ABS_Y: + y = ts.value; + break; + } + return 0; + case EV_KEY: + if (ts.code == BTN_TOUCH) + z = ts.value; + return 0; + case EV_SYN: + t_x = x; + t_y = y; + pressed = z; + break; + } + } else { cleanup_and_exit("unknown touchscreen type", EXIT_ERROR); } @@ -709,7 +848,7 @@ fbvnc_get_event (fbvnc_event_t *ev, List global_framebuffer.ts_y = ev->y; } RetEvent(evtype); - } + } #endif #ifdef INPUT_PS2MOUSE if (FD_ISSET(msefd, &rfds)) { @@ -976,7 +1115,7 @@ do_calibration() { } #ifdef INPUT_TS - if (ts_type == TS_TYPE_IPAQ || ts_type == TS_TYPE_C700) { + if (ts_type == TS_TYPE_IPAQ || ts_type == TS_TYPE_C700 || ts_type == TS_TYPE_PS2) { tscal.a = scale * (px[1]-px[0]) / (gx[1]-gx[0]); tscal.b = 0; tscal.c = scale * px[1] - tscal.a * gx[1]; diff -urNp fbvnc-1.7.1/Makefile fbvnc-1.7.1.elpa/Makefile --- fbvnc-1.7.1/Makefile 2005-03-31 08:09:03.000000000 +0200 +++ fbvnc-1.7.1.elpa/Makefile 2008-04-05 22:56:41.000000000 +0200 @@ -1,12 +1,11 @@ SRCS= args.c rfbproto.c sockets.c fbvnc.c fbgl.c fbdraw.c list.c icons.c overlay.c keyboard.c fscale.c vncauth.c d3des.c OBJS= args.o rfbproto.o sockets.o fbvnc.o fbgl.o fbdraw.o list.o icons.o overlay.o keyboard.o fscale.o vncauth.o d3des.o -INCLUDES= -I/usr/X11R6/include -I../include -I. -Iofbis-0.1.1 -LIBS= ofbis-0.1.1/src/.libs/libofbis.a +#INCLUDES= -I/usr/X11R6/include -I../include -I. -Iofbis-0.1.1 +INCLUDES= -I. +#LIBS= ofbis-0.1.1/src/.libs/libofbis.a -#CC=gcc -march=armv4 -mtune=xscale -g -CC=/home/kw/proj/pocketworkstation/2.95.3/arm-linux/bin/gcc -march=armv4 -#CC=gcc +CC=arm-linux-gcc DEFINES=-DINPUT_TS CFLAGS=-O2 -Wall $(INCLUDES) $(DEFINES) @@ -24,7 +23,7 @@ fscale-autogen.o: fscale.o true fbvnc: $(OBJS) fscale-autogen.o - $(CC) -o fbvnc $(OBJS) $(LIBS) + $(CC) -o fbvnc $(OBJS) $(LIBS) -static .depend: $(SRCS) $(CC) -MM $(INCLUDES) $(DEFINES) $(SRCS) > .depend diff -urNp fbvnc-1.7.1/rfbproto.c fbvnc-1.7.1.elpa/rfbproto.c --- fbvnc-1.7.1/rfbproto.c 2004-05-13 09:19:17.000000000 +0200 +++ fbvnc-1.7.1.elpa/rfbproto.c 2007-12-30 12:25:52.000000000 +0100 @@ -175,7 +175,8 @@ InitialiseRFBConnection(int sock) if (!ReadExact(sock, (char *)challenge, CHALLENGESIZE)) return False; if (passwdFile) { - passwd = vncDecryptPasswdFromFile(passwdFile); + passwd = (passwdFile[0]=='*')?(passwdFile+1):vncDecryptPasswdFromFile(passwdFile); + //passwd = vncDecryptPasswdFromFile(passwdFile); } else { passwd = getpass("Password: "); if (strlen(passwd) == 0) {