1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
--- lxsys.c.orig 2007-11-05 15:40:27.000000000 -0500
+++ lxsys.c 2007-12-18 15:46:41.000000000 -0500
@@ -1,12 +1,14 @@
-
-#include <sys/io.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/cpufunc.h>
+#include <machine/sysarch.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/time.h>
#include <sys/resource.h>
#include <semaphore.h>
#include <pthread.h>
#include <sched.h>
-#include <sys/time.h>
#include <fcntl.h>
#include <termios.h>
#include "thrdef.h"
@@ -18,8 +20,9 @@
#include "hwaredef.h"
struct termios old_options;
-char serport_name[]="/dev/ttyS?";
+char serport_name[]="/dev/ttyd?";
+extern int saved_euid;
void lir_mutex_init(void)
{
@@ -173,15 +176,13 @@
int lir_parport_permission(void)
{
-int i;
+int i=0;
// Get permission to write to the parallel port
if(ui.parport < 0x400-4)
{
- i=ioperm(ui.parport,4,1);
- }
-else
- {
- i=iopl(3);
+ seteuid(saved_euid);
+ i=i386_set_ioperm(ui.parport,4,1);
+ seteuid(getuid());
}
if(i != 0)
{
@@ -331,11 +332,9 @@
int i;
if(ui.parport < 0x400-4)
{
- i=ioperm(ui.parport,4,1);
- }
-else
- {
- i=iopl(3);
+ seteuid(saved_euid);
+ i=i386_set_ioperm(ui.parport,4,1);
+ seteuid(getuid());
}
if(i!=0)lirerr(764921);
i=1000;
@@ -348,11 +347,9 @@
int i;
if(ui.parport < 0x400-4)
{
- i=ioperm(ui.parport,4,1);
- }
-else
- {
- i=iopl(3);
+ seteuid(saved_euid);
+ i=i386_set_ioperm(ui.parport,4,1);
+ seteuid(getuid());
}
if(i!=0)lirerr(764921);
return inb(port);
|