mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-22 03:37:56 +08:00
Update to FreeBSD stable/12 2019-03-11
Git mirror commit 735fe7a0a5f9c265040e2e6654a01b081d6354f1.
This commit is contained in:
@@ -75,14 +75,16 @@ int evdev_rcpt_mask = EVDEV_RCPT_HW_MOUSE | EVDEV_RCPT_HW_KBD;
|
||||
#endif /* __rtems__ */
|
||||
int evdev_sysmouse_t_axis = 0;
|
||||
|
||||
#ifdef EVDEV_SUPPORT
|
||||
SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW, 0, "Evdev args");
|
||||
#ifdef EVDEV_SUPPORT
|
||||
SYSCTL_INT(_kern_evdev, OID_AUTO, rcpt_mask, CTLFLAG_RW, &evdev_rcpt_mask, 0,
|
||||
"Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, "
|
||||
"bit2 - mouse hardware, bit3 - keyboard hardware");
|
||||
SYSCTL_INT(_kern_evdev, OID_AUTO, sysmouse_t_axis, CTLFLAG_RW,
|
||||
&evdev_sysmouse_t_axis, 0, "Extract T-axis from 0-none, 1-ums, 2-psm");
|
||||
#endif
|
||||
SYSCTL_NODE(_kern_evdev, OID_AUTO, input, CTLFLAG_RD, 0,
|
||||
"Evdev input devices");
|
||||
|
||||
static void evdev_start_repeat(struct evdev_dev *, uint16_t);
|
||||
static void evdev_stop_repeat(struct evdev_dev *);
|
||||
@@ -202,6 +204,87 @@ evdev_estimate_report_size(struct evdev_dev *evdev)
|
||||
return (size);
|
||||
}
|
||||
|
||||
static void
|
||||
evdev_sysctl_create(struct evdev_dev *evdev)
|
||||
{
|
||||
struct sysctl_oid *ev_sysctl_tree;
|
||||
char ev_unit_str[8];
|
||||
|
||||
snprintf(ev_unit_str, sizeof(ev_unit_str), "%d", evdev->ev_unit);
|
||||
sysctl_ctx_init(&evdev->ev_sysctl_ctx);
|
||||
|
||||
ev_sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_STATIC_CHILDREN(_kern_evdev_input), OID_AUTO,
|
||||
ev_unit_str, CTLFLAG_RD, NULL, "", "device index");
|
||||
|
||||
SYSCTL_ADD_STRING(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "name", CTLFLAG_RD,
|
||||
evdev->ev_name, 0,
|
||||
"Input device name");
|
||||
|
||||
SYSCTL_ADD_STRUCT(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "id", CTLFLAG_RD,
|
||||
&evdev->ev_id, input_id,
|
||||
"Input device identification");
|
||||
|
||||
/* ioctl returns ENOENT if phys is not set. sysctl returns "" here */
|
||||
SYSCTL_ADD_STRING(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "phys", CTLFLAG_RD,
|
||||
evdev->ev_shortname, 0,
|
||||
"Input device short name");
|
||||
|
||||
/* ioctl returns ENOENT if uniq is not set. sysctl returns "" here */
|
||||
SYSCTL_ADD_STRING(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "uniq", CTLFLAG_RD,
|
||||
evdev->ev_serial, 0,
|
||||
"Input device unique number");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "props", CTLFLAG_RD,
|
||||
evdev->ev_prop_flags, sizeof(evdev->ev_prop_flags), "",
|
||||
"Input device properties");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "type_bits", CTLFLAG_RD,
|
||||
evdev->ev_type_flags, sizeof(evdev->ev_type_flags), "",
|
||||
"Input device supported events types");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "key_bits", CTLFLAG_RD,
|
||||
evdev->ev_key_flags, sizeof(evdev->ev_key_flags),
|
||||
"", "Input device supported keys");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "rel_bits", CTLFLAG_RD,
|
||||
evdev->ev_rel_flags, sizeof(evdev->ev_rel_flags), "",
|
||||
"Input device supported relative events");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "abs_bits", CTLFLAG_RD,
|
||||
evdev->ev_abs_flags, sizeof(evdev->ev_abs_flags), "",
|
||||
"Input device supported absolute events");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "msc_bits", CTLFLAG_RD,
|
||||
evdev->ev_msc_flags, sizeof(evdev->ev_msc_flags), "",
|
||||
"Input device supported miscellaneous events");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "led_bits", CTLFLAG_RD,
|
||||
evdev->ev_led_flags, sizeof(evdev->ev_led_flags), "",
|
||||
"Input device supported LED events");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "snd_bits", CTLFLAG_RD,
|
||||
evdev->ev_snd_flags, sizeof(evdev->ev_snd_flags), "",
|
||||
"Input device supported sound events");
|
||||
|
||||
SYSCTL_ADD_OPAQUE(&evdev->ev_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "sw_bits", CTLFLAG_RD,
|
||||
evdev->ev_sw_flags, sizeof(evdev->ev_sw_flags), "",
|
||||
"Input device supported switch events");
|
||||
}
|
||||
|
||||
static int
|
||||
evdev_register_common(struct evdev_dev *evdev)
|
||||
{
|
||||
@@ -241,6 +324,12 @@ evdev_register_common(struct evdev_dev *evdev)
|
||||
|
||||
/* Create char device node */
|
||||
ret = evdev_cdev_create(evdev);
|
||||
if (ret != 0)
|
||||
goto bail_out;
|
||||
|
||||
/* Create sysctls (for device enumeration without /dev/input access rights) */
|
||||
evdev_sysctl_create(evdev);
|
||||
|
||||
bail_out:
|
||||
return (ret);
|
||||
}
|
||||
@@ -278,6 +367,8 @@ evdev_unregister(struct evdev_dev *evdev)
|
||||
debugf(evdev, "%s: unregistered evdev provider: %s\n",
|
||||
evdev->ev_shortname, evdev->ev_name);
|
||||
|
||||
sysctl_ctx_free(&evdev->ev_sysctl_ctx);
|
||||
|
||||
EVDEV_LOCK(evdev);
|
||||
evdev->ev_cdev->si_drv1 = NULL;
|
||||
/* Wake up sleepers */
|
||||
|
Reference in New Issue
Block a user