Commit graph

309 commits

Author SHA1 Message Date
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-actions[bot]
7daa2e210c
Format code according to conventions (#12540)
Co-authored-by: QMK Bot <hello@qmk.fm>
2021-04-10 17:34:26 +01:00
Michael Stapelberg
7d953332e0
ChibiOS USB driver: prevent deadlock with CONSOLE_ENABLE = yes (#12472)
Before this commit, attaching an ARM-based (i.e. ChibiOS-based) keyboard that
uses CONSOLE_ENABLE = yes and produces debug messages would deadlock the
keyboard unless one was running hid_listen.

With this commit, dead-locking writes to the queue are detected and prevented.

fixes #5631
2021-04-10 16:03:38 +01:00
Ryan
eae7343741
Move API_SYSEX_MAX_SIZE out of config_common.h (#12302) 2021-03-25 22:30:42 +11:00
github-actions[bot]
9807225f90
[CI] Format code according to conventions (#12277)
Co-authored-by: QMK Bot <hello@qmk.fm>
2021-03-18 12:28:50 +11:00
Ryan
9331c22620
XT converter cleanup (#12264) 2021-03-18 11:48:09 +11:00
github-actions[bot]
deaabff752
Format code according to conventions (#12046)
Co-authored-by: QMK Bot <hello@qmk.fm>
2021-02-27 22:35:41 +00:00
Nick Brassel
6623744172
Fix build for attiny85-based boards. (#12044) 2021-02-28 09:33:33 +11:00
github-actions[bot]
d99e330548
Format code according to conventions (#12024)
Co-authored-by: QMK Bot <hello@qmk.fm>
2021-02-26 17:47:22 +11:00
Nick Brassel
abe189377c
[BUG] Massdrop develop rgb fix (#12022)
* Allow for disabling RGB_MATRIX on Massdrop boards.

* Fixup init sequence.

* Make some functions static as they've got very generic names.
2021-02-26 17:07:05 +11:00
fauxpark
23fd1aee00 Merge remote-tracking branch 'upstream/master' into develop 2021-02-25 16:04:53 +11:00
Ryan
39694d5eb0
V-USB suspend refactor (#11891) 2021-02-25 15:54:25 +11:00
Ryan
7ab9f6a101
Output selection: Remove "USB and BT" option (#11940) 2021-02-20 18:11:02 +11:00
github-actions[bot]
c27a778281
Format code according to conventions (#11905)
Co-authored-by: QMK Bot <hello@qmk.fm>
2021-02-15 06:55:43 +11:00
Joel Challis
1f2fe2eab9
Refactor platform logic within print.h (#11863)
* Remove GCC check from debug

* Remove platform logic from common.mk

* Refactor platform logic within print.h

* restore debug.c format

* headers

* Rename function pointer type

* review comments

* Update tmk_core/common/printf.c

Co-authored-by: Nick Brassel <nick@tzarc.org>

* Format

Co-authored-by: Nick Brassel <nick@tzarc.org>
2021-02-14 01:44:22 +00:00
QMK Bot
3a98bd75c8 Merge remote-tracking branch 'origin/master' into develop 2021-02-07 23:16:47 +00:00
Joel Challis
99bffc2a21
Migrate some tmk_core files to quantum (#11791)
* Migrate some tmk_core files to quantum

* Fix build errors
2021-02-07 23:16:15 +00:00
Joel Challis
f5a38b95c1
Remove legacy print backward compatiblitly (#11805)
* Remove legacy print backward compatiblitly

* Remove legacy print backward compatiblitly - core

* revert comment changes
2021-02-06 16:56:13 +00:00
QMK Bot
a1ddba6bc4 Merge remote-tracking branch 'origin/master' into develop 2021-02-06 14:16:03 +00:00
Ryan
9b874d5071
Manual formatting fix for serial_uart.c (#11806) 2021-02-06 14:15:30 +00:00
QMK Bot
843643aef3 Merge remote-tracking branch 'origin/master' into develop 2021-02-05 22:21:23 +00:00
Ryan
5ea92a9c1c
Serial refactor (#11521) 2021-02-06 09:20:48 +11:00
Joshua Diamond
9a4618b05b
Address wake from sleep instability (#11450)
* resolve race condition between suspend and wake in LUFA

* avoid multiple calls to suspend_power_down() / suspend_wakeup_init()

* Remove duplicate suspend_power_down_kb() call

* pause on wakeup to wait for USB state to settle

* need the repeated suspend_power_down() (that's where the sleep is)

* more efficient implementation

* fine tune the pause after sending wakeup

* speculative chibios version of pause-after-wake

* make wakeup delay configurable, and adjust value

* better location for wakeup delay
2021-02-02 11:12:41 +11:00
Nick Brassel
db11a2a1fd
Decouple USB events from the USB interrupt handler. (#10437) 2021-02-01 08:19:00 +11:00
Drashna Jaelre
99f3df2893
Add support for 8 buttons to mouse report (#10807)
* Add support for 8 buttons to mouse report

This includes support for 8 buttons in mousekeys.  However, this does move the keys around due to the fact that the last mousekey keycode is already 0xFF, so any past that would not work with register_code and the like, breaking them for tap hold keys, encoders, and other features.

* Update mouse key docs

* Add changes based on feedback

* Fix VUSB report size comment

Because drashna red gud

* Fix typo in action.c

* Fix IS_MOUSE_BUTTON check

* Change start range for mousekeys so that the end is 0xFF properly

* condense mousekeys check
2021-01-28 04:38:34 +11:00
Gentoli
28b1c913b4
Remove duplicated housekeeping in arm_atsam (#11672) 2021-01-24 12:55:43 +11:00
fauxpark
ca7da3866d Merge remote-tracking branch 'upstream/master' into develop 2021-01-15 18:34:12 +11:00
Ryan
84e2f1ec17
Adafruit BLE cleanups (#11556) 2021-01-15 14:32:00 +11:00
Ryan
f519a9908e
arm_atsam: temporarily lower raw HID endpoint/report size (#11554) 2021-01-15 14:11:04 +11:00
QMK Bot
3bc436988d Merge remote-tracking branch 'origin/master' into develop 2021-01-11 08:47:07 +00:00
Ryan
aa0e33eca0
Add support for shared EP on V-USB boards (#11103) 2021-01-11 19:46:30 +11:00
fauxpark
e3da93e658 Merge remote-tracking branch 'upstream/master' into develop 2021-01-01 05:09:50 +11:00
Joel Challis
a68d289fa5
Manually run formatting CI process (#11375) 2021-01-01 03:50:32 +11:00
siggie0815
1b3504e329
Update ADB impelemtation in TMK Core (#11168)
* Update ADB impelmentation in tmk_core to recent version.

Pcked from tmk_keyboard repository revision: 48d696443857512d45f9a7329e0dd0a76345860f

* Restore convenient ADB functions used in QMK port.

* Do cformat.
2020-12-29 19:18:16 -08:00
QMK Bot
99d6349978 Merge remote-tracking branch 'origin/master' into develop 2020-12-27 17:37:04 +00:00
Ryan
1b7b72c0e9
Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
QMK Bot
0b37c0dfa0 Merge remote-tracking branch 'origin/master' into develop 2020-12-26 04:56:43 +00:00
Ryan
1d1d5da43f
Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
QMK Bot
1c04608b0a Merge remote-tracking branch 'origin/master' into develop 2020-12-22 20:33:41 +00:00
Ryan
78b2f120e5
V-USB: Fix initial dropped keypress (#11263) 2020-12-23 07:33:04 +11:00
QMK Bot
c8cd2caeac Merge remote-tracking branch 'origin/master' into develop 2020-12-21 02:12:40 +00:00
Ryan
e3211e307e
Fix small typo in V-USB configuration descriptor (#11253) 2020-12-21 13:12:07 +11:00
fauxpark
7797070b37 Merge remote-tracking branch 'upstream/master' into develop 2020-12-18 02:15:28 +11:00
Ryan
6ea4b06f9f
Run cformat and dos2unix manually (#11235) 2020-12-17 14:06:30 +00:00
QMK Bot
2e0f2025bd Merge remote-tracking branch 'origin/master' into develop 2020-12-16 03:27:52 +00:00
Ryan
9366ed7282
Normalise include statements in keyboard code (#11185) 2020-12-16 14:27:23 +11:00
QMK Bot
fdfcce57e1 Merge remote-tracking branch 'origin/master' into develop 2020-12-11 02:46:19 +00:00
Ryan
501f2fdef1
Normalise include statements in core code (#11153)
* Normalise include statements in core code

* Missed one
2020-12-11 13:45:24 +11:00
Jesper Jensen
63d06655e6
gcc 10 compatibility for Drop alt (#9485)
* Split dmac_desc declaration and definition

According to the official documentation[1] gcc 10 is more strict about
correct extern usage.

I've had to move the definition of dmac_desc and dmac_desc_wb from
i2c_master.h to the corresponding .c file. This could be an issue if
anyone includes the i2c_master.h file without liking with the object
file.

[1]: https://gcc.gnu.org/gcc-10/porting_to.html

* Remove the keymap_config definition from keymaps

The keymap_config def was conflicting with the one found in
tmk_core/common/magic.c. Declaring it extern in magic.c breaks a bunch
of keyboard that rely on that declaration (like the ergodox). Instead
I've removed the one found in the keymap.c of the massdrop alt.

The same change will have to be made to other keyboards.
2020-12-06 17:24:49 +11:00
Ryan
15faffacf4
Omit serial number if not defined (#11104) 2020-12-05 21:14:19 +11:00