#include "aciotest/panb.h" #include #include #include "aciodrv/panb.h" #include "aciodrv-proc/panb.h" struct panb_handler_ctx { bool running; }; bool aciotest_panb_handler_init(struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx) { if (node_id != 0) { return true; } *ctx = malloc(sizeof(struct panb_handler_ctx)); struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx*)*ctx; panb_ctx->running = true; return aciodrv_proc_panb_init(device); } bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx) { uint8_t button[AC_IO_PANB_MAX_KEYS]; struct ac_io_panb_poll_out state; struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx *) ctx; if (node_id != 0) { return true; } if (!panb_ctx->running) { printf(">>> PANB:\nDevice has been closed. Press Ctrl+C to exit."); return true; } if (!aciodrv_proc_panb_get_state(button)) { return false; } printf(">>> PANB:\nPress first and last keys to close device\n"); for (int i=0; irunning = false; return true; } /* light the panel */ for (int i=0; i