/[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 622 by n-ki, Thu Mar 4 08:01:07 2004 UTC revision 755 by stargo, Tue Aug 24 21:37:25 2004 UTC
# Line 73  Line 73 
73  #define SERIAL_EV_EVENT1           0x0800       // Provider specific event 1  #define SERIAL_EV_EVENT1           0x0800       // Provider specific event 1
74  #define SERIAL_EV_EVENT2           0x1000       // Provider specific event 2  #define SERIAL_EV_EVENT2           0x1000       // Provider specific event 2
75    
76    #ifndef CRTSCTS
77    #define CRTSCTS 0
78    #endif
79    
80    
81  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
82    
83  SERIAL_DEVICE *  static SERIAL_DEVICE *
84  get_serial_info(HANDLE handle)  get_serial_info(HANDLE handle)
85  {  {
86          int index;          int index;
# Line 89  get_serial_info(HANDLE handle) Line 93  get_serial_info(HANDLE handle)
93          return NULL;          return NULL;
94  }  }
95    
96  BOOL  static BOOL
97  get_termios(SERIAL_DEVICE * pser_inf, HANDLE serial_fd)  get_termios(SERIAL_DEVICE * pser_inf, HANDLE serial_fd)
98  {  {
99          speed_t speed;          speed_t speed;
# Line 370  serial_enum_devices(uint32 * id, char *o Line 374  serial_enum_devices(uint32 * id, char *o
374                  // Init data structures for device                  // Init data structures for device
375                  pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE));                  pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE));
376                  pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios));                  pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios));
377                    memset(pser_inf->ptermios, 0, sizeof(struct termios));
378                  pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios));                  pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios));
379                    memset(pser_inf->pold_termios, 0, sizeof(struct termios));
380    
381                  pos2 = next_arg(optarg, '=');                  pos2 = next_arg(optarg, '=');
382                  strcpy(g_rdpdr_device[*id].name, optarg);                  strcpy(g_rdpdr_device[*id].name, optarg);
# Line 392  serial_enum_devices(uint32 * id, char *o Line 398  serial_enum_devices(uint32 * id, char *o
398          return count;          return count;
399  }  }
400    
401  NTSTATUS  static NTSTATUS
402  serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,  serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,
403                uint32 flags_and_attributes, char *filename, HANDLE * handle)                uint32 flags_and_attributes, char *filename, HANDLE * handle)
404  {  {
# Line 402  serial_create(uint32 device_id, uint32 a Line 408  serial_create(uint32 device_id, uint32 a
408    
409          pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data;          pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data;
410          ptermios = pser_inf->ptermios;          ptermios = pser_inf->ptermios;
411          serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY);          serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK);
412    
413          if (serial_fd == -1)          if (serial_fd == -1)
414          {          {
# Line 433  serial_create(uint32 device_id, uint32 a Line 439  serial_create(uint32 device_id, uint32 a
439          tcsetattr(serial_fd, TCSANOW, ptermios);          tcsetattr(serial_fd, TCSANOW, ptermios);
440  */  */
441    
442            cfmakeraw(pser_inf->ptermios);
443          *handle = serial_fd;          *handle = serial_fd;
444    
445          /* all read and writes should be non blocking */          /* all read and writes should be non blocking */
# Line 452  serial_close(HANDLE handle) Line 459  serial_close(HANDLE handle)
459          return STATUS_SUCCESS;          return STATUS_SUCCESS;
460  }  }
461    
462  NTSTATUS  static NTSTATUS
463  serial_read(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)  serial_read(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
464  {  {
465          long timeout;          long timeout;
# Line 499  serial_read(HANDLE handle, uint8 * data, Line 506  serial_read(HANDLE handle, uint8 * data,
506          return STATUS_SUCCESS;          return STATUS_SUCCESS;
507  }  }
508    
509  NTSTATUS  static NTSTATUS
510  serial_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)  serial_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
511  {  {
512          *result = write(handle, data, length);          *result = write(handle, data, length);
# Line 509  serial_write(HANDLE handle, uint8 * data Line 516  serial_write(HANDLE handle, uint8 * data
516  static NTSTATUS  static NTSTATUS
517  serial_device_control(HANDLE handle, uint32 request, STREAM in, STREAM out)  serial_device_control(HANDLE handle, uint32 request, STREAM in, STREAM out)
518  {  {
519    #if 0
520          int flush_mask, purge_mask;          int flush_mask, purge_mask;
521    #endif
522          uint32 result;          uint32 result;
523          uint8 immediate;          uint8 immediate;
524          SERIAL_DEVICE *pser_inf;          SERIAL_DEVICE *pser_inf;

Legend:
Removed from v.622  
changed lines
  Added in v.755

  ViewVC Help
Powered by ViewVC 1.1.26