/[rdesktop]/sourceforge.net/trunk/rdesktop/parallel.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/parallel.c

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

revision 580 by astrand, Fri Jan 23 08:35:52 2004 UTC revision 589 by n-ki, Thu Jan 29 12:24:15 2004 UTC
# Line 4  Line 4 
4    
5  #define IOCTL_PAR_QUERY_RAW_DEVICE_ID   0x0c  #define IOCTL_PAR_QUERY_RAW_DEVICE_ID   0x0c
6    
 #define PARALLELDEV0                    "/dev/lp0"  
   
7  #include "rdesktop.h"  #include "rdesktop.h"
8  #include <unistd.h>  #include <unistd.h>
9  #include <fcntl.h>  #include <fcntl.h>
# Line 33  get_parallel_data(HANDLE handle) Line 31  get_parallel_data(HANDLE handle)
31  int  int
32  parallel_enum_devices(int *id, char *optarg)  parallel_enum_devices(int *id, char *optarg)
33  {  {
         //TODO: Read from configuration file? CUPS?  
34          PARALLEL_DEVICE *ppar_info;          PARALLEL_DEVICE *ppar_info;
35    
36          char *pos = optarg;          char *pos = optarg;
# Line 67  parallel_enum_devices(int *id, char *opt Line 64  parallel_enum_devices(int *id, char *opt
64  }  }
65    
66  static NTSTATUS  static NTSTATUS
67  parallel_create(uint32 device_id, HANDLE * handle)  parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags,
68                   char *filename, HANDLE * handle)
69  {  {
70          int parallel_fd;          int parallel_fd;
71    
72          parallel_fd = open(PARALLELDEV0, O_WRONLY);          parallel_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR);
73          if (parallel_fd == -1)          if (parallel_fd == -1) {
74                    perror("open");
75                  return STATUS_ACCESS_DENIED;                  return STATUS_ACCESS_DENIED;
76            }
77    
78            g_rdpdr_device[device_id].handle = parallel_fd;
79    
80          *handle = parallel_fd;          *handle = parallel_fd;
81          return STATUS_SUCCESS;          return STATUS_SUCCESS;
# Line 82  parallel_create(uint32 device_id, HANDLE Line 84  parallel_create(uint32 device_id, HANDLE
84  static NTSTATUS  static NTSTATUS
85  parallel_close(HANDLE handle)  parallel_close(HANDLE handle)
86  {  {
87            g_rdpdr_device[get_device_index(handle)].handle = 0;
88          close(handle);          close(handle);
89          return STATUS_SUCCESS;          return STATUS_SUCCESS;
90  }  }
91    
92    NTSTATUS
93    parallel_read(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
94    {
95            *result = read(handle, data, length);
96            return STATUS_SUCCESS;
97    }
98    
99  static NTSTATUS  static NTSTATUS
100  parallel_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)  parallel_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
101  {  {
# Line 120  parallel_device_control(HANDLE handle, u Line 130  parallel_device_control(HANDLE handle, u
130  DEVICE_FNS parallel_fns = {  DEVICE_FNS parallel_fns = {
131          parallel_create,          parallel_create,
132          parallel_close,          parallel_close,
133          NULL,          parallel_read,
134          parallel_write,          parallel_write,
135          parallel_device_control          parallel_device_control
136  };  };

Legend:
Removed from v.580  
changed lines
  Added in v.589

  ViewVC Help
Powered by ViewVC 1.1.26