summaryrefslogtreecommitdiff
path: root/sys/dev/evdev
Commit message (Collapse)AuthorAgeFilesLines
* evdev: Extend EVIOCGRAB ioctl scope to cover kbd interfaceVladimir Kondratyev2022-12-241-0/+2
| | | | | | | | | | | | of various keyboard drivers. EVIOCGRAB ioctl execution on /dev/input/event# device node gains exclusive access to this device to caller. It is used mostly for development purposes and remote control software. See e.g. https://reviews.freebsd.org/D30020 which is the reason of creation of this change. Keyboard grabbing is disabled in KDB and during panics. (cherry picked from commit 183088934a6c4384e45ac6d01c04754e0d7a991c)
* evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interfaceVladimir Kondratyev2022-12-242-0/+12
| | | | | | | | | | | of psm(4), ums(4) and sysmouse(4) drivers. EVIOCGRAB ioctl execution on /dev/input/event# device node gains exclusive access to this device to caller. It is used mostly for development purposes and remote control software. See e.g. https://reviews.freebsd.org/D30020 which is the reason of creation of this change. (cherry picked from commit 4a0db5e2920c0e0df52d6888bdd732df95706dfc)
* atkbd(4): Fix "hancha" and "han/yong" korean keys handling.Vladimir Kondratyev2022-12-241-1/+1
| | | | | | | | | | | | | The Korean keyboard has two keys, the Korean/Chinese and the Korean/English toggles, that generate scancodes 0xF1 and 0xF2 (respectively) when pressed, and nothing when released. They do not repeat. As Hanyong/Hancha keys are generally greater than 0x80, which is generally considered a release key, add extra preceding press key event to generate press/release pair. Swap Hanyong/Hancha key codes to match reality. (cherry picked from commit 6a26c99f827ffa9da5e23d466eeb17131fc75238)
* evdev: Add parentheses around '-' expression in operand of '&'.John Baldwin2021-11-301-1/+1
| | | | | | | | | This fixes a -Wparentheses error with GCC 9. Reviewed by: wulf Differential Revision: https://reviews.freebsd.org/D31947 (cherry picked from commit d99c87c8d54a02a229cbeaa19ec8784b1d5afbb9)
* evdev: Fix a typo in a commitGordon Bergling2021-10-061-1/+1
| | | | | | - s/prefered/preferred/ (cherry picked from commit efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc)
* evdev: Add support for automatic MT protocol type A to type B conversion.Vladimir Kondratyev2021-09-072-4/+33
| | | | (cherry picked from commit d056693d7bc6c1b5f2c1612e5b34807f173e21c7)
* evdev: Add implicit mode for touch tracking.Vladimir Kondratyev2021-09-074-7/+99
| | | | | | | | | | | | In implicit mode assignment of slot number and tracking id is performed automatically on each synchronization requested by device driver. This is done with creation of intermediate buffer for multitouch events. This buffer holds untracked events until synchronization is requested by device driver. It is needed as touch assigment requires knowledges of all touch positions pushed in current and previous reports. (cherry picked from commit f76051c7dabe952b75127a8031d87d78b603be20)
* evdev: Import support for touch-tracking.Vladimir Kondratyev2021-09-072-2/+212
| | | | | | | | | | | | | | | Touch tracking is a process of assignment of unique trackingID to each initiated contact on the surface. Keeping the trackingIDs persistent across multitouch reports requires solving of so called Euclidian Bipartite Matching problem. This commit imports EBM-solver implementation based on Dinitz-Kronrod algorithm to find minimum cost matching between contacts listed in two consecutive reports. Obtained from: OpenBSD (cherry picked from commit 4c0a134e32a7f4dec556fea15c8de22f69864492)
* evdev: Make MT tracking IDs monotonically increasing sequence.Vladimir Kondratyev2021-09-075-5/+49
| | | | (cherry picked from commit 66bd52f5e241bd2548015f847f12cdff69176c40)
* evdev: Give short aliases to items of evdev_mt_slot arrayVladimir Kondratyev2021-09-072-14/+73
| | | | | | | | | | | with using of unioned anonymous structure. Access to the same data by using different members of union generally works despite it is not supported by C specs. Also add helper function to report entire slot state. (cherry picked from commit 059360287e3344f48f5a7839e2d6d54016b18b19)
* evdev: Normalize width and pressure of single touch compat eventsVladimir Kondratyev2021-09-071-18/+49
| | | | | | to match Synaptics touchpad reporting range. (cherry picked from commit 127e54deb6d8899e1dc1bc6251d512e19f21b0f1)
* evdev: force no fuzz for autogenerated single touch compat events.Vladimir Kondratyev2021-09-072-2/+2
| | | | | | | As fuzz has already been applied on multitouch event processing. This allows to remove existing workaround for double fuzz procesing. (cherry picked from commit 314913ed7c6e6e1b7c80a1063620f478961419b7)
* evdev: Send first active rather than 0-th slot state as ST reportVladimir Kondratyev2021-09-071-4/+5
| | | | (cherry picked from commit fbe17f9017e785dd564ce7fc5553a9136d3a0b03)
* evdev: Use bitsets to track active touches and slots changed in current reportVladimir Kondratyev2021-09-071-51/+43
| | | | | | Obtained from: OpenBSD (cherry picked from commit 2dc7188e532f0147b36a44ce5c033d9f59cbd9f4)
* evdev: Multitouch code style changes.Vladimir Kondratyev2021-09-076-104/+134
| | | | | | | | | | | 1. Move touch count reporting helpers to utils. They are not multitouch. 2. Use evdev_mt prefix for private multitouch support routines. 3. Use int instead of int32_t where fixed size is not required. 4. Export some internal functions. This change should be no-op. (cherry picked from commit 98a7606b85e05132f328a2498dccab78df31cb7e)
* evdev: Use bit_foreach helper macroVladimir Kondratyev2021-08-232-19/+16
| | | | | | | | for traversing all bits set in the bitstring(9). While here move bit_change() definition to common header. (cherry picked from commit 5f99ae56c9196753ae162ad464c2969ad1a131b6)
* evdev: Do not check maximal contact number for MT initializationVladimir Kondratyev2021-08-231-2/+1
| | | | | | | | This allows singletouch devices which use multitouch protocols to work. Reported by: Mark Kane <mark_AT_kane_DOT_mn> (cherry picked from commit e40fec4ec9a7a6625b3e332d4f856eb1d05f0def)
* evdev: Make variable-size ioctls return actual length of copyouted dataVladimir Kondratyev2021-01-201-6/+23
| | | | | | | | | on success instead of 0 to match Linux. Imprivata binary depends on this. Submitted by: Shunchao Hu <ankohuu_outlook.com> Reviewed by: wulf Differential revision: https://reviews.freebsd.org/D28218
* hid: Add missing input enter/exit epoch pairs.Vladimir Kondratyev2021-01-141-0/+5
| | | | This was affecting unloading keyboard driver and kdb-related code.
* evdev: Implement fuzz.Vladimir Kondratyev2021-01-071-1/+19
| | | | | | | Fuzz is used to filter noise from the event stream. Upcoming gamepad drivers use it. Reviewed by: hselasky (as part of D27993)
* evdev: Allow open() handler to be interrupted by a signalVladimir Kondratyev2021-01-072-5/+15
| | | | | | | It is possible that the client list lock is taken by other process for too long due to e.g. IO timeouts. Allow user to terminate open() in this case. Reviewed by: markj (as part of D27865)
* evdev: Make open(2) and close(3) handlers sleepable.Vladimir Kondratyev2021-01-074-67/+156
| | | | | | | | | | | | | | | | | | | | At the beginning of evdev there was a LOR between hardware driver's and evdev client list locks as they were taken in different order at driver's interrupt and evdev open()/close() handlers. The LOR was fixed with introduction of evdev_register_mtx() function which allowed to use a hardware driver's lock as evdev client list lock. While this works good with PS/2 and USB, this does not work with I2C. Unlike PS/2 and USB, I2C open()/close() handlers do unbound sleeps while waiting for I2C bus to release and while performing IO. This change uses epoch(9) for traversing evdev client list in interrupt handler to avoid the LOR thus making possible to convert evdev client list lock to sleepable sx. While here add brief locking protocol description. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D27865
* evdev: Remove useless "initial value" parameter from evdev_support_abs()Vladimir Kondratyev2021-01-074-10/+7
| | | | | It can not be used for setting of state of multitouch events. If necessary, use evdev_push_event() instead of it.
* kqueue: save space by using only one func pointer for assertionsMateusz Guzik2020-11-091-11/+6
| | | | Notes: svn path=/head/; revision=367498
* Allow evdev's rcpt_mask and sysmouse_t_axis parameters to be specified inHans Petter Selasky2020-10-081-2/+2
| | | | | | | | | | /boot/loader.conf . MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=366533
* atkbd/evdev: recognize the Chromebook menu key as F13 like Linux does.Vladimir Kondratyev2020-06-251-1/+1
| | | | | | | | | | | | This is the key on the right side of the function keys, with the "hamburger menu" icon on it. Submitted by: GregV <greg@unrelenting.technology> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25390 Notes: svn path=/head/; revision=362599
* evdev: Add AT translated set1 scancodes for 'Eisu' & 'Kana' keys.Vladimir Kondratyev2020-06-171-1/+1
| | | | | | | | | PR: 247292 Submitted by: Yuichiro NAITO <naito.yuichiro@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=362260
* [evdev] Sync event codes with Linux kernel 5.6Vladimir Kondratyev2020-05-042-6/+109
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=360625
* [evdev] Add AT translated set1 scancodes for F-unlocked F1-12 keys.Vladimir Kondratyev2020-05-041-6/+6
| | | | | | | | | | | | | | | | | "F lock" is a switch between two sets of scancodes for function keys F1-F12 found on some Logitech and Microsoft PS/2 keyboards [1]. When "F lock" is pressed, then F1-F12 act as function keys and produce usual keyscans for these keys. When "F lock" is depressed, F1-F12 produced the same keyscans but prefixed with E0. Some laptops use [2] E0-prefixed F1-F12 scancodes for non-standard keys. [1] https://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html [2] https://reviews.freebsd.org/D21565 MFC after: 2 weeks Notes: svn path=/head/; revision=360624
* Fix kern.evdev.rcpt_mask on powerpcNiclas Zeising2020-04-201-1/+1
| | | | | | | | | | | | | | | In r360126, I meant to have a different mask only on powerpc, not powerpc64. Update the check to check that we're not compiling for powerpc64. Reported by: jhibbits Approved by: wulf (implicit) MFC after: 2 weeks X-MFC-Note: 12 only X-MFC-With: r360126 Differential Revision: D24370 (followup) Notes: svn path=/head/; revision=360132
* Change kern.evdev.rcpt_mask to 12 by defaultNiclas Zeising2020-04-201-1/+6
| | | | | | | | | | | | | | | | | | | Change kern.evdev.rcpt_mask from 3 to 12 by default. This makes us much more evdev-friendly, and will prevent everyone using xorg and wayland with evdev devices (the default) from needing to change this locally. powerpc32 still uses the old value for the keyboard part, becaues the adb keyboard driver used there is not evdev compatible. Reviewed by: wulf Approved by: wulf MFC after: 2 weeks X-MFC-Note: 12 only Relnotes: yes Differential Revision: https://reviews.freebsd.org/D24370 Notes: svn path=/head/; revision=360126
* Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are removingXin LI2020-04-191-2/+2
| | | | | | | | | | | | | | elements in the middle. This fixes a panic when detaching USB mouse. PR: 245732 Reviewed by: wulf MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D24500 Notes: svn path=/head/; revision=360104
* [evdev] Use proper mutex reference in autorepeat callout initialization.Vladimir Kondratyev2020-04-131-1/+1
| | | | | | | | This fixes panic occuring when evdev key autorepeat is enabled by driver which initializes evdev with external mutex. Notes: svn path=/head/; revision=359905
* evdev: return error rather than zero-length data on blocked read()Vladimir Kondratyev2020-03-291-0/+2
| | | | | | | | | if blocked process has been woken up by evdev device destruction. MFC after: 2 weeks Notes: svn path=/head/; revision=359429
* evdev: Add COMPAT_FREEBSD32 support for amd64 archVladimir Kondratyev2020-03-291-12/+68
| | | | | | | | | | | | | | Incompatibility between i386 and amd64 evdev ABIs was caused by presence of 'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for 32 bit binaries. Big-endian platforms may require additional work due to bitstr_t (array of unsigned longs) usage in ioctl interface. MFC after: 2 weeks Notes: svn path=/head/; revision=359428
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-3/+5
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Fix build when EVDEV_SUPPORT is option disabled after r344494Vladimir Kondratyev2019-02-241-2/+2
| | | | | | | MFC with: 344494 Notes: svn path=/head/; revision=344495
* evdev: export event device properties through sysctl interfaceVladimir Kondratyev2019-02-242-0/+95
| | | | | | | | | | | | | | | | | | | A big security advantage of Wayland is not allowing applications to read input devices all the time. Having /dev/input/* accessible to the user account subverts this advantage. libudev-devd was opening the evdev devices to detect their types (mouse, keyboard, touchpad, etc). This don't work if /dev/input/* is inaccessible. With the kernel exposing this information as sysctls (kern.evdev.input.*), we can work w/o /dev/input/* access, preserving the Wayland security model. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: wulf, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18694 Notes: svn path=/head/; revision=344494
* evdev: Fix pause key release event in AT keyboard set 1 to evdev xlat-or.Vladimir Kondratyev2018-11-251-2/+5
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=340926
* evdev: disable evdev if it is invoked from KDB or panic contextVladimir Kondratyev2018-10-273-0/+62
| | | | | | | | | | | | | | | This allow to prevent deadlock on entering KDB if one of evdev locks is already taken by userspace process. Also this change discards all but LED console events produced by KDB as unrelated to userspace. Tested by: dumbbell (as part of D15070) Objected by: bde (as 'KDB lock an already locked mutex' problem solution) MFC after: 1 month Notes: svn path=/head/; revision=339824
* evdev: Use console lock as evdev lock for all supported keyboard drivers.Vladimir Kondratyev2018-10-271-1/+6
| | | | | | | | | | | | Now evdev part of keyboard drivers does not take any locks if corresponding input/eventN device node is not opened by userland consumers. Do not assert console lock inside evdev to handle the cases when keyboard driver is called from some special single-threaded context like shutdown thread. Notes: svn path=/head/; revision=339823
* evdev: Remove evdev.ko linkage dependency on kbd driverVladimir Kondratyev2018-08-132-43/+0
| | | | | | | | | | | | | | | | | | Move evdev_ev_kbd_event() helper from evdev to kbd.c as otherwise evdev unconditionally requires all keyboard and console stuff to be compiled into the kernel. This dependency happens as evdev_ev_kbd_event() helper references kbdsw global variable defined in kbd.c through use of kbdd_ioctl() macro. While here make all keyboard drivers respect evdev_rcpt_mask while setting typematic rate and LEDs with evdev interface. Requested by: Milan Obuch <bsd@dino.sk> Reviewed by: hselasky, gonzo Differential Revision: https://reviews.freebsd.org/D16614 Notes: svn path=/head/; revision=337721
* evdev: remove soft context from evdev methods parameter list.Vladimir Kondratyev2018-08-135-17/+23
| | | | | | | | | | | | | Now softc should be retrieved from struct edvev * pointer with evdev_get_softc() helper. wmt(4) is a sample of driver that support both KPI. Reviewed by: hselasky, gonzo Differential Revision: https://reviews.freebsd.org/D16614 Notes: svn path=/head/; revision=337720
* [evdev] Sync event codes with Linux kernel 4.16Vladimir Kondratyev2018-06-032-0/+42
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=334555
* uinput: Add FreeBSD specific ioctl to set unique identifier of input device.Vladimir Kondratyev2018-04-302-0/+16
| | | | | | | | Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D13456 Notes: svn path=/head/; revision=333111
* evdev: change USB scancode 0x54 from KEY_SLASH to KEY_KPSLASHVladimir Kondratyev2017-11-201-1/+1
| | | | | | | | | | | Submitted by: dumbbell Reviewed by: gonzo, wulf Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12983 Notes: svn path=/head/; revision=326021
* Fix evdev codes for slash and asterisk numpad keys of AT-keyboardsVladimir Kondratyev2017-11-201-2/+2
| | | | | | | | | Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=326020
* evdev: Export EVDEV_SUPPORT kernel option through feature facilityVladimir Kondratyev2017-11-201-0/+3
| | | | | | | | | | Suggested by: netchild Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 1 week Notes: svn path=/head/; revision=326019
* evdev: Do not start/stop softrepeat callout if no clients attachedVladimir Kondratyev2017-11-011-1/+2
| | | | | | | | | | Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12676 Notes: svn path=/head/; revision=325299