summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/aigo/button-erosq.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-16 14:11:51 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-16 14:37:01 -0400
commitc6d2a0358f221be41450503b45a4f14db14bf690 (patch)
tree80af5b360d9b54238a1247d93215d2a4f2c5a556 /firmware/target/hosted/aigo/button-erosq.c
parent1a76bc403e647ac40f2218dd3808ce8b3f9a80d9 (diff)
downloadrockbox-c6d2a0358f221be41450503b45a4f14db14bf690.tar.gz
rockbox-c6d2a0358f221be41450503b45a4f14db14bf690.zip
hosted: open input device as read-only.
Change-Id: I4dcd98f45f41fe06a0a75a2a0dd45c753c2cf365
Diffstat (limited to 'firmware/target/hosted/aigo/button-erosq.c')
-rw-r--r--firmware/target/hosted/aigo/button-erosq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/target/hosted/aigo/button-erosq.c b/firmware/target/hosted/aigo/button-erosq.c
index 2735c48c71..db7f7e24e5 100644
--- a/firmware/target/hosted/aigo/button-erosq.c
+++ b/firmware/target/hosted/aigo/button-erosq.c
@@ -38,7 +38,7 @@
#include "backlight-target.h"
#include "erosqlinux_codec.h"
-#define NR_POLL_DESC 3
+#define NR_POLL_DESC 2
static struct pollfd poll_fds[NR_POLL_DESC];
static int button_map(int keycode)
@@ -82,18 +82,18 @@ static int button_map(int keycode)
void button_init_device(void)
{
- const char * const input_devs[] = {
+ const char * const input_devs[NR_POLL_DESC] = {
"/dev/input/event0", // Rotary encoder
"/dev/input/event1" // Keys
};
for(int i = 0; i < NR_POLL_DESC; i++)
{
- int fd = open(input_devs[i], O_RDWR | O_CLOEXEC);
+ int fd = open(input_devs[i], O_RDONLY | O_CLOEXEC);
if(fd < 0)
{
- panicf("Cannot open input device: %s\n", input_devs[i]);
+ panicf("Cannot open input device: %s (%d)\n", input_devs[i], errno);
}
poll_fds[i].fd = fd;