Quoting Julia A . Case ([EMAIL PROTECTED]):
> A few years ago I wrote a patch to dosemu to use virtual modems.  I'm
> unable to make it work under the current releases of dosemu.  Is someone
> able to help me update my diff to work better with the current dosemu?
> I'll attach the diff as a attachment.
> 
> Julie
> 

Here is a more up to date diff that applies clean on 0.98.8.  It still
doesn't work like it should, but it is one step closer.

Julie

-- 
[  Julia Anne Case  ] [        Ships are safe inside the harbor,       ]
[Programmer at large] [      but is that what ships are really for.    ]  
[   Admining Linux  ] [           To thine own self be true.           ]
[ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]
          
diff -ru dosemu-0.98.8/src/base/init/lexer.l dosemu/src/base/init/lexer.l
--- dosemu-0.98.8/src/base/init/lexer.l Sun Jul  4 15:32:14 1999
+++ dosemu/src/base/init/lexer.l        Sun Oct 10 14:00:56 1999
@@ -488,6 +488,7 @@
 baudrate               RETURN(BAUDRATE);
 device                 RETURN(DEVICE);
 com                     RETURN(COM);
+virtual                        RETURN(VIRTUAL);
 
        /* lock file stuff */
 directory              RETURN(DIRECTORY);
diff -ru dosemu-0.98.8/src/base/init/parser.y dosemu/src/base/init/parser.y
--- dosemu-0.98.8/src/base/init/parser.y        Sun Jul  4 15:46:02 1999
+++ dosemu/src/base/init/parser.y       Sun Oct 10 14:03:54 1999
@@ -93,6 +93,7 @@
 static int dexe_secure = 1;
 char own_hostname[128];
 
+extern int no_local_video;
 extern struct printer lpt[NUM_PRINTERS];
 static struct printer *pptr;
 static struct printer nullptr;
@@ -270,7 +271,7 @@
         /* lock files */
 %token DIRECTORY NAMESTUB BINARY
        /* serial */
-%token BASE IRQ INTERRUPT DEVICE CHARSET  BAUDRATE
+%token BASE IRQ INTERRUPT DEVICE CHARSET  BAUDRATE VIRTUAL
        /* mouse */
 %token MICROSOFT MS3BUTTON LOGITECH MMSERIES MOUSEMAN HITACHI MOUSESYSTEMS BUSMOUSE 
PS2
 %token INTERNALDRIVER EMULATE3BUTTONS CLEARDTR
@@ -1285,6 +1286,9 @@
 serial_flag    : DEVICE string_expr            { strcpy(sptr->dev, $2);
                                          if (!strcmp("/dev/mouse",sptr->dev)) 
sptr->mouse=1;
                                          free($2); }
+               | VIRTUAL                 {sptr->virtual = TRUE;
+                                          no_local_video = 1;
+                                          strcpy(sptr->dev, ttyname(0));}
                | COM expression                { sptr->real_comport = $2;
                                          com_port_used[$2] = 1; }
                | BASE expression               { sptr->base_port = $2; }
@@ -1762,6 +1766,7 @@
     sptr->real_comport = 0;
     sptr->fd = -1;
     sptr->mouse = 0;
+    sptr->virtual = FALSE;
   }
 }
 
diff -ru dosemu-0.98.8/src/base/serial/ser_init.c dosemu/src/base/serial/ser_init.c
--- dosemu-0.98.8/src/base/serial/ser_init.c    Fri Jan 15 18:28:56 1999
+++ dosemu/src/base/serial/ser_init.c   Sun Oct 10 13:58:41 1999
@@ -68,6 +68,8 @@
 #include "priv.h"
 #include "utilities.h" /* due to getpwnam */
 
+int no_local_video = 0;
+
 /* See README.serial file for more information on the com[] structure 
  * The declarations for this is in ../include/serial.h
  */
@@ -236,18 +238,29 @@
   
   if (com[num].fd != -1) return (com[num].fd);
   
