Diff for /np2/x11/cmserial.c between versions 1.2 and 1.8

version 1.2, 2004/06/17 14:28:39 version 1.8, 2012/01/23 04:23:10
Line 1 Line 1
 /*      $Id$    */  
   
 /*  /*
  * Copyright (c) 2004 NONAKA Kimihiro   * Copyright (c) 2004 NONAKA Kimihiro
  * All rights reserved.   * All rights reserved.
Line 12 Line 10
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 96  serialgetstat(COMMNG self) Line 92  serialgetstat(COMMNG self)
         int rv;          int rv;
   
         rv = ioctl(serial->hdl, TIOCMGET, &status);          rv = ioctl(serial->hdl, TIOCMGET, &status);
           if (rv < 0) {
                   VERBOSE(("serialgetstat: ioctl: %s", strerror(errno)));
                   return 0x20;
           }
         if (!(status & TIOCM_DSR)) {          if (!(status & TIOCM_DSR)) {
                 VERBOSE(("serialgetstat: DSR is disable"));                  VERBOSE(("serialgetstat: DSR is disable"));
                 return 0x20;                  return 0x20;
Line 136  print_status(const struct termios *tio) Line 136  print_status(const struct termios *tio)
         speed_t ispeed = cfgetispeed(tio);          speed_t ispeed = cfgetispeed(tio);
         speed_t ospeed = cfgetospeed(tio);          speed_t ospeed = cfgetospeed(tio);
   
         fprintf(stderr, " ispeed %d", ispeed);          g_printerr(" ispeed %d", ispeed);
         fprintf(stderr, " ospeed %d", ospeed);          g_printerr(" ospeed %d", ospeed);
         fprintf(stderr, "%s", "\r\n");          g_printerr("%s", "\r\n");
         fprintf(stderr, " %cIGNBRK", (tio->c_iflag & IGNBRK) ? '+' : '-');          g_printerr(" %cIGNBRK", (tio->c_iflag & IGNBRK) ? '+' : '-');
         fprintf(stderr, " %cBRKINT", (tio->c_iflag & BRKINT) ? '+' : '-');          g_printerr(" %cBRKINT", (tio->c_iflag & BRKINT) ? '+' : '-');
         fprintf(stderr, " %cIGNPAR", (tio->c_iflag & IGNPAR) ? '+' : '-');          g_printerr(" %cIGNPAR", (tio->c_iflag & IGNPAR) ? '+' : '-');
         fprintf(stderr, " %cPARMRK", (tio->c_iflag & PARMRK) ? '+' : '-');          g_printerr(" %cPARMRK", (tio->c_iflag & PARMRK) ? '+' : '-');
         fprintf(stderr, " %cINPCK", (tio->c_iflag & INPCK) ? '+' : '-');          g_printerr(" %cINPCK", (tio->c_iflag & INPCK) ? '+' : '-');
         fprintf(stderr, " %cISTRIP", (tio->c_iflag & ISTRIP) ? '+' : '-');          g_printerr(" %cISTRIP", (tio->c_iflag & ISTRIP) ? '+' : '-');
         fprintf(stderr, " %cINLCR", (tio->c_iflag & INLCR) ? '+' : '-');          g_printerr(" %cINLCR", (tio->c_iflag & INLCR) ? '+' : '-');
         fprintf(stderr, " %cIGNCR", (tio->c_iflag & IGNCR) ? '+' : '-');          g_printerr(" %cIGNCR", (tio->c_iflag & IGNCR) ? '+' : '-');
         fprintf(stderr, " %cICRNL", (tio->c_iflag & ICRNL) ? '+' : '-');          g_printerr(" %cICRNL", (tio->c_iflag & ICRNL) ? '+' : '-');
         fprintf(stderr, " %cIXON", (tio->c_iflag & IXON) ? '+' : '-');          g_printerr(" %cIXON", (tio->c_iflag & IXON) ? '+' : '-');
         fprintf(stderr, " %cIXOFF", (tio->c_iflag & IXOFF) ? '+' : '-');          g_printerr(" %cIXOFF", (tio->c_iflag & IXOFF) ? '+' : '-');
         fprintf(stderr, " %cIXANY", (tio->c_iflag & IXANY) ? '+' : '-');          g_printerr(" %cIXANY", (tio->c_iflag & IXANY) ? '+' : '-');
         fprintf(stderr, " %cIMAXBEL", (tio->c_iflag & IMAXBEL) ? '+' : '-');          g_printerr(" %cIMAXBEL", (tio->c_iflag & IMAXBEL) ? '+' : '-');
         fprintf(stderr, "%s", "\r\n");          g_printerr("%s", "\r\n");
         fprintf(stderr, " %cOPOST", (tio->c_oflag & OPOST) ? '+' : '-');          g_printerr(" %cOPOST", (tio->c_oflag & OPOST) ? '+' : '-');
         fprintf(stderr, " %cONLCR", (tio->c_oflag & ONLCR) ? '+' : '-');          g_printerr(" %cONLCR", (tio->c_oflag & ONLCR) ? '+' : '-');
 #ifdef OXTABS  #ifdef OXTABS
         fprintf(stderr, " %cOXTABS", (tio->c_oflag & OXTABS) ? '+' : '-');          g_printerr(" %cOXTABS", (tio->c_oflag & OXTABS) ? '+' : '-');
 #endif  #endif
 #ifdef TABDLY  #ifdef TABDLY
         fprintf(stderr, " %cTABDLY", (tio->c_oflag & TABDLY) == XTABS ? '+' : '-');          g_printerr(" %cTABDLY", (tio->c_oflag & TABDLY) == XTABS ? '+' : '-');
 #endif  #endif
 #ifdef ONOEOT  #ifdef ONOEOT
         fprintf(stderr, " %cONOEOT", (tio->c_oflag & ONOEOT) ? '+' : '-');          g_printerr(" %cONOEOT", (tio->c_oflag & ONOEOT) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, "%s", "\r\n");          g_printerr("%s", "\r\n");
   
         cs = tio->c_cflag & CSIZE;          cs = tio->c_cflag & CSIZE;
         switch (cs) {          switch (cs) {
Line 188  print_status(const struct termios *tio) Line 188  print_status(const struct termios *tio)
                 csstr = "?";                  csstr = "?";
                 break;                  break;
         }          }
         fprintf(stderr, " cs%s", csstr);          g_printerr(" cs%s", csstr);
         fprintf(stderr, " %cCSTOPB", (tio->c_cflag & CSTOPB) ? '+' : '-');          g_printerr(" %cCSTOPB", (tio->c_cflag & CSTOPB) ? '+' : '-');
         fprintf(stderr, " %cCREAD", (tio->c_cflag & CREAD) ? '+' : '-');          g_printerr(" %cCREAD", (tio->c_cflag & CREAD) ? '+' : '-');
         fprintf(stderr, " %cPARENB", (tio->c_cflag & PARENB) ? '+' : '-');          g_printerr(" %cPARENB", (tio->c_cflag & PARENB) ? '+' : '-');
         fprintf(stderr, " %cPARODD", (tio->c_cflag & PARODD) ? '+' : '-');          g_printerr(" %cPARODD", (tio->c_cflag & PARODD) ? '+' : '-');
         fprintf(stderr, " %cHUPCL", (tio->c_cflag & HUPCL) ? '+' : '-');          g_printerr(" %cHUPCL", (tio->c_cflag & HUPCL) ? '+' : '-');
         fprintf(stderr, " %cCLOCAL", (tio->c_cflag & CLOCAL) ? '+' : '-');          g_printerr(" %cCLOCAL", (tio->c_cflag & CLOCAL) ? '+' : '-');
 #ifdef CCTS_OFLOW  #ifdef CCTS_OFLOW
         fprintf(stderr, " %cCCTS_OFLOW", (tio->c_cflag & CCTS_OFLOW) ? '+' : '-');          g_printerr(" %cCCTS_OFLOW", (tio->c_cflag & CCTS_OFLOW) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, " %cCRTSCTS", (tio->c_cflag & CRTSCTS) ? '+' : '-');          g_printerr(" %cCRTSCTS", (tio->c_cflag & CRTSCTS) ? '+' : '-');
 #ifdef CRTS_IFLOW  #ifdef CRTS_IFLOW
         fprintf(stderr, " %cCRTS_IFLOW", (tio->c_cflag & CRTS_IFLOW) ? '+' : '-');          g_printerr(" %cCRTS_IFLOW", (tio->c_cflag & CRTS_IFLOW) ? '+' : '-');
 #endif  #endif
 #ifdef MDMBUF  #ifdef MDMBUF
         fprintf(stderr, " %cMDMBUF", (tio->c_cflag & MDMBUF) ? '+' : '-');          g_printerr(" %cMDMBUF", (tio->c_cflag & MDMBUF) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, " %cECHOKE", (tio->c_lflag & ECHOKE) ? '+' : '-');          g_printerr(" %cECHOKE", (tio->c_lflag & ECHOKE) ? '+' : '-');
         fprintf(stderr, " %cECHOE", (tio->c_lflag & ECHOE) ? '+' : '-');          g_printerr(" %cECHOE", (tio->c_lflag & ECHOE) ? '+' : '-');
         fprintf(stderr, " %cECHO", (tio->c_lflag & ECHO) ? '+' : '-');          g_printerr(" %cECHO", (tio->c_lflag & ECHO) ? '+' : '-');
         fprintf(stderr, " %cECHONL", (tio->c_lflag & ECHONL) ? '+' : '-');          g_printerr(" %cECHONL", (tio->c_lflag & ECHONL) ? '+' : '-');
         fprintf(stderr, " %cECHOPRT", (tio->c_lflag & ECHOPRT) ? '+' : '-');          g_printerr(" %cECHOPRT", (tio->c_lflag & ECHOPRT) ? '+' : '-');
         fprintf(stderr, " %cECHOCTL", (tio->c_lflag & ECHOCTL) ? '+' : '-');          g_printerr(" %cECHOCTL", (tio->c_lflag & ECHOCTL) ? '+' : '-');
         fprintf(stderr, " %cISIG", (tio->c_lflag & ISIG) ? '+' : '-');          g_printerr(" %cISIG", (tio->c_lflag & ISIG) ? '+' : '-');
         fprintf(stderr, " %cICANON", (tio->c_lflag & ICANON) ? '+' : '-');          g_printerr(" %cICANON", (tio->c_lflag & ICANON) ? '+' : '-');
 #ifdef ALTWERASE  #ifdef ALTWERASE
         fprintf(stderr, " %cALTWERASE", (tio->c_lflag & ALTWERASE) ? '+' : '-');          g_printerr(" %cALTWERASE", (tio->c_lflag & ALTWERASE) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, " %cIEXTEN", (tio->c_lflag & IEXTEN) ? '+' : '-');          g_printerr(" %cIEXTEN", (tio->c_lflag & IEXTEN) ? '+' : '-');
         fprintf(stderr, "%s", "\r\n");          g_printerr("%s", "\r\n");
 #ifdef EXTPROC  #ifdef EXTPROC
         fprintf(stderr, " %cEXTPROC", (tio->c_lflag & EXTPROC) ? '+' : '-');          g_printerr(" %cEXTPROC", (tio->c_lflag & EXTPROC) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, " %cTOSTOP", (tio->c_lflag & TOSTOP) ? '+' : '-');          g_printerr(" %cTOSTOP", (tio->c_lflag & TOSTOP) ? '+' : '-');
         fprintf(stderr, " %cFLUSHO", (tio->c_lflag & FLUSHO) ? '+' : '-');          g_printerr(" %cFLUSHO", (tio->c_lflag & FLUSHO) ? '+' : '-');
 #ifdef NOKERNINFO  #ifdef NOKERNINFO
         fprintf(stderr, " %cNOKERNINFO", (tio->c_lflag & NOKERNINFO) ? '+' : '-');          g_printerr(" %cNOKERNINFO", (tio->c_lflag & NOKERNINFO) ? '+' : '-');
 #endif  #endif
         fprintf(stderr, " %cPENDIN", (tio->c_lflag & PENDIN) ? '+' : '-');          g_printerr(" %cPENDIN", (tio->c_lflag & PENDIN) ? '+' : '-');
         fprintf(stderr, " %cNOFLSH", (tio->c_lflag & NOFLSH) ? '+' : '-');          g_printerr(" %cNOFLSH", (tio->c_lflag & NOFLSH) ? '+' : '-');
         fprintf(stderr, "%s", "\r\n");          g_printerr("%s", "\r\n");
 }  }
 #endif  #endif
   
Line 334  cmserial_create(UINT port, BYTE param, U Line 334  cmserial_create(UINT port, BYTE param, U
   
         /* set misc flag */          /* set misc flag */
         cfmakeraw(&options);          cfmakeraw(&options);
         options.c_cflag |= CLOCAL | CREAD;      /* enable recv and local mode */          options.c_cflag |= CLOCAL | CREAD;
         options.c_cflag |= CRTSCTS;             /* hard flow */          options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
         options.c_iflag |= ~(IXON | IXOFF);  
   
 #if defined(SERIAL_DEBUG)  #if defined(SERIAL_DEBUG)
         print_status(&options);          print_status(&options);

Removed from v.1.2  
changed lines
  Added in v.1.8


RetroPC.NET-CVS <cvs@retropc.net>