Commit graph

35 commits

Author SHA1 Message Date
Kenny Levinsen
684dd61945 terminal: Revert FreeBSD behavior in set_keyboard
4ad48cb305 introduced support for NetBSD,
which modified a number of our ifdefs. In that process, FreeBSD was
accidentally excluded from an important code path that controls keyboard
usage on the kernel console.

Revert part of that change to restore FreeBSD behavior.
2022-03-29 10:03:30 +02:00
illiliti
4ad48cb305 Initial netbsd support 2022-03-16 21:39:46 +01:00
Kenny Levinsen
e2baadc230 clang-format: Fix alignment 2021-09-21 12:48:24 +02:00
Kenny Levinsen
e4c28227ec Normalize log texts a bit 2021-03-02 00:27:38 +01:00
Kenny Levinsen
0d5f48f433 terminal: Improve logging 2020-11-23 17:56:55 +01:00
Kenny Levinsen
be45c480ec terminal: Ack both release and acquire
Linux only requires acking release and ignores ack of acquire, but
FreeBSD is more stringent and will patiently wait for both to be acked.

Implement proper acking for both events.
2020-09-22 01:14:24 +02:00
Kenny Levinsen
521d95349f terminal: Fix VT numbering on FreeBSD
FreeBSD adds one to the VT number returned by the GET_ACTIVE ioctl, so
to match things up, the wrapper here subtracted by one. This lead to
ttyv0 being named VT 0. This had the side-effect of VT numbering not
matching expectations, and switching not behaving as intended.

Align numbers with expectations, and move the required subtraction to
terminal_open, so that VT 1 matches ttyv0.
2020-09-22 01:14:24 +02:00
Kenny Levinsen
a763e16f26 drm: Relax drm file detection, support FreeBSD
Path check was done on /dev/dri/card and /dev/dri/renderD. However,
/dev/dri/by-path is a thing, and on FreeBSD, /dev/dri/ symlinks to
/dev/drm/.

Relax Linux check to /dev/dri/, and add FreeBSD check for /dev/drm/.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
8610ec4aac Remove unused list implementation 2020-08-31 14:14:39 +02:00
Kenny Levinsen
bbfb770c73 linked_list: linked_list_take should concat lists 2020-08-31 14:09:59 +02:00
Kenny Levinsen
c36cc962e6 linked_list: Implement linked_list_take 2020-08-30 00:05:19 +02:00
Kenny Levinsen
8b4d139873 libseat: Improve logging with seatd conn helpers
Add helpers around connection access to have all logging centralized and
reduce code duplication. Improve existing helpers to further reduce code
duplication.

The seatd backend should have much better logging after this.
2020-08-29 20:56:42 +02:00
Kenny Levinsen
27c1914625 terminal: Explain FreeBSD current_vt behavior 2020-08-28 17:46:13 +02:00
Kenny Levinsen
dbdce8a54b terminal: Construct TTY paths correctly on FreeBSD
FreeBSD TTY paths are contructed in the kernel using the %r formatter,
which in this case ends up being a base 32 encoding.

The base 32 implementation is taken more or less directly from wlroots
commit fc6c0ca12e94.
2020-08-28 17:46:13 +02:00
Kenny Levinsen
60a8e809b2 terminal: FreeBSD VT num is 1 higher than tty num
This was causing all VT and TTY changes to be applied to the wrong TTY.
2020-08-28 02:54:14 +02:00
Kenny Levinsen
8e0b58f90d terminal: Set K_RAW and term raw mode on FreeBSD
Taken from X11, weston and consolekit2 ports for FreeBSD.

Setting just K_CODE as done before makes input seemingly have no ill
effects, but it is still buffered and possibly send to the terminal
after application exit if stdin is never drained. Setting raw mode
appears to be needed to solve that issue.

A K_OFF-like VT keyboard setting like Linux has would seem more
appropriate, but that is not currently available to us on FreeBSD.
2020-08-28 02:54:14 +02:00
Simon Ser
07ceeeebe0 Introduce libseat_set_log_level
The default level is SILENT. log_init no longer takes an initial log
level (so that calls to libseat_set_log_level prior to log_init work
correctly).
2020-08-28 01:21:57 +02:00
Simon Ser
47d4b43f1a Introduce libseat_set_log_handler
This allows libseat users to register a custom logging function.
2020-08-28 01:21:57 +02:00
Simon Ser
a254fe3692 Rename enum log_level to libseat_log_level
This is preparatory work for exposing a public function to set libseat's
log handler.
2020-08-28 01:21:57 +02:00
Kenny Levinsen
493cc2a97d log: Remove libseat prefixes 2020-08-05 23:41:55 +02:00
Kenny Levinsen
563a932659 Remove pointless compiler.h 2020-08-05 23:20:50 +02:00
Kenny Levinsen
86efc98a5e linked_list: Assert initialized list in linked_list_empty 2020-08-04 14:25:07 +02:00
Kenny Levinsen
4afe674e54 linked_list: Initial implementation 2020-08-03 02:13:47 +02:00
Kenny Levinsen
6d031426aa list: Make list_concat argument const 2020-08-03 00:56:27 +02:00
Kenny Levinsen
5b4d00d6cf list: Add list_pop_back 2020-08-02 21:46:13 +02:00
Kenny Levinsen
b751481e5c seat: Open/close tty on activation/deactivation
The VT and KD ioctl's are picky about the tty fd used. In order to
satisfy these, and to improve state cleanup, we now only and store the
current tty when opening a client, and use this fd to perform teardown
later. The presence of the fd is also used to signal that teardown is
needed.
2020-08-02 21:46:10 +02:00
Kenny Levinsen
b731b18e0a terminal: Correctly set K_ON on keyboard enable 2020-08-02 17:47:34 +02:00
Kenny Levinsen
eace556aa8 log: Fix inverted loglevel check 2020-08-02 17:46:46 +02:00
Kenny Levinsen
d26466bf3b Remove ALWAYS_INLINE
Didn't do what I wanted it to anyway.
2020-08-01 23:13:54 +02:00
Kenny Levinsen
2be0826959 connection: Shrink buffers from 1KB to 256B each 2020-08-01 23:13:44 +02:00
Kenny Levinsen
2f54beb5fe client: Implement get_peer for FreeBSD 2020-08-01 16:53:44 +02:00
Kenny Levinsen
e129536a08 devices: Use path to check device type
FreeBSD device numbers cannot be used to check the type of a device, as
they are merely unique filesystem IDs.

As the paths we use have been sanitized with realpath, we can simply use
the path to check if a requested file is an evdev or drm device. This
also allows us to make the check before the file is opened.
2020-08-01 16:53:44 +02:00
Kenny Levinsen
dc9c7bff71 devices: FreeBSD support in drm and evdev code 2020-08-01 16:53:44 +02:00
Kenny Levinsen
c5c036531c terminal: FreeBSD VT and KD handling 2020-08-01 16:53:44 +02:00
Kenny Levinsen
61716a2c77 Initial implementation of seatd and libseat 2020-07-31 00:22:18 +02:00