Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Wayland on FreeBSD #116

Merged
merged 4 commits into from
Sep 4, 2023
Merged

Conversation

valpackett
Copy link
Contributor

@valpackett valpackett commented Jan 5, 2019

  • /dev/dri/card0 is a symlink to ../drm/0 on FreeBSD. When CK2 tries to determine the device type, the path gets resolved, and so it's not card0. Also the subsystem is not set by libudev-devd.
  • when unplugging an input device and plugging it back in, CK2 would refuse to attach an already attached device. Actually, my compositor tried to detach it, but the file descriptor was already dead. (I guess on Linux the /dev/* device doesn't die until udev consumers have detached it, because /dev is controlled by udev — in our case, it's controlled by devfs in the kernel) Let's check if the device died on re-attaching.
  • termios raw mode should be set on the tty, otherwise FreeBSD vt wouldn't ignore keyboard input, which can cause really weird things to happen (my Weston would quit when pressing Enter, lol)

Otherwise, keyboard input would touch the console,
and e.g. pressing Enter would crash Weston
@@ -308,6 +308,13 @@ ck_get_a_console_fd (void)
}
#endif

#if defined(__FreeBSD__)
fd = ck_open_a_console ("/dev/ttyv0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's rationale for this change? Doesn't /dev/console work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function uses /dev/console as fallback, but prefers a VT specifically (on other platforms already, FreeBSD just was missing).

CK is usually spawned by the D-Bus daemon for the system bus, who would guarantee that /dev/console is a VT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, ck_get_a_console_fd should return a fd for a virtual terminal?

In this case, why don't we try all possible ttyv's? When writing this code 1 I found out that if no one is logged in at /dev/ttyv0, you can't open() it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem necessary, it just works like this so far.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm debugging https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221452#c36 it seems related. Maybe you have some insights?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how the x11 support works and I haven't tried any display managers yet.

With just two wayfires the switching works, the currently active session is always active e.g.

Session1:
        unix-user = '1001'
        realname = 'Greg'
        seat = 'Seat1'
        session-type = 'unspecified'
        session-class = 'user'
        session-state = 'active'
        active = TRUE
        x11-display = ''
        x11-display-device = ''
        display-device = '/dev/ttyv0'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2021-10-22T10:00:23.671559Z'
        login-session-id = ''
        XDG_RUNTIME_DIR = '/var/run/user/1001'
        VTNr = '1'
Session2:
        unix-user = '1001'
        realname = 'Greg'
        seat = 'Seat1'
        session-type = 'unspecified'
        session-class = 'user'
        session-state = 'online'
        active = FALSE
        x11-display = ''
        x11-display-device = ''
        display-device = '/dev/ttyv1'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2021-10-22T12:56:56.714321Z'
        login-session-id = ''
        XDG_RUNTIME_DIR = '/var/run/user/1001'
        VTNr = '2'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this PR, using /dev/console seems more correct: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221452#c39

Should I commit the change proposed in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, everything works fine, I have removed the commit from this PR.

Only got a NULL here on FreeBSD/aarch64, for some reason
@arrowd
Copy link
Contributor

arrowd commented Aug 9, 2023

@rnagy @ajacoutot We're running these patches on FreeBSD for years now. Can this PR be merged in, please?

@@ -1482,6 +1486,16 @@ ck_session_setup_vt_signal (CkSession *session,
return;
}

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be made feature dependent maybe instead of OS dependent?

@rnagy rnagy merged commit e15bcb2 into ConsoleKit2:master Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants