Fix 2720 hardware support and streamline changelog
This commit is contained in:
1 parent
3b96b8f242
commit
a4f2051d50
20 files changed
+115
-391
No files matched your search
@@ -14,6 +14,7 @@
|
||||
#define LOCK_FLAG "/tmp/bananarchy_screen_locked"
|
||||
#define LOCKER_FIFO "/tmp/dwm_plugin_locker.fifo"
|
||||
#define LID_STABLE_MS 80
|
||||
#define HALL_POLL_MS 200
|
||||
#define GPIO_FILE "/sys/kernel/debug/gpio"
|
||||
#define COVER_SOCKET "/run/bananarchy/cover.sock"
|
||||
#define LID_CLIENT_SOCKET "/run/bananarchy/lid-client.sock"
|
||||
@@ -250,6 +251,7 @@ int main(void)
|
||||
struct watch_list list;
|
||||
long long now;
|
||||
long long last_scan = 0;
|
||||
long long last_hall_poll = 0;
|
||||
long long last_transition = 0;
|
||||
long long last_broadcast = 0;
|
||||
long long candidate_since;
|
||||
@@ -263,12 +265,13 @@ int main(void)
|
||||
install_reaper();
|
||||
memset(&list, 0, sizeof(list));
|
||||
switch_mask = current_switch_mask(&evdev_found);
|
||||
if(evdev_found)
|
||||
hall = hall_state();
|
||||
if(hall >= 0)
|
||||
stable_closed = hall;
|
||||
else if(evdev_found)
|
||||
stable_closed = (switch_mask & (int)CLOSED_MASK) != 0;
|
||||
else {
|
||||
hall = hall_state();
|
||||
stable_closed = hall >= 0 ? hall : 0;
|
||||
}
|
||||
else
|
||||
stable_closed = 0;
|
||||
candidate = stable_closed;
|
||||
now = now_ms();
|
||||
candidate_since = now;
|
||||
@@ -300,12 +303,14 @@ int main(void)
|
||||
}
|
||||
if(nfds > 0)
|
||||
read_ready(&list, fds, nfds, &switch_mask);
|
||||
if(list.count > 0) {
|
||||
observed = (switch_mask & (int)CLOSED_MASK) != 0;
|
||||
} else {
|
||||
observed = (switch_mask & (int)CLOSED_MASK) != 0;
|
||||
/* EV_SW can miss edges or report a stale mask on the 2720 hall sensors.
|
||||
* Reconcile with the raw lines even while evdev remains available. */
|
||||
if(now - last_hall_poll >= HALL_POLL_MS) {
|
||||
hall = hall_state();
|
||||
observed = hall >= 0 ? hall :
|
||||
(switch_mask & (int)CLOSED_MASK) != 0;
|
||||
if(hall >= 0)
|
||||
observed = hall;
|
||||
last_hall_poll = now;
|
||||
}
|
||||
if(observed != candidate) {
|
||||
candidate = observed;
|
||||
|
||||
Reference in new issue
Block a user