Go to file
Purdea Andrei dbd65d01b6
Fix how USB queue overflow is handled in chibios. (#12576)
* Fix how USB queue overflow is handled in chibios.

This commit reverts PR 12472 (commit c823fe2d3f23ed090e36ce39beed4c448298bd2f),
and it implements the original intent of the commit in a better way.
The original intent of the above mentioned commit was to not deadlock the
keyboard when console is enabled, and hid_listen is not started.

The above mentioned commit had a few drawbacks:
1) When a lot of data was printed to the console, the queue would get full,
and drop data, even if hid_listen was running. (For example having matrix debug
enabled just didn't work right at all)
2) I believe the function in which this was implemented is used by all other
USB endpoints, so with the above change, overflow, and data loss could
happen in other important functions of QMK as well.

This commit implements deadlock prevention in a slightly similar way to how
it's done on AVR. There is an additional static local variable, that memorizes
whether the console has timeouted before. If we are in the timeouted=false
state, then we send the character normally with a 5ms timeout. If it does
time out, then hid_listen is likely not running, and future characters should
not be sent with a timeout, but those characters should still be sent if there
is space in the queue. The difference between the AVR implementation and this
one is that the AVR implementation checks the queue state directly, but this
implementation instead attempts to write the character with a zero timeout.
If it fails, then we remain in the timeouted=true state, if it succeeds, then
hid_listen started removing data from the queue, so we can go out of the
timeouted=true state.

* Added comment explaining the timeouted logic to console flow control.

* Console flow control: refactor chibios flowcontrol code to make it more readable, and rename the timeouted variable to timed_out on both chibios and lufa. Changed comments to says timed_out is an approximation of listener_disconnected, to make it clear that it's not the same thing

* fix typo
2021-04-25 13:11:41 +10:00
.github fix CI job: api-data->api_data 2021-03-06 21:26:07 -08:00
.vscode
api_data
bin Create a system to map between info.json and config.h/rules.mk (#11548) 2021-01-31 12:46:00 -08:00
data Add support for qmk_configurator style aliases (#11954) 2021-03-24 09:26:38 -07:00
docs Add additional info to PR Checklist (#12630) 2021-04-20 20:12:57 +02:00
drivers Fixup Satisfaction75 bootprocess. (#12621) 2021-04-19 13:08:01 +10:00
keyboards Add RGB matrix suspend wake function for Planck/rev6 (#12290) 2021-04-25 11:47:43 +10:00
layouts [Keymap] stanrc85 keymap updates (#12184) 2021-03-16 19:44:13 -07:00
lib Fix CLI incorrectly following `DEFAULT_FOLDER` (#12529) 2021-04-25 11:15:54 +10:00
nix [nix] Use niv and poetry2nix to more easily manage dependencies (#11181) 2021-04-03 08:05:46 -07:00
platforms/chibios Add STM32G431 and STM32G474 board definitions. (#11793) 2021-02-06 11:27:46 +11:00
quantum Fix F303 audio output on A4 with the dac_basic driver (#12480) 2021-04-19 00:32:14 -07:00
tests Missed a couple more `#pragma once`s (#11351) 2020-12-30 15:44:53 +00:00
tmk_core Fix how USB queue overflow is handled in chibios. (#12576) 2021-04-25 13:11:41 +10:00
users [Keymap] Fix handling of RV_LOCK and RV_SNAP for windows (#12498) 2021-04-19 02:22:49 -07:00
util Add support for tab completion (#12411) 2021-04-14 19:00:22 -07:00
.clang-format
.editorconfig
.gitattributes [nix] Use niv and poetry2nix to more easily manage dependencies (#11181) 2021-04-03 08:05:46 -07:00
.gitignore
.gitmodules
.travis.yml CI: Add workflow for codebase formatting (#7382) 2020-12-10 17:01:51 +00:00
CODE_OF_CONDUCT.md
Dockerfile
Doxyfile
LICENSE
Makefile Configure keyboard matrix from info.json (#10817) 2020-12-30 10:27:37 -08:00
Vagrantfile
book.json
bootloader.mk Adds AT90USB162 support (#11570) 2021-01-29 19:53:56 -08:00
build_full_test.mk Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
build_json.mk
build_keyboard.mk `qmk generate-rules-mk`: add `--escape` switch for makefile logic (#12101) 2021-03-04 15:09:22 +11:00
build_layout.mk
build_test.mk Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
common.mk
common_features.mk Extract sendstring into its own compilation unit (#12060) 2021-03-01 07:11:39 +11:00
disable_features.mk Add a <FEATURE>_SUPPORTED flag (#9058) 2021-01-30 13:08:58 -08:00
doxygen-todo
license_GPLv2.md
license_GPLv3.md
license_Modified_BSD.md
message.mk Configure keyboard matrix from info.json (#10817) 2020-12-30 10:27:37 -08:00
nose2.cfg
readme.md 2021 February 27 Breaking Changes Changelog (#11975) 2021-02-27 12:10:23 -08:00
requirements-dev.txt Remove `wave` from requirements-dev.txt (#12387) 2021-04-03 09:15:39 -07:00
requirements.txt Add support for tab completion (#12411) 2021-04-14 19:00:22 -07:00
secrets.tar.enc
setup.cfg Use the schema to eliminate custom code (#11108) 2021-01-09 13:34:14 -08:00
shell.nix [nix] Use niv and poetry2nix to more easily manage dependencies (#11181) 2021-04-03 08:05:46 -07:00
show_options.mk add OLED_DRIVER_ENABLE into show_options.mk (#12121) 2021-03-05 20:26:26 +00:00
testlist.mk Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00

readme.md

Quantum Mechanical Keyboard Firmware

Current Version Build Status Discord Docs Status GitHub contributors GitHub forks

This is a keyboard firmware based on the tmk_keyboard firmware with some useful features for Atmel AVR and ARM controllers, and more specifically, the OLKB product line, the ErgoDox EZ keyboard, and the Clueboard product line.

Documentation

The docs are powered by Docsify and hosted on GitHub. They are also viewable offline; see Previewing the Documentation for more details.

You can request changes by making a fork and opening a pull request, or by clicking the "Edit this page" link at the bottom of any page.

Supported Keyboards

The project also includes community support for lots of other keyboards.

Maintainers

QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, Hasu. The OLKB product firmwares are maintained by Jack Humbert, the Ergodox EZ by ZSA Technology Labs, the Clueboard by Zach White, and the Atreus by Phil Hagelberg.

Official Website

qmk.fm is the official website of QMK, where you can find links to this page, the documentation, and the keyboards supported by QMK.