Page MenuHomeFreeBSD

74HC153 multiplexer input support for evdev on gpiobus
AbandonedPublic

Authored by yamori813_yahoo.co.jp on May 14 2017, 11:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 4:46 AM
Unknown Object (File)
Mon, Apr 15, 2:39 PM
Unknown Object (File)
Mon, Apr 8, 8:16 AM
Unknown Object (File)
Feb 23 2024, 1:09 AM
Unknown Object (File)
Jan 27 2024, 9:19 PM
Unknown Object (File)
Jan 6 2024, 3:33 PM
Unknown Object (File)
Jan 2 2024, 1:22 PM
Unknown Object (File)
Dec 20 2023, 4:21 AM
Subscribers
None

Details

Summary

router button and slide switch support on evdev

Test Plan

on Buffalo WZR-HP-G300NH

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 ?

This code have compile error now. I will check, but now abandon.