summaryrefslogtreecommitdiffstats
path: root/sys/dev/wscons
AgeCommit message (Collapse)AuthorFilesLines
2020-05-29dev/rndvar.h no longer has statistical interfaces (removed during variousderaadt1-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.
2020-05-25change wsdisplay attribute type from long to uint32_tjsg8-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@
2020-05-25rename wsdisplay alloc_attr() to pack_attr()jsg5-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@
2020-05-10Fix two out-of-bounds array accesses in ioctl code pats. One found bykettenis2-4/+4
johnc@armadilloaerospace.com and another one spotted by matthieu@. ok benno@, matthieu@, deraadt@
2020-04-26Make explicit and enforce that WSCREEN and WSEMUL names are 0-terminated.bru1-5/+5
CID 1452993 (BUFFER_SIZE_WARNING) CID 1453314 (BUFFER_SIZE_WARNING) ok kettenis@
2020-04-26Remove unused assignments.bru1-3/+1
CID 1453143 ok kettenis@
2020-04-19Move logic to change brightness level in reasonable steps from acpivout(4)kettenis3-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@
2020-04-07Abstract the head of knote lists. This allows extending the lists,visa1-3/+3
for example, with locking assertions. OK mpi@, anton@
2020-03-24Backout the rename, it was more confusing then helpful.anton1-9/+9
2020-03-24Remove a chatty debug printf (not enabled by default) in wskbdopen() andanton2-10/+4
wsmouseopen(); bringing them closer to wsmuxopen(). No functional change.
2020-03-24Rename wsmousedoioctl() -> wmouse_do_ioctl() and follow the sameanton1-9/+9
convention for the open routine. This increases the consistency between wskbd, wsmouse and wsmux.
2020-03-24Ensure that me_evp is still NULL before assignment during open of wsconsanton3-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
2020-03-22Mark omissions of break statements as intentional.bru1-3/+3
CID 1453207 (Missing break in switch)
2020-03-22zap trailing whitespaceanton6-21/+21
2020-03-03Add WSDISPLAY_TYPE_RKDRMkettenis1-1/+2
ok patrick@, jsg@
2020-02-20Replace field f_isfd with field f_flags in struct filterops to allowvisa1-2/+2
adding more filter properties without cluttering the struct. OK mpi@, anton@
2020-01-08Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP andvisa3-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@
2019-12-31Use C99 designated initializers with struct filterops. In addition,visa1-5/+5
make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
2019-10-13Convert all tsleep(9) calls to tsleep_nsec(9) in wsdisplay(4).fcambus1-4/+5
OK ratchov@, visa@
2019-10-13Move ws_get_param/ws_set_param into wsdisplay code.kettenis2-2/+14
ok deraadt@, jsg@
2019-08-31Fix a bug of the tap-detection code.bru1-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.
2019-08-19Add a configuration option for reverse scrolling.bru3-9/+25
ok patrick@
2019-08-08wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@cheloha3-7/+7
2019-07-01Use timeout_add_msec(9)kn2-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
2019-05-24Remove redundant conditional. Inspecting flags is the correct way toanton1-5/+3
determine if the device was opened in read/write mode. ok mpi@ visa@
2019-05-22Cleanup debug macros in wscons. Favor __func__ over spelling out the actualanton3-56/+54
function name in order to reduce grep noise. Also, some of them where referring to the wrong function.
2019-05-22A wscons device may only be opened in read/write mode once. However,anton5-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@
2019-05-21A problem fixed in wskbd is also present in wsmux. Repeating theanton1-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
2019-05-11Add the colemak keyboard layout.abieber1-2/+4
OK deraadt@
2019-05-04Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)kettenis2-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@
2019-03-30Restrict the number of allowed wsmux devices, just like wskbd and wsmouseanton1-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
2019-03-24Fix a precedence problem.bru1-3/+6
2019-03-24Switch to precision scrolling in wstpad.bru3-64/+93
2019-03-24Add new event types for precision scrolling.bru1-1/+7
2019-03-16Clear the me_evp pointer after calling wsmux_do_close() as opposed ofanton1-2/+2
before. The pointer indicates if a wsmux device is attached to another wsmux, clearing it therefore allows same device to attached again. This can be problematic since wsmux_do_close() can sleep. Swapping the order of operations prevents attaching a wsmux which is in a closing state. ok deraadt@ mpi@ visa@
2019-03-02Limited the number of allowed stacked wsmux devices. A sufficiently long chainanton1-7/+66
of such devices can exhaust the kernel stack due to wsmux_do_open() being recursive. While here, serialize the operation of stacking a wsmux device. Joint effort with and ok visa@
2019-02-20When adding a wsmux device to an existing wsmux device usinganton1-2/+2
ioctl(WSMUXIO_ADD_DEVICE), two distinct locks of the same type are acquired. Thus, witness will emit warning. Since acquiring two different locks of the same type is harmless in this context, relax the witness check by flagging the locks as RWL_DUPOK. ok visa@ Reported-by: syzbot+249e483406a1f7843915@syzkaller.appspotmail.com
2019-02-19whitespace nitsanton1-4/+4
2019-02-19favor C99 initializers for improved grepability; ok mpi@anton3-13/+22
2019-02-18Serialize access to the list of attached child devices belonging to aanton2-8/+47
wsmux. When invoking wsevsrc_* functions on a attached child device, underlying driver can sleep; this introduces a race where another thread is able to modify the list leading to all kinds of corruptions. ok visa@ Reported-by: syzbot+03f7377a9848d7d008c9@syzkaller.appspotmail.com
2019-02-01free size for wscons_event; ok deraadt@ visa@anton1-2/+2
2019-02-01In wskbdclose(), use the same logic as in wskbdopen() to determine ifanton1-2/+3
the device was opened in write-only mode. Relying on me_evar being NULL does not work if the wskbd device was opened first followed by opening a wsmux device. Closing the wskbd device first at this stage would cause the wscons_event queue inherited from the wsmux device to be freed. This in turn could cause a panic if an ioctl(WSMUXIO_INJECTEVENT) command is issued to the wsmux device. ok deraadt@ visa@ Reported-by: syzbot+ed88256423ae8d882b8b@syzkaller.appspotmail.com
2019-01-31Fix compilation of amd64 kernel when optimization is disabled.millert1-3/+2
C99 inline semantics resulted in undefined symbols. OK deraadt@ mpi@ dlg@
2019-01-27tweak errno in previousanton1-2/+2
2019-01-27Validate the user-supplied device index given to WSMUXIO_ADD_DEVICE. The sameanton1-1/+3
index is used to index an array which could cause a panic if it's negative. ok deraadt@ Reported-by: syzbot+c5997876fea393e6b948@syzkaller.appspotmail.com
2018-12-29Cleanup: Initialize the pointers to position data early, and usebru1-17/+15
them consistently.
2018-12-26Use estimates of speed to improve gesture detection.bru1-47/+136
ok mpi@ (to the concept)
2018-12-17When no child devices are attached to a wsmux device, make sure to return ananton1-3/+6
error for inappropriate ioctl commands. Prevents a panic caused by using a wsmux device as the controlling terminal. ok deraadt@ visa@ Reported-by: syzbot+44bab40fc5a11357d774@syzkaller.appspotmail.com
2018-12-05Use a time-based method for tracking motion states of touches.bru1-50/+81
ok mpi@
2018-11-20Add support for TIOCGPGRP ioctl commands to wscons.anton3-3/+24
ok visa@