git://git.jankratochvil.net
/
lptgpib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port inicializovat jenom, kdyz to je opravdu potreba.
[lptgpib.git]
/
lptgpib.c
diff --git
a/lptgpib.c
b/lptgpib.c
index
2a9f244
..
d854b65
100644
(file)
--- a/
lptgpib.c
+++ b/
lptgpib.c
@@
-11,7
+11,7
@@
#include <sys/mman.h>
#include <time.h>
#include <sys/mman.h>
#include <time.h>
-#define DEBUG
3
/* 4 - all, 3 - data, */
+#define DEBUG
4
/* 4 - all, 3 - data, */
#if DEBUG > 3
#define DBG_low(...) { fprintf(stderr,__VA_ARGS__); fflush(stderr); }
#if DEBUG > 3
#define DBG_low(...) { fprintf(stderr,__VA_ARGS__); fflush(stderr); }
@@
-84,7
+84,10
@@
void sig_handler(int sig){
void lptgpib_init(int base){
lpt_base = base;
void lptgpib_init(int base){
lpt_base = base;
- ioperm(lpt_base, 4, 1);
+ if (ioperm(lpt_base, 4, 1) != 0) {
+ fprintf(stderr,"Nejsou prava na port - musis byt root: %m\n");
+ exit(1);
+ }
/* set realtime priority and lock us in memory */
struct sched_param scp;
/* set realtime priority and lock us in memory */
struct sched_param scp;