notaz.gp2x.de
/
corsairmi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
465ea92
)
add some maybe helpful error messages
master
github/master
author
notaz
<notasas@gmail.com>
Fri, 26 Feb 2016 23:39:52 +0000
(
01:39
+0200)
committer
notaz
<notasas@gmail.com>
Fri, 26 Feb 2016 23:39:52 +0000
(
01:39
+0200)
corsairmi.c
patch
|
blob
|
blame
|
history
diff --git
a/corsairmi.c
b/corsairmi.c
index
f45b421
..
e7a1287
100644
(file)
--- a/
corsairmi.c
+++ b/
corsairmi.c
@@
-61,6
+61,7
@@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
+#include <errno.h>
#include <linux/hidraw.h>
static const uint16_t products[] = {
#include <linux/hidraw.h>
static const uint16_t products[] = {
@@
-221,6
+222,7
@@
out:
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
+ int had_eacces = 0;
char name[63];
uint32_t v32;
uint8_t osel;
char name[63];
uint32_t v32;
uint8_t osel;
@@
-240,6
+242,16
@@
int main(int argc, char *argv[])
fd = try_open_device(name, 0);
if (fd != -1)
break;
fd = try_open_device(name, 0);
if (fd != -1)
break;
+ if (errno == EACCES)
+ had_eacces = 1;
+ }
+ if (fd == -1) {
+ fprintf(stderr, "No compatible devices found.\n");
+ if (had_eacces)
+ fprintf(stderr, "At least one device "
+ "could not be checked because "
+ "of lack of permissions for "
+ "/dev/hidraw*.\n");
}
}
}
}