-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_pilote.c
88 lines (53 loc) · 1.03 KB
/
test_pilote.c
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
82
83
84
85
86
87
88
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(void){
int fd;
int fd1;
char BufOut[7] = "FREDDY";
char BufIn[25];
int n, ret;
fd = open("/dev/myModuleTest", O_RDONLY);
if(fd < 0){
printf("Erreur d'ouverture = %d\n", fd);
return -1;
}else{
printf("OPEN!!!\n");
}
/*
if(fd1 < 0){
printf("Erreur d'ouverture = %d\n", fd1);
return -1;
}else{
printf("OPEN!!!\n");
}*/
//sleep(10);
//n = 0;
/*
while (n < 6){
ret = write(fd, &BufOut[n], 1);
n++;
}
printf("write %s \n",BufOut); */
// n = 0;
//while (n < 6){
ret = read(fd, &BufIn, 8);
// n++;
//}
printf("value read: %s\n", BufIn);
int exit = close(fd);
printf("%i", exit);
}
/*
int open()
int write(st){
char tmp[8];
copy_from_user(tmp, buf, count) // petit buffer le plus que possible
buffer_push(tmp)
for () // loop to send to ring buffer one at a time
return count; // return 1 seul character
}
int fd = ope("/dev/serial0", 0_RDWR);
write(fd, "allo", 4); */