summaryrefslogtreecommitdiffstats
path: root/sys/dev/wscons (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Improve the tap detection mechanism.bru2021-03-241-12/+21
| | | | | | | | | Revision 1.29 of wstpad.c has removed the 'maxdist' checks for multi-finger taps. While this change makes tap detection more reliable, and does not affect inputs intended for pointer movement, it might interfere with short scroll gestures. This version reorganizes the filtering code, and reintroduces a weaker version of those checks for MT touchpads.
* Make tap detection less restrictive for multi-finger taps.bru2021-03-241-9/+3
| | | | | | | | | In order to distinguish tap gestures from short movements, the mechanism checks whether the distance between the first and the last position of a touch exceeds the 'maxdist' limit. Some touchpads provide unreliable coordinates when more than one contact is being made simultaneously, and in this case the filter may be too strong - and superfluous, because only one-finger contacts should trigger pointer movement.
* Include wstpad allocations when cleaning up wsmouse resources.bru2021-03-213-3/+20
| | | | ok gnezdo@
* Add WSDISPLAYIO_DEPTH_30 in order to support 30-bit color support.kettenis2021-03-121-1/+2
| | | | ok jsg@
* Add a configurable button mapping for tap gestures on touchpads.bru2021-03-032-22/+47
| | | | | | Thanks to RJ Johnson for this work! ok mpi@
* ddb: when a new wsdisplay console attaches, resize ddb cols/rows to itjcs2021-02-091-1/+9
| | | | ok visa
* Revert mistaken commit: Stop wsmux_attach_sc race from anton@gnezdo2021-01-091-2/+2
|
* Stop wsmux_attach_sc race from anton@gnezdo2021-01-091-2/+2
| | | | OK millert@
* Refactor klist insertion and removalvisa2020-12-251-3/+3
| | | | | | | | | | | | Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
* Fix yet another wscons race. In the same subsystem, the followinganton2020-12-061-6/+5
| | | | | | | | | | | | | | | | | | | | | properties must always hold true: 1. A device (wsmouse0 is this scenario) can only be opened in rw mode once. Such device cannot be a child of a wsmux at this point as it operates on its own event queue. 2. A device being a child of a wsmux must use the wsmux event queue assuming the wsmux is open. Otherwise, its event queue must be NULL. There's a race in wsmux_attach_sc() allowing a device to be part of a mux while using its own event queue. This in turn can cause a NULL pointer deference in wsevent_fini() while closing the same device. The solution is to check if the race was lost, i.e. another thread managed to open the device in rw mode while sleeping in wsmux_attach_sc(). ok gnezdo@ visa@ Reported-by: syzbot+684707f0312345a090ef@syzkaller.appspotmail.com
* Enable brightness keys on powerbooks where the keyboard attaches as ukbd(4).tobhe2020-11-021-10/+15
| | | | ok kn@
* Add astfb(4), a driver for the framebuffer of the Aspeed BMC found onkettenis2020-10-011-1/+2
| | | | many POWER8 and POWER9 systems.
* Fix various typos in wscons(4) comments.fcambus2020-09-134-8/+8
|
* The "USL" VT switch and keyboard ioctls are a hack and don't follow thekettenis2020-09-031-8/+8
| | | | | | | | | | | | | proper BSD way where the third argument is always a pointer and data is transferred between userland and kernel using copyin(9) and copyout(9). Intead an int is encoded in the thirs argument. This works on 32-bit architectures and little-endian 64-bit architectures. But not on big-endian 64-bit architectures. Deal with this by handling the argument as long (which matches the size of a pointer). Hopefully we can eliminate these ioctls in the near future. ok deraadt@
* Allow the WSDISPLAYIO_GETSCREENTYPE ioctl on the tty*cfg device, passingfcambus2020-08-051-4/+9
| | | | | | | | it back to tty*0. This is needed to restore working defaults in wsfontload(8). OK jcs@, mpi@
* Fix yet another panic in which wsevent_fini() ends up being called withanton2020-07-293-9/+11
| | | | | | | | | | | | NULL. This one is a race caused by clearing the me_evp member before calling routines that could end up sleeping. While here, make wsmux_mux_close() look more like the other mux close routines for increased symmetry. ok mpi@ Reported-by: syzbot+fb9ad34ba42994683850@syzkaller.appspotmail.com
* dev/rndvar.h no longer has statistical interfaces (removed during variousderaadt2020-05-291-2/+1
| | | | | | conversion steps). it only contains kernel prototypes for 4 interfaces, all of which legitimately belong in sys/systm.h, which are already included by all enqueue_randomness() users.
* change wsdisplay attribute type from long to uint32_tjsg2020-05-258-54/+57
| | | | | | | | miod explained it was initially a long as it was thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. suggested and reviewed by miod@
* rename wsdisplay alloc_attr() to pack_attr()jsg2020-05-255-16/+15
| | | | | | | | Suggested by John Carmack. miod agrees a rename would make sense and explained it was initially thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. ok mpi@
* Fix two out-of-bounds array accesses in ioctl code pats. One found bykettenis2020-05-102-4/+4
| | | | | | johnc@armadilloaerospace.com and another one spotted by matthieu@. ok benno@, matthieu@, deraadt@
* Make explicit and enforce that WSCREEN and WSEMUL names are 0-terminated.bru2020-04-261-5/+5
| | | | | | | CID 1452993 (BUFFER_SIZE_WARNING) CID 1453314 (BUFFER_SIZE_WARNING) ok kettenis@
* Remove unused assignments.bru2020-04-261-3/+1
| | | | | | CID 1453143 ok kettenis@
* Move logic to change brightness level in reasonable steps from acpivout(4)kettenis2020-04-193-6/+124
| | | | | | | | | | | | | | | | into wsdisplay(4). This code is now exposed through wsdisplay_brightness_{step,zero,cycle} functions that can be called by any driver that handles brightnes "hotkeys". These functions take a wsdisplay(4) device pointer as their first argument, which should be provided if a clear association between events and a particular display exist. This is used in wskbd(4). Otherwise NULL can be passed and the code will direct the request at the first wsdisplay(4) that implements brightness adjustment. Tested by many. Fixes brightness keys on x395 and other thinkpads with AMD graphics. ok patrick@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-3/+3
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Backout the rename, it was more confusing then helpful.anton2020-03-241-9/+9
|
* Remove a chatty debug printf (not enabled by default) in wskbdopen() andanton2020-03-242-10/+4
| | | | | wsmouseopen(); bringing them closer to wsmuxopen(). No functional change.
* Rename wsmousedoioctl() -> wmouse_do_ioctl() and follow the sameanton2020-03-241-9/+9
| | | | | convention for the open routine. This increases the consistency between wskbd, wsmouse and wsmux.
* Ensure that me_evp is still NULL before assignment during open of wsconsanton2020-03-243-26/+35
| | | | | | | | | | | devices. This condition is checked early on during open but since the same routine could end up sleeping before assigning me_evp, a race against adding the same wscons device to a wsmux could be lost. This in turn can cause a NULL deference during close. ok mpi@ Reported-by: syzbot+34c3041bfd96c888c8bd@syzkaller.appspotmail.com
* Mark omissions of break statements as intentional.bru2020-03-221-3/+3
| | | | CID 1453207 (Missing break in switch)
* zap trailing whitespaceanton2020-03-226-21/+21
|
* Add WSDISPLAY_TYPE_RKDRMkettenis2020-03-031-1/+2
| | | | ok patrick@, jsg@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-2/+2
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP andvisa2020-01-083-17/+20
| | | | | | | | | | | | FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of the ID parameter inside the sigio code. Also add cases for FIOSETOWN and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before. These changes allow removing the ID translation from sys_fcntl() and sys_ioctl(). Idea from NetBSD OK mpi@, claudio@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-5/+5
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* Convert all tsleep(9) calls to tsleep_nsec(9) in wsdisplay(4).fcambus2019-10-131-4/+5
| | | | OK ratchov@, visa@
* Move ws_get_param/ws_set_param into wsdisplay code.kettenis2019-10-132-2/+14
| | | | ok deraadt@, jsg@
* Fix a bug of the tap-detection code.bru2019-08-311-13/+18
| | | | | | | Do not switch from the DETECT state to IGNORE when the last (active) touch has been released. Otherwise, depending on how events are reported and synchronized, it may happen that the handler does not switch back to DETECT when necessary.
* Add a configuration option for reverse scrolling.bru2019-08-193-9/+25
| | | | ok patrick@
* wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@cheloha2019-08-083-7/+7
|
* Use timeout_add_msec(9)kn2019-07-012-16/+15
| | | | | | | Trivial conversion from ticks to milliseconds where macros already come in milliseconds and timeout values only need reduction by hz to use the new API. OK mpi
* Remove redundant conditional. Inspecting flags is the correct way toanton2019-05-241-5/+3
| | | | | | determine if the device was opened in read/write mode. ok mpi@ visa@
* Cleanup debug macros in wscons. Favor __func__ over spelling out the actualanton2019-05-223-56/+54
| | | | | function name in order to reduce grep noise. Also, some of them where referring to the wrong function.
* A wscons device may only be opened in read/write mode once. However,anton2019-05-225-16/+25
| | | | | | | | | | | after checking for exclusive access, malloc() can sleep in wsevent_init() opening up for a potential race where more than one thread may be able open the device. Prevent this by checking if the race was won after calling malloc(). While here, switch to mallocarray as proposed by both cheloha@ and mpi@ ok mpi@
* A problem fixed in wskbd is also present in wsmux. Repeating theanton2019-05-211-2/+2
| | | | | | | | | | | | | | | | previous commit message: In wsmuxclose(), use the same logic as in wsmuxopen() to determine if the device was opened in write-only mode. Relying on me_evar being NULL does not work if the wsmux device was opened first followed attaching it to another wsmux. Closing the wsmux device first at this stage would cause the wscons_event queue inherited from the parent wsmux to be freed. This in turn could cause a panic if an ioctl(WSMUXIO_INJECTEVENT) command is issued on parent wsmux device. ok mpi@ visa@ Reported-by: syzbot+f6c2ed7901eb4b970720@syzkaller.appspotmail.com
* Add the colemak keyboard layout.abieber2019-05-111-2/+4
| | | | OK deraadt@
* Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)kettenis2019-05-042-5/+20
| | | | | | | | | | | | | | | | when we have a serial console by introducing the notion of a "primary" graphics device. The primary graphics device is the one set up and used by firmware (BIOS, UEFI). The goal is to make sure that wsdisplay0 and drm0 reliably attach to the primary graphics device such that X works out of the box even if you have multiple cards or if you are using a serial console. This also fixes the situation where inteldrm(4) or radeondrm(4) would take over the console on UEFI systems even if the kernel was booted with a serial console. ok jsg@
* Restrict the number of allowed wsmux devices, just like wskbd and wsmouseanton2019-03-301-1/+4
| | | | | | | | | already does. Otherwise, malloc could panic if the device minor is sufficiently large. ok kettenis@ mpi@ visa@ Reported-by: syzbot+5a77a0fd8810d0785f61@syzkaller.appspotmail.com
* Fix a precedence problem.bru2019-03-241-3/+6
|
* Switch to precision scrolling in wstpad.bru2019-03-243-64/+93
|
* Add new event types for precision scrolling.bru2019-03-241-1/+7
|