Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144439574
D16614.id46390.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
15 KB
Referenced Files
None
Subscribers
None
D16614.id46390.diff
View Options
Index: sys/arm/broadcom/bcm2835/bcm2835_ft5406.c
===================================================================
--- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c
+++ sys/arm/broadcom/bcm2835/bcm2835_ft5406.c
@@ -172,20 +172,22 @@
callout_reset(&sc->sc_callout, sc->sc_tick, ft5406ts_callout, sc);
}
-static void
-ft5406ts_ev_close(struct evdev_dev *evdev, void *data)
+static int
+ft5406ts_ev_close(struct evdev_dev *evdev)
{
- struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data;
+ struct ft5406ts_softc *sc = evdev_get_softc(evdev);
FT5406_LOCK_ASSERT(sc);
callout_stop(&sc->sc_callout);
+
+ return (0);
}
static int
-ft5406ts_ev_open(struct evdev_dev *evdev, void *data)
+ft5406ts_ev_open(struct evdev_dev *evdev)
{
- struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data;
+ struct ft5406ts_softc *sc = evdev_get_softc(evdev);
FT5406_LOCK_ASSERT(sc);
Index: sys/dev/atkbdc/atkbd.c
===================================================================
--- sys/dev/atkbdc/atkbd.c
+++ sys/dev/atkbdc/atkbd.c
@@ -267,8 +267,10 @@
static int typematic_rate(int rate);
#ifdef EVDEV_SUPPORT
+static evdev_event_t atkbd_ev_event;
+
static const struct evdev_methods atkbd_evdev_methods = {
- .ev_event = evdev_ev_kbd_event,
+ .ev_event = atkbd_ev_event,
};
#endif
@@ -1206,6 +1208,22 @@
return (0);
}
+#ifdef EVDEV_SUPPORT
+static void
+atkbd_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
+ int32_t value)
+{
+ keyboard_t *kbd = evdev_get_softc(evdev);
+
+ if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD &&
+ (type == EV_LED || type == EV_REP)) {
+ mtx_lock(&Giant);
+ kbd_ev_event(kbd, type, code, value);
+ mtx_unlock(&Giant);
+ }
+}
+#endif
+
/* local functions */
static int
Index: sys/dev/atkbdc/psm.c
===================================================================
--- sys/dev/atkbdc/psm.c
+++ sys/dev/atkbdc/psm.c
@@ -2023,9 +2023,9 @@
#ifdef EVDEV_SUPPORT
static int
-psm_ev_open_r(struct evdev_dev *evdev, void *ev_softc)
+psm_ev_open_r(struct evdev_dev *evdev)
{
- struct psm_softc *sc = (struct psm_softc *)ev_softc;
+ struct psm_softc *sc = evdev_get_softc(evdev);
int err = 0;
/* Get device data */
@@ -2043,24 +2043,27 @@
return (err);
}
-static void
-psm_ev_close_r(struct evdev_dev *evdev, void *ev_softc)
+static int
+psm_ev_close_r(struct evdev_dev *evdev)
{
- struct psm_softc *sc = (struct psm_softc *)ev_softc;
+ struct psm_softc *sc = evdev_get_softc(evdev);
+ int err = 0;
sc->state &= ~PSM_EV_OPEN_R;
if (sc->state & (PSM_OPEN | PSM_EV_OPEN_A))
- return;
+ return (0);
if (sc->state & PSM_VALID)
- psmclose(sc);
+ err = psmclose(sc);
+
+ return (err);
}
static int
-psm_ev_open_a(struct evdev_dev *evdev, void *ev_softc)
+psm_ev_open_a(struct evdev_dev *evdev)
{
- struct psm_softc *sc = (struct psm_softc *)ev_softc;
+ struct psm_softc *sc = evdev_get_softc(evdev);
int err = 0;
/* Get device data */
@@ -2078,18 +2081,21 @@
return (err);
}
-static void
-psm_ev_close_a(struct evdev_dev *evdev, void *ev_softc)
+static int
+psm_ev_close_a(struct evdev_dev *evdev)
{
- struct psm_softc *sc = (struct psm_softc *)ev_softc;
+ struct psm_softc *sc = evdev_get_softc(evdev);
+ int err = 0;
sc->state &= ~PSM_EV_OPEN_A;
if (sc->state & (PSM_OPEN | PSM_EV_OPEN_R))
- return;
+ return (0);
if (sc->state & PSM_VALID)
- psmclose(sc);
+ err = psmclose(sc);
+
+ return (err);
}
#endif
Index: sys/dev/evdev/cdev.c
===================================================================
--- sys/dev/evdev/cdev.c
+++ sys/dev/evdev/cdev.c
@@ -446,7 +446,7 @@
return (ENOTSUP);
ke = (struct input_keymap_entry *)data;
- evdev->ev_methods->ev_get_keycode(evdev, evdev->ev_softc, ke);
+ evdev->ev_methods->ev_get_keycode(evdev, ke);
return (0);
case EVIOCSKEYCODE:
@@ -459,7 +459,7 @@
return (ENOTSUP);
ke = (struct input_keymap_entry *)data;
- evdev->ev_methods->ev_set_keycode(evdev, evdev->ev_softc, ke);
+ evdev->ev_methods->ev_set_keycode(evdev, ke);
return (0);
case EVIOCGABS(0) ... EVIOCGABS(ABS_MAX):
Index: sys/dev/evdev/evdev.h
===================================================================
--- sys/dev/evdev/evdev.h
+++ sys/dev/evdev/evdev.h
@@ -38,11 +38,10 @@
struct evdev_dev;
-typedef int (evdev_open_t)(struct evdev_dev *, void *);
-typedef void (evdev_close_t)(struct evdev_dev *, void *);
-typedef void (evdev_event_t)(struct evdev_dev *, void *, uint16_t,
- uint16_t, int32_t);
-typedef void (evdev_keycode_t)(struct evdev_dev *, void *,
+typedef int (evdev_open_t)(struct evdev_dev *);
+typedef int (evdev_close_t)(struct evdev_dev *);
+typedef void (evdev_event_t)(struct evdev_dev *, uint16_t, uint16_t, int32_t);
+typedef void (evdev_keycode_t)(struct evdev_dev *,
struct input_keymap_entry *);
/*
@@ -127,6 +126,7 @@
void evdev_set_repeat_params(struct evdev_dev *, uint16_t, int);
int evdev_set_report_size(struct evdev_dev *, size_t);
void evdev_set_flag(struct evdev_dev *, uint16_t);
+void *evdev_get_softc(struct evdev_dev *);
/* Multitouch related functions: */
int32_t evdev_get_mt_slot_by_tracking_id(struct evdev_dev *, int32_t);
@@ -142,7 +142,6 @@
void evdev_push_mouse_btn(struct evdev_dev *, int);
void evdev_push_leds(struct evdev_dev *, int);
void evdev_push_repeats(struct evdev_dev *, keyboard_t *);
-evdev_event_t evdev_ev_kbd_event;
/* Event reporting shortcuts: */
static __inline int
Index: sys/dev/evdev/evdev.c
===================================================================
--- sys/dev/evdev/evdev.c
+++ sys/dev/evdev/evdev.c
@@ -353,6 +353,13 @@
evdev->ev_softc = softc;
}
+inline void *
+evdev_get_softc(struct evdev_dev *evdev)
+{
+
+ return (evdev->ev_softc);
+}
+
inline void
evdev_support_prop(struct evdev_dev *evdev, uint16_t prop)
{
@@ -866,8 +873,7 @@
case EV_FF:
if (evdev->ev_methods != NULL &&
evdev->ev_methods->ev_event != NULL)
- evdev->ev_methods->ev_event(evdev, evdev->ev_softc,
- type, code, value);
+ evdev->ev_methods->ev_event(evdev, type, code, value);
/*
* Leds and driver repeats should be reported in ev_event
* method body to interoperate with kbdmux states and rates
@@ -911,8 +917,7 @@
evdev->ev_shortname);
if (evdev->ev_methods != NULL &&
evdev->ev_methods->ev_open != NULL)
- ret = evdev->ev_methods->ev_open(evdev,
- evdev->ev_softc);
+ ret = evdev->ev_methods->ev_open(evdev);
if (!ret && bit_test(evdev->ev_flags, EVDEV_FLAG_LOCKLESS))
evdev_start_notification(evdev);
}
@@ -932,7 +937,7 @@
if (LIST_EMPTY(&evdev->ev_clients)) {
if (evdev->ev_methods != NULL &&
evdev->ev_methods->ev_close != NULL)
- evdev->ev_methods->ev_close(evdev, evdev->ev_softc);
+ (void)evdev->ev_methods->ev_close(evdev);
if (evdev_event_supported(evdev, EV_REP) &&
bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT))
evdev_stop_repeat(evdev);
Index: sys/dev/evdev/evdev_utils.c
===================================================================
--- sys/dev/evdev/evdev_utils.c
+++ sys/dev/evdev/evdev_utils.c
@@ -40,8 +40,6 @@
#include <dev/evdev/evdev.h>
#include <dev/evdev/input.h>
-#include <dev/kbd/kbdreg.h>
-
#define NONE KEY_RESERVED
static uint16_t evdev_usb_scancodes[256] = {
@@ -299,43 +297,3 @@
evdev_push_event(evdev, EV_REP, REP_DELAY, kbd->kb_delay1);
evdev_push_event(evdev, EV_REP, REP_PERIOD, kbd->kb_delay2);
}
-
-void
-evdev_ev_kbd_event(struct evdev_dev *evdev, void *softc, uint16_t type,
- uint16_t code, int32_t value)
-{
- keyboard_t *kbd = (keyboard_t *)softc;
- int delay[2], leds, oleds;
- size_t i;
-
- if (type == EV_LED) {
- leds = oleds = KBD_LED_VAL(kbd);
- for (i = 0; i < nitems(evdev_led_codes); i++) {
- if (evdev_led_codes[i] == code) {
- if (value)
- leds |= 1 << i;
- else
- leds &= ~(1 << i);
- if (leds != oleds) {
- mtx_lock(&Giant);
- kbdd_ioctl(kbd, KDSETLED,
- (caddr_t)&leds);
- mtx_unlock(&Giant);
- }
- break;
- }
- }
- } else if (type == EV_REP && code == REP_DELAY) {
- delay[0] = value;
- delay[1] = kbd->kb_delay2;
- mtx_lock(&Giant);
- kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
- mtx_unlock(&Giant);
- } else if (type == EV_REP && code == REP_PERIOD) {
- delay[0] = kbd->kb_delay1;
- delay[1] = value;
- mtx_lock(&Giant);
- kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
- mtx_unlock(&Giant);
- }
-}
Index: sys/dev/evdev/uinput.c
===================================================================
--- sys/dev/evdev/uinput.c
+++ sys/dev/evdev/uinput.c
@@ -159,10 +159,10 @@
}
static void
-uinput_ev_event(struct evdev_dev *evdev, void *softc, uint16_t type,
- uint16_t code, int32_t value)
+uinput_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
+ int32_t value)
{
- struct uinput_cdev_state *state = softc;
+ struct uinput_cdev_state *state = evdev_get_softc(evdev);
if (type == EV_LED)
evdev_push_event(evdev, type, code, value);
Index: sys/dev/kbd/kbd.c
===================================================================
--- sys/dev/kbd/kbd.c
+++ sys/dev/kbd/kbd.c
@@ -47,6 +47,7 @@
#include <sys/kbio.h>
+#include <dev/evdev/input-event-codes.h>
#include <dev/kbd/kbdreg.h>
#define KBD_INDEX(dev) dev2unit(dev)
@@ -1475,3 +1476,41 @@
}
/* NOT REACHED */
}
+
+void
+kbd_ev_event(keyboard_t *kbd, uint16_t type, uint16_t code, int32_t value)
+{
+ int delay[2], led = 0, leds, oleds;
+
+ if (type == EV_LED) {
+ leds = oleds = KBD_LED_VAL(kbd);
+ switch (code) {
+ case LED_CAPSL:
+ led = CLKED;
+ break;
+ case LED_NUML:
+ led = NLKED;
+ break;
+ case LED_SCROLLL:
+ led = SLKED;
+ break;
+ }
+
+ if (value)
+ leds |= led;
+ else
+ leds &= ~led;
+
+ if (leds != oleds)
+ kbdd_ioctl(kbd, KDSETLED, (caddr_t)&leds);
+
+ } else if (type == EV_REP && code == REP_DELAY) {
+ delay[0] = value;
+ delay[1] = kbd->kb_delay2;
+ kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
+ } else if (type == EV_REP && code == REP_PERIOD) {
+ delay[0] = kbd->kb_delay1;
+ delay[1] = value;
+ kbdd_ioctl(kbd, KDSETREPEAT, (caddr_t)delay);
+ }
+}
Index: sys/dev/kbd/kbdreg.h
===================================================================
--- sys/dev/kbd/kbdreg.h
+++ sys/dev/kbd/kbdreg.h
@@ -253,6 +253,10 @@
int kbd_configure(int flags);
/* see `kb_config' above for flag bit definitions */
+/* evdev2kbd mappings */
+void kbd_ev_event(keyboard_t *kbd, uint16_t type,
+ uint16_t code, int32_t value);
+
#ifdef KBD_INSTALL_CDEV
/* virtual keyboard cdev driver functions */
Index: sys/dev/kbdmux/kbdmux.c
===================================================================
--- sys/dev/kbdmux/kbdmux.c
+++ sys/dev/kbdmux/kbdmux.c
@@ -384,8 +384,10 @@
};
#ifdef EVDEV_SUPPORT
+static evdev_event_t kbdmux_ev_event;
+
static const struct evdev_methods kbdmux_evdev_methods = {
- .ev_event = evdev_ev_kbd_event,
+ .ev_event = kbdmux_ev_event,
};
#endif
@@ -1391,6 +1393,22 @@
return (0);
}
+#ifdef EVDEV_SUPPORT
+static void
+kbdmux_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
+ int32_t value)
+{
+ keyboard_t *kbd = evdev_get_softc(evdev);
+
+ if (evdev_rcpt_mask & EVDEV_RCPT_KBDMUX &&
+ (type == EV_LED || type == EV_REP)) {
+ mtx_lock(&Giant);
+ kbd_ev_event(kbd, type, code, value);
+ mtx_unlock(&Giant);
+ }
+}
+#endif
+
/*****************************************************************************
*****************************************************************************
** Module
Index: sys/dev/usb/input/uep.c
===================================================================
--- sys/dev/usb/input/uep.c
+++ sys/dev/usb/input/uep.c
@@ -430,19 +430,21 @@
#ifdef EVDEV_SUPPORT
-static void
-uep_ev_close(struct evdev_dev *evdev, void *ev_softc)
+static int
+uep_ev_close(struct evdev_dev *evdev)
{
- struct uep_softc *sc = (struct uep_softc *)ev_softc;
+ struct uep_softc *sc = evdev_get_softc(evdev);
mtx_assert(&sc->mtx, MA_OWNED);
usbd_transfer_stop(sc->xfer[UEP_INTR_DT]);
+
+ return (0);
}
static int
-uep_ev_open(struct evdev_dev *evdev, void *ev_softc)
+uep_ev_open(struct evdev_dev *evdev)
{
- struct uep_softc *sc = (struct uep_softc *)ev_softc;
+ struct uep_softc *sc = evdev_get_softc(evdev);
mtx_assert(&sc->mtx, MA_OWNED);
usbd_transfer_start(sc->xfer[UEP_INTR_DT]);
Index: sys/dev/usb/input/ukbd.c
===================================================================
--- sys/dev/usb/input/ukbd.c
+++ sys/dev/usb/input/ukbd.c
@@ -365,8 +365,10 @@
static device_resume_t ukbd_resume;
#ifdef EVDEV_SUPPORT
+static evdev_event_t ukbd_ev_event;
+
static const struct evdev_methods ukbd_evdev_methods = {
- .ev_event = evdev_ev_kbd_event,
+ .ev_event = ukbd_ev_event,
};
#endif
@@ -1473,6 +1475,22 @@
return (0);
}
+#ifdef EVDEV_SUPPORT
+static void
+ukbd_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
+ int32_t value)
+{
+ keyboard_t *kbd = evdev_get_softc(evdev);
+
+ if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD &&
+ (type == EV_LED || type == EV_REP)) {
+ mtx_lock(&Giant);
+ kbd_ev_event(kbd, type, code, value);
+ mtx_unlock(&Giant);
+ }
+}
+#endif
+
/* early keyboard probe, not supported */
static int
ukbd_configure(int flags)
Index: sys/dev/usb/input/ums.c
===================================================================
--- sys/dev/usb/input/ums.c
+++ sys/dev/usb/input/ums.c
@@ -950,9 +950,9 @@
#ifdef EVDEV_SUPPORT
static int
-ums_ev_open(struct evdev_dev *evdev, void *ev_softc)
+ums_ev_open(struct evdev_dev *evdev)
{
- struct ums_softc *sc = (struct ums_softc *)ev_softc;
+ struct ums_softc *sc = evdev_get_softc(evdev);
mtx_assert(&sc->sc_mtx, MA_OWNED);
@@ -966,10 +966,10 @@
return (0);
}
-static void
-ums_ev_close(struct evdev_dev *evdev, void *ev_softc)
+static int
+ums_ev_close(struct evdev_dev *evdev)
{
- struct ums_softc *sc = (struct ums_softc *)ev_softc;
+ struct ums_softc *sc = evdev_get_softc(evdev);
mtx_assert(&sc->sc_mtx, MA_OWNED);
@@ -977,6 +977,8 @@
if (sc->sc_fflags == 0)
ums_stop_rx(sc);
+
+ return (0);
}
#endif
Index: sys/dev/usb/input/wmt.c
===================================================================
--- sys/dev/usb/input/wmt.c
+++ sys/dev/usb/input/wmt.c
@@ -230,8 +230,13 @@
static evdev_close_t wmt_ev_close;
static const struct evdev_methods wmt_evdev_methods = {
+#if __FreeBSD_version >= 1200000
.ev_open = &wmt_ev_open,
.ev_close = &wmt_ev_close,
+#else
+ .ev_open = &wmt_ev_open_11,
+ .ev_close = &wmt_ev_close_11,
+#endif
};
static const struct usb_config wmt_config[WMT_N_TRANSFER] = {
@@ -525,18 +530,18 @@
}
static void
-wmt_ev_close(struct evdev_dev *evdev, void *ev_softc)
+wmt_ev_close_11(struct evdev_dev *evdev, void *ev_softc)
{
- struct wmt_softc *sc = (struct wmt_softc *)ev_softc;
+ struct wmt_softc *sc = ev_softc;
mtx_assert(&sc->mtx, MA_OWNED);
usbd_transfer_stop(sc->xfer[WMT_INTR_DT]);
}
static int
-wmt_ev_open(struct evdev_dev *evdev, void *ev_softc)
+wmt_ev_open_11(struct evdev_dev *evdev, void *ev_softc)
{
- struct wmt_softc *sc = (struct wmt_softc *)ev_softc;
+ struct wmt_softc *sc = ev_softc;
mtx_assert(&sc->mtx, MA_OWNED);
usbd_transfer_start(sc->xfer[WMT_INTR_DT]);
@@ -544,6 +549,27 @@
return (0);
}
+#if __FreeBSD_version >= 1200000
+static int
+wmt_ev_close(struct evdev_dev *evdev)
+{
+ struct wmt_softc *sc = evdev_get_softc(evdev);
+
+ wmt_ev_close_11(evdev, sc);
+
+ return (0);
+}
+
+static int
+wmt_ev_open(struct evdev_dev *evdev)
+{
+ struct wmt_softc *sc = evdev_get_softc(evdev);
+
+ return (wmt_ev_open_11(evdev, sc));
+
+}
+#endif
+
/* port of userland hid_report_size() from usbhid(3) to kernel */
static int
wmt_hid_report_size(const void *buf, uint16_t len, enum hid_kind k, uint8_t id)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 11:09 AM (17 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28571565
Default Alt Text
D16614.id46390.diff (15 KB)
Attached To
Mode
D16614: [evdev]: Minor KPI changes
Attached
Detach File
Event Timeline
Log In to Comment