summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/hosted/agptek/button-agptek.c5
-rw-r--r--firmware/target/hosted/aigo/button-erosq.c8
-rw-r--r--firmware/target/hosted/fiio/button-fiio.c10
-rw-r--r--firmware/target/hosted/sonynwz/button-nwz.c2
-rw-r--r--firmware/target/hosted/xduoo/button-xduoo.c4
5 files changed, 14 insertions, 15 deletions
diff --git a/firmware/target/hosted/agptek/button-agptek.c b/firmware/target/hosted/agptek/button-agptek.c
index 83953e0dab..2c84a50405 100644
--- a/firmware/target/hosted/agptek/button-agptek.c
+++ b/firmware/target/hosted/agptek/button-agptek.c
@@ -70,14 +70,14 @@ 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",
"/dev/input/event1"
};
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)
{
@@ -146,4 +146,3 @@ void button_close_device(void)
close(poll_fds[i].fd);
}
}
-
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;
diff --git a/firmware/target/hosted/fiio/button-fiio.c b/firmware/target/hosted/fiio/button-fiio.c
index 79ed702668..134ec5a426 100644
--- a/firmware/target/hosted/fiio/button-fiio.c
+++ b/firmware/target/hosted/fiio/button-fiio.c
@@ -85,7 +85,7 @@ static int button_map_on(int keycode)
case KEY_F8:
key_power_delay = 0;
return BUTTON_POWER;
-
+
case KEY_HOME:
key_home_delay = DEF_DELAY;
return BUTTON_OPTION;
@@ -147,7 +147,7 @@ static int button_map_off(int keycode)
case KEY_F8:
return BUTTON_POWER;
-
+
case KEY_F9:
return BUTTON_OPTION;
@@ -168,7 +168,7 @@ static int button_map_off(int keycode)
static int button_map_timer(void)
{
int map = 0;
-
+
if (key_enter_delay)
{
if (--key_enter_delay == 0) map |= BUTTON_PLAY;
@@ -219,14 +219,14 @@ static int button_map_timer(void)
void button_init_device(void)
{
- const char * const input_devs[] = {
+ const char * const input_devs[NR_POLL_DESC] = {
"/dev/input/event0",
"/dev/input/event1",
};
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)
{
diff --git a/firmware/target/hosted/sonynwz/button-nwz.c b/firmware/target/hosted/sonynwz/button-nwz.c
index 2fb23e1471..f85a4be496 100644
--- a/firmware/target/hosted/sonynwz/button-nwz.c
+++ b/firmware/target/hosted/sonynwz/button-nwz.c
@@ -156,7 +156,7 @@ static void key_init_state(int fd)
static void open_input_device(const char *path)
{
- int fd = open(path, O_RDWR);
+ int fd = open(path, O_RDONLY | O_CLOEXEC);
if(fd < 0)
return;
/* query name */
diff --git a/firmware/target/hosted/xduoo/button-xduoo.c b/firmware/target/hosted/xduoo/button-xduoo.c
index 3dc1bdc13a..67cb9a6c46 100644
--- a/firmware/target/hosted/xduoo/button-xduoo.c
+++ b/firmware/target/hosted/xduoo/button-xduoo.c
@@ -76,7 +76,7 @@ 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",
"/dev/input/event1",
"/dev/input/event2"
@@ -84,7 +84,7 @@ void button_init_device(void)
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)
{