/[rdesktop]/sourceforge.net/trunk/rdesktop/serial.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/serial.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 809 by stargo, Mon Jan 10 21:54:47 2005 UTC revision 812 by jdmeijer, Mon Feb 14 00:34:23 2005 UTC
# Line 121  Line 121 
121    
122  /* FIONREAD should really do the same thing as TIOCINQ, where it is  /* FIONREAD should really do the same thing as TIOCINQ, where it is
123   * not available */   * not available */
124  #ifndef TIOCINQ  #if !defined(TIOCINQ) && defined(FIONREAD)
125  #define TIOCINQ FIONREAD  #define TIOCINQ FIONREAD
126  #endif  #endif
127  #ifndef TIOCOUTQ  #if !defined(TIOCOUTQ) && defined(FIONWRITE)
128  #define TIOCOUTQ FIONWRITE  #define TIOCOUTQ FIONWRITE
129  #endif  #endif
130    
# Line 646  serial_read(NTHANDLE handle, uint8 * dat Line 646  serial_read(NTHANDLE handle, uint8 * dat
646          }          }
647          tcsetattr(handle, TCSANOW, ptermios);          tcsetattr(handle, TCSANOW, ptermios);
648    
649  #ifdef WITH_DEBUG_SERIAL  #if defined(WITH_DEBUG_SERIAL) && defined(TIOCINQ)
650          ioctl(handle, TIOCINQ, &bytes_inqueue);          ioctl(handle, TIOCINQ, &bytes_inqueue);
651          DEBUG_SERIAL(("serial_read inqueue: %d expected %d\n", bytes_inqueue, length));          DEBUG_SERIAL(("serial_read inqueue: %d expected %d\n", bytes_inqueue, length));
652  #endif  #endif
# Line 794  serial_device_control(NTHANDLE handle, u Line 794  serial_device_control(NTHANDLE handle, u
794                          break;                          break;
795                  case SERIAL_GET_WAIT_MASK:                  case SERIAL_GET_WAIT_MASK:
796                          DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n",                          DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n",
797                                        pser_inf->wait_mask); out_uint32(out, pser_inf->wait_mask));                                        pser_inf->wait_mask);
798                                         out_uint32(out, pser_inf->wait_mask));
799                          break;                          break;
800                  case SERIAL_SET_WAIT_MASK:                  case SERIAL_SET_WAIT_MASK:
801                          in_uint32(in, pser_inf->wait_mask);                          in_uint32(in, pser_inf->wait_mask);
# Line 854  serial_device_control(NTHANDLE handle, u Line 855  serial_device_control(NTHANDLE handle, u
855                          out_uint32_le(out, 0);  /* Hold reasons */                          out_uint32_le(out, 0);  /* Hold reasons */
856    
857                          result = 0;                          result = 0;
858    #ifdef TIOCINQ
859                          ioctl(handle, TIOCINQ, &result);                          ioctl(handle, TIOCINQ, &result);
860    #endif
861                          out_uint32_le(out, result);     /* Amount in in queue */                          out_uint32_le(out, result);     /* Amount in in queue */
862                          if (result)                          if (result)
863                                  DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n",                                  DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n",
864                                                result));                                                result));
865    
866                          result = 0;                          result = 0;
867    #ifdef TIOCOUTQ
868                          ioctl(handle, TIOCOUTQ, &result);                          ioctl(handle, TIOCOUTQ, &result);
869    #endif
870                          out_uint32_le(out, result);     /* Amount in out queue */                          out_uint32_le(out, result);     /* Amount in out queue */
871                          if (result)                          if (result)
872                                  DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS out queue %d\n", result));                                  DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS out queue %d\n", result));
# Line 934  serial_get_event(NTHANDLE handle, uint32 Line 939  serial_get_event(NTHANDLE handle, uint32
939          if (index < 0)          if (index < 0)
940                  return False;                  return False;
941    
942    #ifdef TIOCINQ
943          pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data;          pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data;
944    
   
945          ioctl(handle, TIOCINQ, &bytes);          ioctl(handle, TIOCINQ, &bytes);
946    
947          if (bytes > 0)          if (bytes > 0)
# Line 972  serial_get_event(NTHANDLE handle, uint32 Line 977  serial_get_event(NTHANDLE handle, uint32
977          {          {
978                  pser_inf->event_rlsd = 0;                  pser_inf->event_rlsd = 0;
979          }          }
980    #endif
981    
982    #ifdef TIOCOUTQ
983          ioctl(handle, TIOCOUTQ, &bytes);          ioctl(handle, TIOCOUTQ, &bytes);
984          if ((bytes == 0)          if ((bytes == 0)
985              && (pser_inf->event_txempty > 0) && (pser_inf->wait_mask & SERIAL_EV_TXEMPTY))              && (pser_inf->event_txempty > 0) && (pser_inf->wait_mask & SERIAL_EV_TXEMPTY))
# Line 984  serial_get_event(NTHANDLE handle, uint32 Line 990  serial_get_event(NTHANDLE handle, uint32
990                  ret = True;                  ret = True;
991          }          }
992          pser_inf->event_txempty = bytes;          pser_inf->event_txempty = bytes;
993    #endif
994    
995          ioctl(handle, TIOCMGET, &bytes);          ioctl(handle, TIOCMGET, &bytes);
996          if ((bytes & TIOCM_DSR) != pser_inf->event_dsr)          if ((bytes & TIOCM_DSR) != pser_inf->event_dsr)

Legend:
Removed from v.809  
changed lines
  Added in v.812

  ViewVC Help
Powered by ViewVC 1.1.26