-  if ( tty_lock(com[num].dev, 1) >= 0) {               /* Lock port */
-    /* We know that we have access to the serial port */
-    com[num].dev_locked = TRUE;
-    
-    /* If the port is used for a mouse, then remove lockfile, because
-     * the use of the mouse serial port can be switched between processes,
-     * such as on Linux virtual consoles.
-     */
-    if (com[num].mouse)
-      if (tty_lock(com[num].dev, 0) >= 0)              /* Unlock port */
-        com[num].dev_locked = FALSE;
+  if ( com[num].virtual )
+  {
+    if (tty_lock(com[num].dev, 0) >= 0)
+    {
+      dbug_printf("Opening Virtual Port\n");
+      com[num].dev_locked = FALSE;
+      com[num].fd = 0;
+      no_local_video = 1;
+    }
   }
+  else
+    if ( tty_lock(com[num].dev, 1) >= 0) {             /* Lock port */
+      /* We know that we have access to the serial port */
+      com[num].dev_locked = TRUE;
+    
+      /* If the port is used for a mouse, then remove lockfile, because
+       * the use of the mouse serial port can be switched between processes,
+       * such as on Linux virtual consoles.
+       */
+      if (com[num].mouse)
+        if (tty_lock(com[num].dev, 0) >= 0)            /* Unlock port */
+          com[num].dev_locked = FALSE;
+    }
   else {
     /* The port is in use by another process!  Don't touch the port! */
     com[num].dev_locked = FALSE;
@@ -530,8 +543,10 @@
 
   /* Pull down DTR and RTS.  This is the most natural for most comm */
   /* devices including mice so that DTR rises during mouse init.    */
-  data = TIOCM_DTR | TIOCM_RTS;
-  ioctl(com[num].fd, TIOCMBIC, &data);
+  if(!com[num].fd, TIOCMBIC, &data) {
+    data = TIOCM_DTR | TIOCM_RTS;
+    ioctl(com[num].fd, TIOCMBIC, &data);
+  }
 }
 
 
diff -ru dosemu-0.98.8/src/base/serial/ser_irq.c dosemu/src/base/serial/ser_irq.c
--- dosemu-0.98.8/src/base/serial/ser_irq.c     Fri Jan 15 18:28:56 1999
+++ dosemu/src/base/serial/ser_irq.c    Sun Oct 10 13:58:41 1999
@@ -214,10 +214,16 @@
   
   ioctl(com[num].fd, TIOCMGET, &control);      /* WARNING: Non re-entrant! */
   
-  newmsr = convert_bit(control, TIOCM_CTS, UART_MSR_CTS) |
-           convert_bit(control, TIOCM_DSR, UART_MSR_DSR) |
-           convert_bit(control, TIOCM_RNG, UART_MSR_RI) |
-           convert_bit(control, TIOCM_CAR, UART_MSR_DCD);
+  if(com[num].virtual)
+    newmsr = UART_MSR_CTS |
+             convert_bit(control, TIOCM_DSR, UART_MSR_DSR) |
+             convert_bit(control, TIOCM_RNG, UART_MSR_RI) |
+             UART_MSR_DCD;
+  else
+    newmsr = convert_bit(control, TIOCM_CTS, UART_MSR_CTS) |
+             convert_bit(control, TIOCM_DSR, UART_MSR_DSR) |
+             convert_bit(control, TIOCM_RNG, UART_MSR_RI) |
+             convert_bit(control, TIOCM_CAR, UART_MSR_DCD);
            
   delta = msr_compute_delta_bits(com[num].MSR, newmsr);
   
diff -ru dosemu-0.98.8/src/env/video/terminal.c dosemu/src/env/video/terminal.c
--- dosemu-0.98.8/src/env/video/terminal.c      Fri Jan 15 18:28:57 1999
+++ dosemu/src/env/video/terminal.c     Sun Oct 10 13:58:41 1999
@@ -62,6 +62,8 @@
  *      001          000           Underline
  *     anything else is invalid.
  */    
+extern int no_local_video;
+
 static int BW_Attribute_Map[256];
 static int Color_Attribute_Map[256];
 
@@ -213,8 +215,12 @@
    rotate[4] = 1; rotate[5] = 5;
    rotate[6] = 3; rotate[7] = 7;
    
-   Video_term.update_screen = slang_update;
-   
+   if(no_local_video!=1) {
+     Video_term.update_screen = slang_update;
+   }
+   else
+     Video_term.update_screen = NULL;
+
    SLang_Exit_Error_Hook = sl_exit_error;
    if (config.features[0]) SLtt_get_terminfo ();
    else if( !DOSemu_Slang_Got_Terminfo )
Only in dosemu/src/env/video: terminal.c~
diff -ru dosemu-0.98.8/src/include/serial.h dosemu/src/include/serial.h
--- dosemu-0.98.8/src/include/serial.h  Fri Jan 15 18:28:58 1999
+++ dosemu/src/include/serial.h Sun Oct 10 13:58:41 1999
@@ -55,6 +55,7 @@
   int real_comport;            /* The actual COMx port number. 0 for invalid */
   ioport_t base_port;          /* Base port address handled by device */
   int interrupt;               /* IRQ line handled by device */
+  boolean virtual;             /* virtual modem */
   boolean mouse;               /* Flag to turn on mouse sharing features */
   boolean dev_locked;           /* Flag to indicate that device is locked */
   boolean fossil_active;       /* Flag: FOSSIL emulation active */
Only in dosemu/src/include: serial.h~

Reply via email to