#
359559 |
|
02-Apr-2020 |
hselasky |
MFC r359439: Evaluate modifier keys before the regular keys, so that if a modifier key is pressed at the same time as a regular key, that means key with modifier is output. Some automated USB keyboards like Yubikeys need this.
This fixes a regression issue after r357861.
Reported by: Adam McDougall <mcdouga9@egr.msu.edu> PR: 224592 PR: 233884 Sponsored by: Mellanox Technologies
|
#
358697 |
|
06-Mar-2020 |
hselasky |
MFC r358609: Restart the USB keyboard repeat timer at every valid key-press.
This fixes a regression issue after r357861.
Reported by: James Wright <james.wright@jigsawdezign.com> PR: 224592 PR: 233884 Sponsored by: Mellanox Technologies
|
#
358453 |
|
28-Feb-2020 |
hselasky |
MFC r358310: Use hid_get_data_unsigned() instead of hid_get_data() when reading the key-codes from the USB keyboard. Negative key-codes are currently skipped.
While at it use the bit size value provided by the HID location structure instead of assuming a value of 8.
This fixes a regression issue after r357861.
Reported by: Minoru TANABE <kotanabe3@gmail.com> PR: 224592 PR: 233884 Sponsored by: Mellanox Technologies
|
#
358216 |
|
21-Feb-2020 |
hselasky |
MFC r357861 and r357898: Improve USB gaming keyboard support.
Add support for decoding pressed keys as a bitmap. The keys in the bitmap are described in the interface specific HID descriptor. Some keyboards even have multiple input interfaces, only using the bitmap method when the event array is full. That typically means when more than seven keys are pressed simultaneously.
The internals of the USB keyboard driver have been slightly reworked to keep track of all keys in a single bitmap having 256 bits. This bitmap is then divided into blocks of 64-bits as an optimisation.
Simplify automatic key repeat logic, because only the last key pressed can be repeated.
PR: 224592 PR: 233884 Tested by: Alex V. Petrov <alexvpetrov@gmail.com> Sponsored by: Mellanox Technologies
|
#
358215 |
|
21-Feb-2020 |
hselasky |
MFC r304735 and r331692: Fix key delay and repeat, part 2.
Use sbintime_t timeouts with precision control to get very accurate timing. It costs little to always ask for about 1% accuracy, and the not so new event timer implementation usual delivers that, and when it can't it gets much closer than our previous coarse timeouts and buggy simple countdown.
The 2 fastest atkbd repeat rates have periods 34 and 38 msec, and ukbd pretended to support rates in between these. This requires sub-microsecond precision and accuracy even to handle the 4 msec difference very well, but ukbd asked the timeout subsystem for timeouts of 25 msec and the buggy simple countdown of this gave a a wide range of precisions and accuracies depending on HZ and other timer configuration (sometimes better than 25 msec but usually more like 50 msec). We now ask for and usually get precision and accuracy of about 1% for each repeat and much better on average.
The 1% accuracy is overkill. Rounding of 30 cps to 34 msec instead of 33 already gives an error of +2% instead of -1%, and ut AT keyboards on PS/2 interfaces have similar errors.
A timeout is now scheduled for every keypress and release. This allows some simplifications that are not done. It allows removing the timeout scheduling for exiting polled mode where it was unsafe in ddb mode. This is done. Exiting polled mode had some problems with extra repeats. Now exiting polled mode lets an extra timeout fire and the state is fudged so that the timeout handler does very little.
The sc->time_ms variable is unsigned to avoid overflow. Differences of it need to be signed. Signed comparisons were emulated by testing an emulated sign bits. This only works easily for '<' comparisonss, but we now need a '<=' comparison. Change the difference variable to signed and use a signed comparison. Using unsigned types here didn't prevent overflow bugs but just reduced them. Overflow occurs with n repeats at the silly repeat period of [U]INT_MAX / n. The old countdown had an off by 1 error, and the simplifications would simply count down 1 to 0 and not need to accumulate possibly-large repeat repeats.
PR: 226968 Sponsored by: Mellanox Technologies
|
#
358214 |
|
21-Feb-2020 |
hselasky |
MFC r304699: Fix key delay and repeat, part 1.
kbdcontrol -r fast is documented to give a non-emulated atkbd's fastest rate of 250.34, but is misimplemented to request this as 0.0. ukbd supports many nonstandard rates, although it is currently too inaccurate by a factor of several hundred for non-huge nonstandard rates to be useful. It mapped 0.0 to 200.0. A repeat delay of 0 means a rate of infinity which is quite fast, but physical constraints limit this to a few MHz and the inaccuracies made it almost usable.
Convert 0.0 to the documented 250.34.
Also convert negative args and small args to the 250.34 minimal ones, like atkbd does. This is for KDSETREPEAT -- the 2 versions of the deprecated KDSETRAD have bounds checking. Keep not doing any bounds checking or conversions for upper limits since nonstandard large delays are useful for testing.
The inaccuracies are dependent on HZ and the timeout implementation. With the old timeout implementation and HZ = 1000, 200.0 probably worked better to emulate 250.34 than 250.34 itself. HZ = 100 gives roundoff errors that accidentally reduce the inaaccuracies, and event timers reduce the inaccuracies even more, so 200.0 was giving more like itself (perhaps 215.15 on average but sometimes close to 10 msec repeat which is noticebly too fast). This commit makes 0.0 noticeably too slow, like 250.34 always was.
|
#
358213 |
|
21-Feb-2020 |
hselasky |
MFC r304612: Further fixes for translation of PrintScreen/SysRq.
The previous fix was tested mainly on 3 AT keyboards with USB adaptors where it works. 1 USB keyboard doesn't translate Alt-PrintScreen, so the software has to do it.
Reorganize a little to share some code and to not translate the unusual usb scan code0x8a unless an Alt modified is set. Remove redundant check of Alt modifiers. Translation now more clearly filters out Alt-PrintScreen before the check.
The table of errors fixed in the previous commit had many bugs. Correct table:
K_RAW Ctl-PrintScreen: E0-2A-E0-37 -> E0-37 K_RAW Alt-PrintScreen (with 4 comb. of Ctl/Shift): 79 -> 54 K_RAW Pause/Break (with 4 comb. of Alt/Shift): E0-46 -> E1-1D-45 K_CODE PrintScreen (with 4 comb. of Ctl/Shift): 54 -> 5c K_CODE Alt-PrintScreen (with 4 comb. of Ctl/Shift): 7e -> 54 K_CODE Pause/Break (with 8 comb. of Ctl/Alt/Shift): 6c -> 68
That is 25 of 32 shift combinations for 2 keys fixed. All 16 combinations were broken for K_CODE and thus also for K_XLATE.
|
#
358212 |
|
21-Feb-2020 |
hselasky |
MFC r304567: Fix translation of the PrintScreen/SysRq and Pause/Break keys. Almost everything was broken. The cases that I noticed were Ctrl-PrintScreen not being mapped to the virtual scancode 0x5c (debug) and Pause not being mapped to the physical/virtual scancode 0x46 (slock).
These keys are the most complicated ones due to kludges to give some compatibility back to before AT keyboards.
Alt-PrintScreen must pretend to be a separate key from PrintScreen even at the "raw" level. The (unique) usb code for it is 0x8a and we just have to map this to our unique virtual scancode 0x54, but we mapped it first to the internal code 0x7e and then to 0x79 which is a key on the Japanese 106/109 keyboard. This fix is under the UKBD_EMULATE_ATASCANCODE option which shouldn't be used for non-AT keyboards. If it is, then the syscons Japanese keymaps have nothing of importance for code 0x79 and can easily be changed. 0x54 is also unimportant in Japanese and US keymaps.
NonAlt-PrintScreen and NonCtl-Pause/Break had many much larger bugs with smaller compatibility problems from fixing them. The details are too ugly to give here. Summary of the changed (hex) codes:
K_RAW PrintScreen (Ctl, Shift, Ctl-Shift): E0-2A-E0-37 -> E0-37 K_RAW Alt-PrintScreen (all shift states): 79 -> 54 K_RAW Pause/Break (unshifted, Shift, Alt, Alt-Shift)): E0-46 -> E1-1D-45 K_CODE ALT-PrintScreen (all shift states): 79 -> 54
That is 15 of 32 shift combinations for 2 keys fixed, with 8 easy cases from the 79 -> 54 remapping.
The difference is only large and with no workaround using a keymap for for K_RAW, but this affects other modes when ukbd is layered under kbmux because kbmux keeps all subdevices in K_RAW mode and translates. Oops. I used kbdmux to generate the above table of changes.
|
#
356020 |
|
22-Dec-2019 |
kevans |
MFC r355206, r355212, r355257, r355271: tty nits
r355206: tty_pts: don't rely on tty header pollution for sys/mutex.h r355212: tty_rel_gone: add locking assertion r355257: usb: remove some extraneous tty.h includes r355271: Remove more needless <sys/tty.h> includes
|
#
356013 |
|
22-Dec-2019 |
kevans |
MFC r355796-r355797, r355799: kbd: defaults for get_fkeystr/diag
The genkbd version of these remains exposed for stable branches, but keyboard drivers that just want to use the defaults can simply not provide their own. There shouldn't be any unset in the wild.
r355796: kbd: provide default implementations of get_fkeystr/diag
Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set.
r355797: chrome_kb: remove default get_fkeystr/diag implementations
This file was missed in r355796, but no harm would have come from this.
r355799: kbd: patch linker set methods, too
This is needed after r355796. Some double-registration of kbd drivers needs to be sorted out, then this sysinit will simply add these drivers into the normal list and kill off any other bits in the driver that are aware of the linker set, for simplicity.
|
#
356012 |
|
22-Dec-2019 |
kevans |
MFC r355793: kbd drivers: use kbdd_* indirection for diag invocation
|
#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
307777 |
|
22-Oct-2016 |
gonzo |
MFC r306647, r306855, r306857
r306647: const-ify struct evdev_methods
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru> Suggested by: hselasky
r306855: Allow using of driver's mutex instead internal one for evdev locking.
Add new API call: evdev_register_mtx which takes lock argument that should be used instead of internal one for evdev locking. Useful for cases if evdev_push_event() is always called with driver's lock taken and reduces amount of lock aquisitions. This allows to avoid LOR between ev_open/ev_close invocations and evdev_push_event() Such LOR can happen when ev_open/ev_close methods acquire driver lock and evdev_push_event() is called with this lock taken.
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
r306857: Implement EVDEV_FLAG_MT_AUTOREL flag (autorelease touchpoints)
Automaticaly release (send ABS_MT_TRACKING_ID = -1) MT-slots that has not been listed in current MT protocol type B report.
Slot is counted as listed if corresponding ABS_MT_SLOT event has been sent regardless of other MT events.
Events are sent on SYN_REPORT event.
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
|
#
307775 |
|
22-Oct-2016 |
gonzo |
MFC r306530, r306531, r306532, r306579:
r306530: Declare a module for evdev and add dependency to ukbd(4) and ums(4)
Prepare for making evdev a module. "Pure" evdev device drivers (like touchscreen) and evdev itself can be built as a modules regardless of "options EVDEV" in kernel config. So if people does not require evdev functionality in hybrid drivers like ums and ukbd they can, for instance, kldload evdev and utouchscreen to run FreeBSD in kiosk mode.
r306531: Add dependency to evdev module (if required)
r306532: Add dependency to evdev module
r306579: Modularize evdev
- Convert "options EVDEV" to "device evdev" and "device uinput", add modules for both new devices. They are isolated subsystems and do not require any compile-time changes to general kernel subsytems - For hybrid drivers that have evdev as an optional way to deliver input events add option EVDEV_SUPPORT. Update all existing hybrid drivers to use it instead of EVDEV - Remove no-op DECLARE_MODULE in evdev, it's not required, MODULE_VERSION is enough - Add evdev module dependency to uinput
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
|
#
307764 |
|
21-Oct-2016 |
gonzo |
MFC r306132, r306275:
r306132: Add evdev support to ukbd driver
event generation is disabled by default in favour of kbdmux. This behavoiur is controlled by kern.evdev.rcpt_mask sysctl, bit 3 should be set to give priority to hw over mux
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru> Reviewed by: hans Differential Revision: https://reviews.freebsd.org/D7957
r306275: Do not perform extra check for NULL, evdev_free can handle NULL value
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
|
#
305644 |
|
09-Sep-2016 |
hselasky |
MFC r304571: Make the UKBD USB transfers double buffered and set them up one by one, so they are memory independent which allows for handling panics triggered by the keyboard driver itself, typically via CTRL+ALT+ESC sequences. Or if the USB keyboard driver was processing a key at the moment of panic. Allow UKBD to be attached while keyboard polling is active.
|
#
304124 |
|
15-Aug-2016 |
hselasky |
MFC r303765: Keep a reference count on USB keyboard polling to allow recursive cngrab() during a panic for example, similar to what the AT-keyboard driver is doing.
Found by: Bruce Evans <brde@optusnet.com.au>
|