Commit Graph

127 Commits (7d6afc90b14d89d2616f4ffc3241d52c1fac777f)

Author SHA1 Message Date
Stefan Kerkmann 8253697a63
[FIX] ChibiOS: USB Digitizer and Joystick IN endpoint compilation (#23854)
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-06-03 22:35:46 +10:00
Joel Challis 16cca527a6
Fix WAIT_FOR_USB handling (#23598) 2024-04-24 19:33:52 +01:00
Robin Carlier 42a725e355
Remove midi_ep_task from ChibiOS (#23162)
Co-authored-by: Joel Challis <git@zvecr.com>
2024-03-28 20:40:41 -07:00
Joel Challis 63dd131d81
Refactor vusb to protocol use pre/post task (#14944) 2024-03-14 21:45:12 +11:00
Stefan Kerkmann 0e02b0c41e
[Core] Refactor ChibiOS USB endpoints to be fully async (#21656) 2024-02-28 22:00:27 +11:00
Joel Challis b6b3efc14b
Remove console out endpoint (#22304) 2024-01-09 14:01:34 +00:00
Stefan Kerkmann 5856d5e13b
[Maintenance] USB HID control packet as struct (#21688)
* ChibiOS: USB HID control request as dedicated struct

Instead of accessing the raw USB setup packet and documenting the values
as the corresponding USB HID control request fields we introduce a
struct that allows direct access to the fields. This is safer and self
documenting.

* Rename usb_request.h to usb_types.h

In the future all shared USB data types can live in this file.
2023-10-27 18:44:58 +02:00
Ryan 0c160e1fba
Separate 6KRO and NKRO report structs (#22267) 2023-10-23 15:43:46 +11:00
Drashna Jaelre 25331be316
Revert changes to ChibiOS Suspend Code (#21830)
* Partially revert #19780

* Finish

* Get teensy 3.5/3.6 board files too

* fix lint issue

* Revert "[Bug] Restore usb suspend wakeup delay (#21676)"

This reverts commit e8e989fd7a.

* Apply suggestions from code review

Co-authored-by: Joel Challis <git@zvecr.com>

---------

Co-authored-by: Joel Challis <git@zvecr.com>
2023-08-27 03:52:12 +01:00
Stefan Kerkmann e8e989fd7a
[Bug] Restore usb suspend wakeup delay (#21676)
* Respect USB_SUSPEND_WAKEUP_DELAY on wakeup

This delay wasn't honored after removing `restart_usb_driver` from the
suspend and wakeup handling. It is now re-introduced in the appropriate
spot, namely after issuing a remote wakeup to a sleeping host.

* Remove old, unused and commented testing code
2023-08-02 23:42:57 +01:00
Stefan Kerkmann a87c74ebe1
[Bug] Fix non-functional S3 wakeup / resume from suspense (#19780)
* Update ChibiOS-Contrib for USB suspend fixes

* Remove S3 wakup workaround

ChibiOS OTGv1 driver has a remote wakeup bug that prevents the device to
resume it's operation. 02516cbc24647f522eee975e69cc0c8a925470eb 
introduced a hotfix that forcefully restarted the usb driver as a workaround. 
This workaround broke multiple boards which do not use this driver / 
peripheral. With the update of ChibiOS this hotfix is now obsolete.

* Remove restart_usb_driver overrides

they are no longer necessary as the workaround is not needed anymore
for stm32f4

* Remove unused RP_USB_USE_SOF_INTR defines

The SOF interrupt is enabled dynamically by the RP2040 usb driver
2023-06-26 23:55:52 +02:00
Purdea Andrei 3ebdb1258b
Chibios USB: Take into account if host wants remote wakeup or not (#21287)
According to the USB 2.0 spec, remote wakeup should be disabled by
default, and should only be enabled if the host explicitly requests
it. The chibios driver code already takes care of storing this
information, and returning it on GET_STATUS requests. However our
application code has been ignoring it so far.

This is a USB compliance issue, but also a bug that causes trouble
in some cases: On RP2040 targets this has been causing problems if
a key is held down while the keyboard is plugged in. The keyboard
would fail to enumerate until all keys are released. With this
change that behavior is fixed.

Note that for LUFA targets this is already done correctly.
2023-06-26 10:36:32 +02:00
Ryan aad5746682
Move protocol makefiles into their respective folders (#21332)
* Move protocol makefiles into their respective folders

* Fix USB-USB converter
2023-06-22 15:07:28 +01:00
Ryan 7acc3f4449
ChibiOS: Consolidate report sending code (#19607) 2023-01-16 17:54:26 -08:00
Sergey Vlasov 955829bfd0
Fix joystick build for ChibiOS (#19602)
`joystick_report_t` was renamed to `report_joystick_t`, but apparently
one place in the code was missed.
2023-01-15 23:29:29 +00:00
Ryan a92071494a
usb_main.c: remove `CH_KERNEL_MAJOR` check (#19597) 2023-01-15 19:40:52 +11:00
QMK Bot 1786932d9f
[CI] Format code according to conventions (#19265) 2022-12-09 04:10:52 +11:00
Jack Humbert a23333eb58
Return USB HID GET_REPORT requests (#14814)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2022-12-09 04:08:36 +11:00
Ruslan Sayfutdinov 85ee55ff3b
Detect host OS based on USB fingerprint (#18463)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2022-12-09 03:45:30 +11:00
lokher 0d7edbbcbe
Fixed NKRO issue caused by HID_SET_PROTOCOL on Chibios platform (#17588) 2022-12-09 02:56:36 +11:00
Ryan 1e95f7be8f
Joystick feature improvements (#19052) 2022-11-27 03:14:45 +11:00
Sergey Vlasov 1ea54e5052
ChibiOS USB: Add a dummy IN callback to work around LLD bugs (#18811)
In #18631 some IN notification callbacks that were doing nothing were
removed, which should be a valid thing to do (ChibiOS HAL checks the
`in_cb` and `out_cb` pointers for being non-NULL before invoking those
optional callbacks).  However, it turned out that some less popular USB
LLDs (KINETIS and MIMXRT1062) have their own checks for those pointers,
and (incorrectly) skip the ChibiOS callback handling when those pointers
are NULL, which breaks the code for the `USB_USE_WAIT` configuration
option (the waiting thread never gets resumed if the corresponding
callback pointer is NULL).

Add those dummy callbacks again (but use a single function for all of
them instead of individual ones for each endpoint); this restores the
KINETIS and MIMXRT1062 boards to the working state while the LLDs are
getting fixed.
2022-10-22 18:16:09 +01:00
Nick Brassel f99b9ba270
Widen the ARM Cortex-M family support. Allow USB peripheral change. (#18767) 2022-10-19 17:17:49 +11:00
Ryan 2078a56369
Fix joystick functionality for ChibiOS and OTG (Blackpill) (#18631)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
2022-10-13 10:28:49 +11:00
Ryan 6dbbeea46a
Refactor `send_extra` (#18615) 2022-10-06 19:35:01 -07:00
Ryan 09d3e27710
Refactor more host code (programmable button & digitizer) (#18565) 2022-10-05 09:19:12 +11:00
Stefan Kerkmann 6f13a76530
[Core] ChibiOS: Fix USB bus disconnect handling (#18566) 2022-10-02 15:35:33 +02:00
Ryan be8907d634
Further refactoring of joystick feature (#18437) 2022-09-27 18:37:13 +10:00
Ryan f76b55d5ad
Adjust `EXTRAKEY_ENABLE` ifdefs for `send_extra()` (#18249) 2022-09-02 21:50:36 +01:00
Ryan 09d668eb0e
Simplify extrakeys sending at the host driver level (#18230)
* Simplify extrakeys sending at the host driver level

* There are two arguments here

* Wrong syntax

* Adjust keyboards which use a custom host driver
2022-09-02 20:38:27 +01:00
Nick Brassel 543f54a483
[Core] `STM32_USB_USE_OTG1` => `USB_ENDPOINTS_ARE_REORDERABLE` (#17647) 2022-08-04 21:05:16 +10:00
Stefan Kerkmann d717396708
[Core] Add Raspberry Pi RP2040 support (#14877)
* Disable RESET keycode because of naming conflicts

* Add Pico SDK as submodule

* Add RP2040 build support to QMK

* Adjust USB endpoint structs for RP2040

* Add RP2040 bootloader and double-tap reset routine

* Add generic and pro micro RP2040 boards

* Add RP2040 onekey keyboard

* Add WS2812 PIO DMA enabled driver and documentation

Supports regular and open-drain output configuration. RP2040 GPIOs are
sadly not 5V tolerant, so this is a bit use-less or needs extra hardware
or you take the risk to fry your hardware.

* Adjust SIO Driver for RP2040

* Adjust I2C Driver for RP2040

* Adjust SPI Driver for RP2040

* Add PIO serial driver and documentation

* Add general RP2040 documentation

* Apply suggestions from code review

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

Co-authored-by: Nick Brassel <nick@tzarc.org>
2022-06-30 13:19:27 +02:00
Stefan Kerkmann 4d107feca9
Check for ongoing transfers on the OUT endpoint (#16974)
...when attempting to start a receiving USB transfer. Previously, we would
check on the IN endpoint which is the transmitting part of the USB endpoint.
This is wrong and lead to two USB transfers being started immediately
after each other in case of e.g. RAW HID endpoints:

1. When finishing an OUT transfer the low level USB driver calls the out_cb
callback, which in turn initiates another OUT transfer by calling
qmkusbDataReceived.

2. When the raw hid receive channel runs empty inside the raw_hid task,
another OUT transfer is started to potentially fill the channel again. This
happens by calling ibnotify.

Both events occur directly after each other, thus triggering the bug.
2022-05-14 23:17:14 +01:00
QMK Bot 97f4a75fd7
[CI] Format code according to conventions (#16914) 2022-04-22 17:48:06 +10:00
dexter93 e4942df397
Chibios USB protocol: allow overriding RAW Capacity (#16339) 2022-04-22 17:36:32 +10:00
Sascha bf67abb046
Fixed usb read loops not reading until timeout (#16827)
* the size variable was redeclared (hiding the variable of the outside scope) and therefore the while check was always false, so the compiler just removed the do while loop, but it would be better to read all data and only exit the task, after this is done
2022-04-10 00:27:02 +02:00
QMK Bot 63646e8906
Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
Thomas Weißschuh f1cd2a5a89
ChibiOS: add support for HID Programmable Buttons (#15787)
* ChibiOS: add support for HID Programmable Buttons

Fixes #15596

* Enable SHARED_ENDPOINT when PROGRAMMABLE_BUTTON is enabled

The Programmable Button driver expects the shared EP to be enabled.
So enforce this invariant.
2022-02-04 22:25:57 +00:00
Stefan Kerkmann 5470e4a8ad
[Core] ChibiOS: shorten USB disconnect state on boot to 50ms (#15805) 2022-01-10 15:01:20 -08:00
Ryan ed49dbeac4
Add missing virtser_init() to ChibiOS code (#15356) 2021-11-30 16:54:18 +11:00
Nick Brassel 5da04fb45b
Update to ChibiOS 20.3.4, support builds against trunk (#14208)
* Add support for building against ChibiOS svn/trunk.

* Swap to 21.6.x

* Update to latest branch revision as released version is broken.

* Updated configs.

* Conf updates.

* Updated ChibiOS

* Convert STM32L422 to actual L422 ChibiOS platform.

* Downgrade to 20.3.4 as ChibiOS 21.6.x is being aborted.

* Rollback L422-based boards.
2021-11-03 08:26:40 +11:00
Nick Brassel 387edab52b
Fixup #15029 (#15031) 2021-11-02 19:54:16 +00:00
Joel Challis 634e42b2b4
Revert to old init order for host driver (#15029)
* Partially revert 14888
2021-11-02 18:53:46 +00:00
Joel Challis 2ec268bd21
Begin to carve out platform/protocol API - Migrate keyboard_* calls (#14888) 2021-10-24 20:39:41 +01:00
QMK Bot 3b04425f1a Merge remote-tracking branch 'origin/master' into develop 2021-10-23 04:04:47 +00:00
Dasky 1953a968c5
Check usb transmit status in send_extra() (#14643) 2021-10-23 15:04:15 +11:00
Joel Challis 1c0347b8b8
Remove SERIAL_LINK feature (#14727)
* Remove SERIAL_LINK

* more stale paths in doxygen-todo

* Fix

* More refs

* Update testing docs

* Update doxygen-todo

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2021-10-07 12:32:05 +11:00
Nick Brassel b2a186cf92
Purge uGFX. (#14720)
* Purge uGFX.

* Remove remnants of visualizer.

* Remove remnants of uGFX.
2021-10-07 10:57:48 +11:00
Purdea Andrei b02a539625
Added power tracking api (#12691)
* Add power tracking API to lufa and chibios targets

* power.c: Pass through power state to the notify function

* power: added notify_power_state_change_user too.

* making it pass the PR linter

* Add a POWER_STATE_NO_INIT state, that we start in before calling power_init();

* Rename *power* to *usb_power*

* removing stray newline

* Rename usb_power* to usb_device_state*

* Update quantum/usb_device_state.h

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Fix comment

* usb_device_state.h: Don't include quantum.h, only the necessary headers.

Co-authored-by: Drashna Jaelre <drashna@live.com>
2021-09-30 06:31:39 +10:00
Joel Challis 96e2b13d1d
Begin to carve out platform/protocol API - Single main loop (#13843)
* Begin to carve out platform/protocol API

* Fix up after rebase
2021-08-18 00:11:07 +01:00