diff options
-rw-r--r-- | firmware/target/hosted/agptek/button-agptek.c | 5 | ||||
-rw-r--r-- | firmware/target/hosted/aigo/button-erosq.c | 8 | ||||
-rw-r--r-- | firmware/target/hosted/fiio/button-fiio.c | 10 | ||||
-rw-r--r-- | firmware/target/hosted/sonynwz/button-nwz.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/xduoo/button-xduoo.c | 4 |
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) | |||
70 | 70 | ||
71 | void button_init_device(void) | 71 | void button_init_device(void) |
72 | { | 72 | { |
73 | const char * const input_devs[] = { | 73 | const char * const input_devs[NR_POLL_DESC] = { |
74 | "/dev/input/event0", | 74 | "/dev/input/event0", |
75 | "/dev/input/event1" | 75 | "/dev/input/event1" |
76 | }; | 76 | }; |
77 | 77 | ||
78 | for(int i = 0; i < NR_POLL_DESC; i++) | 78 | for(int i = 0; i < NR_POLL_DESC; i++) |
79 | { | 79 | { |
80 | int fd = open(input_devs[i], O_RDWR | O_CLOEXEC); | 80 | int fd = open(input_devs[i], O_RDONLY | O_CLOEXEC); |
81 | 81 | ||
82 | if(fd < 0) | 82 | if(fd < 0) |
83 | { | 83 | { |
@@ -146,4 +146,3 @@ void button_close_device(void) | |||
146 | close(poll_fds[i].fd); | 146 | close(poll_fds[i].fd); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | |||
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 @@ | |||
38 | #include "backlight-target.h" | 38 | #include "backlight-target.h" |
39 | #include "erosqlinux_codec.h" | 39 | #include "erosqlinux_codec.h" |
40 | 40 | ||
41 | #define NR_POLL_DESC 3 | 41 | #define NR_POLL_DESC 2 |
42 | static struct pollfd poll_fds[NR_POLL_DESC]; | 42 | static struct pollfd poll_fds[NR_POLL_DESC]; |
43 | 43 | ||
44 | static int button_map(int keycode) | 44 | static int button_map(int keycode) |
@@ -82,18 +82,18 @@ static int button_map(int keycode) | |||
82 | 82 | ||
83 | void button_init_device(void) | 83 | void button_init_device(void) |
84 | { | 84 | { |
85 | const char * const input_devs[] = { | 85 | const char * const input_devs[NR_POLL_DESC] = { |
86 | "/dev/input/event0", // Rotary encoder | 86 | "/dev/input/event0", // Rotary encoder |
87 | "/dev/input/event1" // Keys | 87 | "/dev/input/event1" // Keys |
88 | }; | 88 | }; |
89 | 89 | ||
90 | for(int i = 0; i < NR_POLL_DESC; i++) | 90 | for(int i = 0; i < NR_POLL_DESC; i++) |
91 | { | 91 | { |
92 | int fd = open(input_devs[i], O_RDWR | O_CLOEXEC); | 92 | int fd = open(input_devs[i], O_RDONLY | O_CLOEXEC); |
93 | 93 | ||
94 | if(fd < 0) | 94 | if(fd < 0) |
95 | { | 95 | { |
96 | panicf("Cannot open input device: %s\n", input_devs[i]); | 96 | panicf("Cannot open input device: %s (%d)\n", input_devs[i], errno); |
97 | } | 97 | } |
98 | 98 | ||
99 | poll_fds[i].fd = fd; | 99 | 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) | |||
85 | case KEY_F8: | 85 | case KEY_F8: |
86 | key_power_delay = 0; | 86 | key_power_delay = 0; |
87 | return BUTTON_POWER; | 87 | return BUTTON_POWER; |
88 | 88 | ||
89 | case KEY_HOME: | 89 | case KEY_HOME: |
90 | key_home_delay = DEF_DELAY; | 90 | key_home_delay = DEF_DELAY; |
91 | return BUTTON_OPTION; | 91 | return BUTTON_OPTION; |
@@ -147,7 +147,7 @@ static int button_map_off(int keycode) | |||
147 | 147 | ||
148 | case KEY_F8: | 148 | case KEY_F8: |
149 | return BUTTON_POWER; | 149 | return BUTTON_POWER; |
150 | 150 | ||
151 | case KEY_F9: | 151 | case KEY_F9: |
152 | return BUTTON_OPTION; | 152 | return BUTTON_OPTION; |
153 | 153 | ||
@@ -168,7 +168,7 @@ static int button_map_off(int keycode) | |||
168 | static int button_map_timer(void) | 168 | static int button_map_timer(void) |
169 | { | 169 | { |
170 | int map = 0; | 170 | int map = 0; |
171 | 171 | ||
172 | if (key_enter_delay) | 172 | if (key_enter_delay) |
173 | { | 173 | { |
174 | if (--key_enter_delay == 0) map |= BUTTON_PLAY; | 174 | if (--key_enter_delay == 0) map |= BUTTON_PLAY; |
@@ -219,14 +219,14 @@ static int button_map_timer(void) | |||
219 | 219 | ||
220 | void button_init_device(void) | 220 | void button_init_device(void) |
221 | { | 221 | { |
222 | const char * const input_devs[] = { | 222 | const char * const input_devs[NR_POLL_DESC] = { |
223 | "/dev/input/event0", | 223 | "/dev/input/event0", |
224 | "/dev/input/event1", | 224 | "/dev/input/event1", |
225 | }; | 225 | }; |
226 | 226 | ||
227 | for(int i = 0; i < NR_POLL_DESC; i++) | 227 | for(int i = 0; i < NR_POLL_DESC; i++) |
228 | { | 228 | { |
229 | int fd = open(input_devs[i], O_RDWR | O_CLOEXEC); | 229 | int fd = open(input_devs[i], O_RDONLY | O_CLOEXEC); |
230 | 230 | ||
231 | if(fd < 0) | 231 | if(fd < 0) |
232 | { | 232 | { |
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) | |||
156 | 156 | ||
157 | static void open_input_device(const char *path) | 157 | static void open_input_device(const char *path) |
158 | { | 158 | { |
159 | int fd = open(path, O_RDWR); | 159 | int fd = open(path, O_RDONLY | O_CLOEXEC); |
160 | if(fd < 0) | 160 | if(fd < 0) |
161 | return; | 161 | return; |
162 | /* query name */ | 162 | /* 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) | |||
76 | 76 | ||
77 | void button_init_device(void) | 77 | void button_init_device(void) |
78 | { | 78 | { |
79 | const char * const input_devs[] = { | 79 | const char * const input_devs[NR_POLL_DESC] = { |
80 | "/dev/input/event0", | 80 | "/dev/input/event0", |
81 | "/dev/input/event1", | 81 | "/dev/input/event1", |
82 | "/dev/input/event2" | 82 | "/dev/input/event2" |
@@ -84,7 +84,7 @@ void button_init_device(void) | |||
84 | 84 | ||
85 | for(int i = 0; i < NR_POLL_DESC; i++) | 85 | for(int i = 0; i < NR_POLL_DESC; i++) |
86 | { | 86 | { |
87 | int fd = open(input_devs[i], O_RDWR | O_CLOEXEC); | 87 | int fd = open(input_devs[i], O_RDONLY | O_CLOEXEC); |
88 | 88 | ||
89 | if(fd < 0) | 89 | if(fd < 0) |
90 | { | 90 | { |