router button and slide switch support on evdev
This is hints for Buffalo WZR-HP-G300NH.
IMO, this driver can be written in generic way
EV_KEY events should be used here unless you have to be compatible with already existing software written in broken way.
EV_SYN event support should be enabled unconditionally.
As before, EV_KEY should be used. If KEY codes needs to be customized from userland, EVIOCSKEYCODE_V2 ioctl exists but using of it requires some extra evdev hacking
If you do not need these events, I can extend KPI so it will be possible change internal state directly.
Evdev provides ev_open and ev_close callbacks for starting/stopping polling or interrupts on demand. You can use sys/arm/broadcom/bcm2835/bcm2835_ft5406.c as sample. In that case it is better to associate both evdev and callout instances to same mutex to avoid races.
Tracking for button state edges is not needed here. Evdev does it for you.
You can not push key with 0(zero) code as it is reserved for evdev internals. I would add BTN_MISC offset here as you are reporting state of buttons rather than keys. (Keys are the part of a keyboard).
err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx);