8 |
#include <unistd.h> |
#include <unistd.h> |
9 |
#include <fcntl.h> |
#include <fcntl.h> |
10 |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
|
#include <linux/lp.h> |
|
11 |
#include <errno.h> |
#include <errno.h> |
12 |
|
|
13 |
|
#if defined(__linux__) |
14 |
|
#include <linux/lp.h> |
15 |
|
#endif |
16 |
|
|
17 |
extern int errno; |
extern int errno; |
18 |
|
|
19 |
extern RDPDR_DEVICE g_rdpdr_device[]; |
extern RDPDR_DEVICE g_rdpdr_device[]; |
89 |
if (fcntl(parallel_fd, F_SETFL, O_NONBLOCK) == -1) |
if (fcntl(parallel_fd, F_SETFL, O_NONBLOCK) == -1) |
90 |
perror("fcntl"); |
perror("fcntl"); |
91 |
|
|
92 |
|
#if defined(LPABORT) |
93 |
|
/* Retry on errors */ |
94 |
ioctl(parallel_fd, LPABORT, (int) 1); |
ioctl(parallel_fd, LPABORT, (int) 1); |
95 |
|
#endif |
96 |
|
|
97 |
g_rdpdr_device[device_id].handle = parallel_fd; |
g_rdpdr_device[device_id].handle = parallel_fd; |
98 |
|
|
140 |
default: |
default: |
141 |
rc = STATUS_DEVICE_POWERED_OFF; |
rc = STATUS_DEVICE_POWERED_OFF; |
142 |
} |
} |
143 |
|
#if defined(LPGETSTATUS) |
144 |
if (ioctl(handle, LPGETSTATUS, &status) == 0) |
if (ioctl(handle, LPGETSTATUS, &status) == 0) |
145 |
{ |
{ |
146 |
/* coming soon: take care for the printer status */ |
/* coming soon: take care for the printer status */ |
147 |
printf("parallel_write: status = %d, errno = %d\n", status, errno); |
printf("parallel_write: status = %d, errno = %d\n", status, errno); |
148 |
} |
} |
149 |
|
#endif |
150 |
} |
} |
151 |
*result = n; |
*result = n; |
152 |
return rc; |
return rc; |