Re: Xorg with evdev input devices

Vasily Postnicov <[email protected]>
Newsgroups gmane.os.freebsd.devel.x11
Message-ID <CADnZ6BnCi+SZ46ECtLx0QJP2-eycKyrueJNoUXJ+26KMGoPH8g@mail.gmail.com>
Hello again, Greg. I have some more time to play with Wayland. I'm trying
to resolve permission errors when accessing /dev/input/event* using
consolekit2. I did as you said and have active consolekit session when I
log in.

> ck-list-sessions
Session5:
        unix-user = '1001'
        realname = 'Vasily Postnicov'
        seat = 'Seat1'
        session-type = 'unspecified'
        session-class = 'user'
        session-state = 'online'
        active = FALSE
        x11-display = ''
        x11-display-device = ''
        display-device = '/dev/ttyv0'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2019-10-05T15:25:27.297123Z'
        login-session-id = ''
        XDG_RUNTIME_DIR = '/var/run/user/1001'
        VTNr = '1'

When I start sway I have this now:

vasily@vonbraun:~ % sway
2019-10-05 19:44:54 - [backend/drm/legacy.c:15] HDMI-A-2: Failed to set
CRTC: Permission denied
2019-10-05 19:44:54 - [backend/drm/legacy.c:15] DVI-D-1: Failed to set
CRTC: Permission denied
2019-10-05 19:44:54 - [main.c:521] Missing a required Wayland interface

Using just chmod 666 /dev/input/* without consolekit works fine.

UPD: Using truss I've found what ioctl DRM_IOCTL_MODE_SETCRTC fails (see
https://i.postimg.cc/cWVcb8wc/IMG-20191005-201103.jpg). I use amdgpu driver
from graphics/drm-fbsd12.0-kmod-4.16.g20190814.
After changing line
> DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc,
DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
to
> DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc,
DRM_CONTROL_ALLOW|DRM_UNLOCKED),
in drivers/gpu/drm/drm_ioctl.c ioctl call works fine, but sway still cannot
see input devices.

My verdict: before using ConsoleKit2 we must at least fix this ioctl issue.
I don't know what DRM_MASTER is and if it is safe to remove it. Maybe
consolekit itself and not the driver must be fixed.

вс, 22 сент. 2019 г. в 19:31, <[email protected]>:

> September 22, 2019 7:12 PM, "Vasily Postnicov" <[email protected]>
> wrote:
>
> > Thanks, it works. The purpose of my evdev kernel support testing is
> eventually switch to wayland.
> > For this time I have all related ports recompiled with WAYLAND option
> and also have x11-wm/sway
> > installed. Then I run following commands in terminal (I mean, without
> xorg server running):
> >
> >> setenv XDG_RUNTIME_DIR /tmp
> >
> >> sway -d
> >
> > Sway fails to start with the following log:
> https://pastebin.com/M3eExb0C
> >
> >> 2019-09-22 18:53:04 - [backend/libinput/backend.c:55] Initializing
> libinput
> >> 2019-09-22 18:53:04 - [backend/libinput/backend.c:84] libinput
> initialization failed, no input
> > devices
> >> 2019-09-22 18:53:04 - [backend/libinput/backend.c:85] Set
> WLR_LIBINPUT_NO_DEVICES=1 to suppress
> > this check
> >> 2019-09-22 18:53:04 - [backend/multi/backend.c:32] Failed to initialize
> backend.
> >> 2019-09-22 18:53:04 - [sway/server.c:195] Failed to start backend
> >
> > I've tried to run "setenv WLR_LIBINPUT_NO_DEVICES 1" as suggested and
> got sway started (but without
> > input devices, I suppose). What's wrong with my libinput? It seems it
> works OK with Xorg
>
> Your sway process doesn't have permission to access /dev/input/*.
>
> [re: the little follow-up email: setuid does not help, because input
> devices are attached after dropping root, because input devices need to be
> hotpluggable anyway. setuid is bad, use consolekit2 as described below]
>
> The good (but a bit involved for now) fix:
>
> - run 'sysctl kern.evdev.input' to make sure you have a recent enough
> kernel -- my patch for this is not in 12.0-RELEASE, but should be in
> 12.1-BETA I'm pretty sure
> - build libudev-devd with
> https://github.com/myfreeweb/freebsd-ports-dank/blob/lite/devel/libudev-devd/Makefile
> (i.e. update to the latest git commit)
> - build consolekit2 with https://reviews.freebsd.org/D18754
> - build wlroots with CONSOLEKIT option
> - enable automatic CK2 session creation on login: add 'session
>  optional        pam_ck_connector.so' to the '# session' section of
> /etc/pam.d/login
> - log out, log in, just run sway
> - (you can launch sway under ck-launch-session if the automatic session
> gets screwed up somehow, but it works for me pretty well)
>
> The bad (but quick) fix:
>
> - chmod/chown /dev/input/* to be accessible to your account
> - (there's some devfs config thing that can do this automatically)
> - (this exposes input devices to any program running as your account,
> which defeats the "no keyloggers allowed" advantage of wayland)
>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-x11
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.