summaryrefslogtreecommitdiffstats
path: root/sys/dev/wscons/wskbd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Enable brightness keys on powerbooks where the keyboard attaches as ukbd(4).tobhe2020-11-021-10/+15
| | | | ok kn@
* Fix yet another panic in which wsevent_fini() ends up being called withanton2020-07-291-3/+3
| | | | | | | | | | | | 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
* 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-191-4/+6
| | | | | | | | | | | | | | | | 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@
* Remove a chatty debug printf (not enabled by default) in wskbdopen() andanton2020-03-241-5/+2
| | | | | wsmouseopen(); bringing them closer to wsmuxopen(). No functional change.
* Ensure that me_evp is still NULL before assignment during open of wsconsanton2020-03-241-6/+11
| | | | | | | | | | | 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
* zap trailing whitespaceanton2020-03-221-7/+7
|
* Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP andvisa2020-01-081-5/+5
| | | | | | | | | | | | 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@
* wskbd, wsmouse(4): tsleep(9) -> tsleep_nsec(9); ok mpi@ kn@cheloha2019-08-081-2/+2
|
* Cleanup debug macros in wscons. Favor __func__ over spelling out the actualanton2019-05-221-9/+9
| | | | | 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-221-2/+3
| | | | | | | | | | | 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@
* favor C99 initializers for improved grepability; ok mpi@anton2019-02-191-6/+8
|
* In wskbdclose(), use the same logic as in wskbdopen() to determine ifanton2019-02-011-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
* Add support for TIOCGPGRP ioctl commands to wscons.anton2018-11-201-1/+8
| | | | ok visa@
* No need for wscons to handle FIOSETOWN ioctl requests since sys_ioctl()anton2018-11-201-7/+1
| | | | | | translates such requests into TIOCSPGRP. ok visa@
* Utilize sigio with wscons. The old behavior of always making the process groupanton2018-11-191-12/+11
| | | | | | | | | | | | | | of the process who opens the device the default recipient of sigio is removed as a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in order to receive sigio, which is more consistent with other subsystems supporting sigio. This change is all made possible by the new sigio(9) API and prevents wscons from keeping a pointer to the recipient process. Usage of such pointer could cause a panic since wscons is not inform on process deallocation, leaving a dangling pointer behind. ok mpi@ visa@
* Try to get the layout from the default mux when attaching a consolempi2018-04-181-19/+8
| | | | | | | | | | | keyboard late. This makes keyboard re-attaching due to the machdep.forceukbd sysctl(2) respect /etc/kbdtype. Issue reported by Artturi Alm, jmc@ and landry@. ok kettenis@
* Remove almost unused `flags' argument of suser().mpi2018-02-191-3/+3
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* More sizes for free() in wscons(4).fcambus2018-01-221-2/+3
| | | | OK visa@
* Add sizes for free() in wscons(4).fcambus2018-01-171-2/+2
| | | | OK deraadt@, visa@, mpi@
* Introduce a new keyboard console hook to enter ddb(4) and make ukbd(4)mpi2017-05-121-5/+18
| | | | | | | | | | | | | | use it. Instead of defering every input of a USB console keyboard to a timeout via a queue of one element, only differ entering ddb(4) once a matching control sequenece has been typed. This prevent loosing inputs when a USB console keyboard is "too fast". Fix a problem reported by matthieu@, Adam McDougall and Hrvoje Popovski. ok stsp@, dlg@
* Rename Debugger() into db_enter().mpi2017-04-301-3/+3
| | | | | | | Using a name with the 'db_' prefix makes it invisible from the dynamic profiler. ok deraadt@, kettenis@, visa@
* Introduce a new knob to force the first USB keyboard as console input.mpi2017-03-111-4/+4
| | | | | | | By setting "machdep.forceukbd=1" you can now use your USB keyboard in ddb(4) even if your BIOS emulates a pckbd(4). ok tom@, kettenis@, deraadt@
* Add a WSKBDIO_GETENCODINGS ioctl that returns the supported keyboardkettenis2016-09-301-1/+17
| | | | | | encodings. ok deraadt@, jca@
* add new ioctls to control keyboard backlightsjung2015-12-121-1/+17
| | | | | | tested by Bryan Vyhmeister, krw, tb, and myself ok jcs krw tb
* kqueue(2) support for wsmouse(4), wskbd(4) and wsmux(4).mpi2015-09-101-1/+11
| | | | | | Needed for libinput port. ok guenther@, miod@
* yet more mallocarray() changes.doug2014-12-131-2/+4
| | | | ok tedu@ deraadt@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-3/+3
| | | | after discussions with beck deraadt kettenis.
* It's init as a process that's special, not init's original thread.guenther2014-07-111-2/+2
| | | | | | Remember initprocess instead of initproc. ok matthew@ blambert@
* Use a more appropriate malloc(9) type than M_TEMP for the keymap memorympi2014-05-151-2/+2
| | | | since it is only freed when your keyboard is detached.
* Plug a memory leak, free the keymap's memory on detach.mpi2014-05-051-1/+3
| | | | ok miod@
* Attempt to make user changes of keyboard layout a bit more `sticky' on wsmuxmiod2014-01-261-34/+76
| | | | | | | | | | | | | | | | | kernels: - keyboard drivers will now tell wskbd if the keyboard layout they ask for is a default value, or a value they are 100% sure of (either because your kernel has a XXXKBD_LAYOUT option, or because the driver can tell the keyboard layout, e.g. by the country code on USB keyboards which provide it, such as Sun's) - when attaching a keyboard with a non-default layout, the layout will become the default layout of the mux for new keyboard attachments if the mux doesn't have a layout set already. - when changing the keyboard layout of a particular keyboard with an ioctl (i.e. using kbd(8) or wsconsctl(8)), the layout will become the default layout of the mux for new keyboard attachments. ok mpi@
* Convert wskbd_set_mixervolume() to use a task internally instead ofmpi2013-11-041-9/+5
| | | | | | being called in a workq. ok kettenis@
* UTF-8 support for wsdisplay emulation modes. Both vt100 and sun emulationmiod2013-10-181-1/+3
| | | | | | | | | | | | | will now recognize xterm-compatible escape sequences ESC % G and ESC % @ to enter and leave UTF-8 mode, respectively. Not enabled on SMALL_KERNEL. Most of this written during c2k7, completed during b2k13. Note that the value of several international keysyms change, to switch from ISO Latin-[257] values to the real Unicode values. Be sure to update your includes and rebuild and install wsconsctl.
* Introduce a dedicated private header file to control the optional featuresmiod2013-10-181-9/+5
| | | | | | | of wscons (which usually get disabled for installation kernels, to save space), instead of duplicating parts of it to too many places. No functional change.
* don't propagate XF86XK_Audio{Lower,Raise}Volume keys to userspace,ratchov2013-01-061-3/+3
| | | | | | | otherwise volume may be adjusted twice: once by X apps and once in the kernel. feedback from many, ok shadchin@
* #if NWSDISPLAY > 0 not #if WSDISPLAY > 0jsg2012-10-171-2/+2
| | | | ok miod@
* If directly open /dev/wskbdX, then wskbdX be removed from mux wskbd,shadchin2011-11-091-1/+16
| | | | | | but if close wskbdX, wskbdX not returned to mux. Fix it. ok miod@
* machdep.kbdreset enables a shutdown by Ctrl-Alt-Del on amd64 andnaddy2011-06-241-1/+3
| | | | | | | | | | | | | | | i386. Stop abusing it on other archs for controling a shutdown by pressing the soft power button: * Add a MI sysctl hw.allowpowerdown; if set to 1 (the default) it allows a power button shutdown. * Make acpi(4)/acpibtn(4) honor hw.allowpowerdown. * Switch the various power button intercepts on landisk, sgi, sparc64 and zaurus over to hw.allowpowerdown. * Garbage collect the machdep.kbdreset sysctl on all archs other than amd64 and i386. ok miod@
* a bit more ansi; ok teduderaadt2011-06-231-3/+3
|
* Microphone mute button support from acpithinkpad (or elsewhere).deraadt2011-06-061-5/+5
| | | | | | | The audio side is a bit lacking; it does not yet mute all types of devices. from Alexander Polakov ok jakemsr
* Reducing number of call update_leds().shadchin2011-04-141-10/+7
| | | | | | Updating state LED only when necessary. ok krw@
* wskbd_holdscreen() is not needed and can be removedshadchin2011-04-131-25/+4
| | | | ok miod@
* Change wsdisplay_kbdinput() to get an aray of keysym_t and a count, instead ofmiod2010-11-201-17/+9
| | | | | | | | | a single keysym_t at a time - this means tty sanity checks will only happen once. Introduce wsdisplay_rawkbdinput() for raw mode input, since raw input is a byte array. As a bonus this allows us to skip the `is this a KS_GROUP_Ascii value' test in that case.
* Replace all mentions of sc_base.me_dispdv with sc_displaydv. The latter is amiod2010-11-201-23/+23
| | | | short #define for the former, and seeing both forms in this file is confusing.
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-5/+5
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* Get rid of devact enum, substitute it with an int and coresponding defines.pirofti2009-10-131-3/+3
| | | | | | This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
* Replace timeout_add(msecs * hz / 1000) with timeout_add_msec(msecs).grange2009-01-211-7/+5
| | | | | | No functional changes. ok krw@ miod@
* on i386 and amd64, let ctrl-alt-delete let you enter ddb if ddb.console=1dlg2008-12-211-2/+14
| | | | | | and machdep.kbdreset=2. "i like it" deraadt@
* KNFgilles2007-09-111-2/+2
| | | | prompted and "much better" by marco@, ok pyr@