eqemu

changeset 11:2b559dc24c7b

done
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 18 Jul 2014 05:44:37 +0300
parents 819c7ebb1bec
children 2656099aff12
files README RUN src/dev.cc src/main.cc
diffstat 4 files changed, 53 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/README	Fri Jul 18 05:07:40 2014 +0300
     1.2 +++ b/README	Fri Jul 18 05:44:37 2014 +0300
     1.3 @@ -1,5 +1,19 @@
     1.4 -1. Create 2 pseudoterminals: socat -d -d PTY PTY
     1.5 -2. start ./eqemu /dev/pts/one
     1.6 -3. set the php script to use /dev/pts/theother (make sure apache has permission
     1.7 -   to rw it).
     1.8 -   Try minicom -D /dev/pts/theother with disabled flow control to test it.
     1.9 +equeue emulator usage
    1.10 +---------------------
    1.11 +- execute the included RUN script to start a pseudoterminal pair and connect the
    1.12 +  emulator to one end.
    1.13 +- then make sure your program connects to the pseudoterminal /tmp/ttyeqemu.
    1.14 +
    1.15 +For testing you can run minicom thus: minicom -D /tmp/ttyeqemu
    1.16 +
    1.17 +
    1.18 +build instructions
    1.19 +------------------
    1.20 +dependencies:
    1.21 +- OpenGL
    1.22 +- GLEW
    1.23 +- libpng
    1.24 +- libjpeg
    1.25 +- zlib
    1.26 +
    1.27 +After installing all necessary depdencies, just type make.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/RUN	Fri Jul 18 05:44:37 2014 +0300
     2.3 @@ -0,0 +1,13 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +socat PTY,link=emuport PTY,link=/tmp/ttyeqemu &
     2.7 +if [ $? != 0 ]; then
     2.8 +	echo "failed to create PTY pair" >&2
     2.9 +	exit 1
    2.10 +fi
    2.11 +
    2.12 +echo 'starting equeue system emulator. connect to the /tmp/ttyeqemu fake serial port'
    2.13 +
    2.14 +./eqemu emuport
    2.15 +
    2.16 +kill %1		# kill socat
     3.1 --- a/src/dev.cc	Fri Jul 18 05:07:40 2014 +0300
     3.2 +++ b/src/dev.cc	Fri Jul 18 05:44:37 2014 +0300
     3.3 @@ -12,6 +12,8 @@
     3.4  #include "dev.h"
     3.5  #include "timer.h"
     3.6  
     3.7 +void post_redisplay();	// defined in main.cc
     3.8 +
     3.9  int customer, ticket;
    3.10  static int report_inputs, cmd_echo;
    3.11  static long last_ticket_msec = LONG_MIN;
    3.12 @@ -106,6 +108,8 @@
    3.13  	if(report_inputs) {
    3.14  		fprintf(fp, "ticket: %d\n", ticket);
    3.15  	}
    3.16 +
    3.17 +	post_redisplay();
    3.18  }
    3.19  
    3.20  void next_customer()
    3.21 @@ -116,6 +120,8 @@
    3.22  		if(report_inputs) {
    3.23  			fprintf(fp, "customer: %d\n", customer);
    3.24  		}
    3.25 +
    3.26 +		post_redisplay();
    3.27  	}
    3.28  }
    3.29  
    3.30 @@ -162,6 +168,7 @@
    3.31  		customer = 0;
    3.32  		ticket = 0;
    3.33  		last_ticket_msec = LONG_MIN;
    3.34 +		post_redisplay();
    3.35  		break;
    3.36  
    3.37  	case 't':
     4.1 --- a/src/main.cc	Fri Jul 18 05:07:40 2014 +0300
     4.2 +++ b/src/main.cc	Fri Jul 18 05:44:37 2014 +0300
     4.3 @@ -19,6 +19,7 @@
     4.4  	GLOW_PASS
     4.5  };
     4.6  
     4.7 +void post_redisplay();
     4.8  static bool init();
     4.9  static void cleanup();
    4.10  static void display();
    4.11 @@ -109,6 +110,11 @@
    4.12  	return 0;
    4.13  }
    4.14  
    4.15 +void post_redisplay()
    4.16 +{
    4.17 +	draw_pending = true;
    4.18 +}
    4.19 +
    4.20  static bool init()
    4.21  {
    4.22  	if(fake_devpath) {
    4.23 @@ -509,7 +515,7 @@
    4.24  
    4.25  	unsigned int evmask = StructureNotifyMask | VisibilityChangeMask | ExposureMask |
    4.26  		KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
    4.27 -		PointerMotionMask;
    4.28 +		PointerMotionMask | LeaveWindowMask;
    4.29  	XSelectInput(dpy, win, evmask);
    4.30  
    4.31  	xa_wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False);
    4.32 @@ -600,6 +606,13 @@
    4.33  			}
    4.34  			break;
    4.35  
    4.36 +		case LeaveNotify:
    4.37 +			if(ev.xcrossing.mode == NotifyNormal) {
    4.38 +				cam_theta = cam_phi = 0;
    4.39 +				draw_pending = true;
    4.40 +			}
    4.41 +			break;
    4.42 +
    4.43  		default:
    4.44  			break;
    4.45  		}