router button and slide switch support on evdev
Details
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 9321 Build 9785: arc lint + arc unit
Event Timeline
This is hints for Buffalo WZR-HP-G300NH.
hint.hc153key.0.at="gpiobus0"
hint.hc153key.0.pins=0x00005a00
hint.hc153key.0.pina=0
hint.hc153key.0.pinb=1
hint.hc153key.0.pin1y=2
hint.hc153key.0.pin2y=3
hint.hc153key.0.swmask=0xf0
IMO, this driver can be written in generic way
sys/dev/gpio/hc153key.c | ||
---|---|---|
109 | EV_KEY events should be used here unless you have to be compatible with already existing software written in broken way. | |
191 | EV_SYN event support should be enabled unconditionally. | |
193 | 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 | |
227 | If you do not need these events, I can extend KPI so it will be possible change internal state directly. | |
232 | 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. |
sys/dev/gpio/hc153key.c | ||
---|---|---|
161 | Tracking for button state edges is not needed here. Evdev does it for you. | |
162–163 | 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). | |
272 | err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); | |
275 | mtx_destroy ? |