Commit Graph

13 Commits

Author SHA1 Message Date
Xudong Zheng c7fdce863a fix(usb): add USB_DC_CLEAR_HALT to supported states
See https://manpages.debian.org/testing/linux-manual-4.9/usb_clear_halt.9 for
information on halted USB endpoints
2022-11-17 22:52:32 -06:00
John Drogo 6124d254f9 fix(usb): add USB_DC_RESUME to supported states
All credit for this one goes to @xudongzheng (thanks for helping debug
this!). Should fix the issue where keyboards go unresponsive after their
host machine wakes from sleep due to the USB driver entering an error
state. I was able to both reliably reproduce the issue before the patch
goes in and confirmed it no longer occurs post patch.

The `USB_DC_RESUME` state indicates the host event has resumed the connection.
Adding it to the list of valid connection states to prevent the error
when waking from sleep.

Zephyr API Link:
https://docs.zephyrproject.org/apidoc/latest/group____usb__device__controller__api.html#gac09e3e0af1a2b41a5bfbad91f900baf7

fixes #1372
2022-09-11 13:00:20 -04:00
Peter Johanson d7bd81e5c4 fix(usb): Correctly detect USB connection status.
* Fix detection of USB power vs. configuration, to ensure endpoint
  selection works properly with power-only USB attached.
2022-06-16 00:50:04 -04:00
Peter Johanson 40cd8da743 fix(usb): Split HID from core USB, logging fix.
* Split core USB init from USB HID init.
* Tweak logging to avoid "log loop" causing
  spurious buffer messages on startup.
2022-04-13 13:07:59 -04:00
Peter Johanson 9d34cf561e fix(usb): USB state changes in system thhread.
* Use a `k_work` to send usb status events from the system
  workqueue thread, not the USB work thread.
2021-08-03 00:19:05 -04:00
Pete Johanson 3fe2acc2d1 refactor(core): Extra event payloads to own types, refactor API.
* Make it easier to use *just* event payloads by defining the data,
  and then having event manager macros generate "wrapper structs"
* Improve is_*/cast_* APIs to hide details of full event struct.
* Create `zmk_event_t` typedef to pass to event handlers.
* Bring event names inline w/ consistent `zmk_` prefix.
2021-01-20 07:06:11 -05:00
innovaker 842aa5a842 refactor: replace filename hyphens with underscores
Aligns *.h and *.c to underscore naming convention.

These were kept (with warnings) for backwards compatibility with external boards/shields:
- kscan-mock.h
- matrix-transform.h
They should be removed in the future.

PR: #523
2020-12-28 01:15:35 -05:00
innovaker f7d9d52221 refactor(app): replace `void` with `const struct device *dev` in ISR CBs
See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html
PR: #467
2020-12-14 12:41:25 -05:00
innovaker 00ca0d2f1c refactor(app): replace `struct device *` with `const struct device *`
Replaced with RegExp: /(?<!const )(struct device \*)/g

See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html
PR: #467
2020-12-14 12:41:25 -05:00
innovaker bac1f17cf6 refactor(app): replace Zephyr integer types with C99 integer types
u8_t → uint8_t
u16_t → uint16_t
u32_t → uint32_t
u64_t → uint64_t
s8_t → int8_t
s16_t → int16_t
s32_t → int32_t
s64_t → int64_t

Prerequisite for #223
See: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.4.0
PR: #467
2020-12-14 12:41:25 -05:00
Pete Johanson 32e7159373 refactor(hid): Mod defines in dedicated header. 2020-11-03 00:21:20 -05:00
Joel Spadin 1d369ffa73 feat: only send HID reports to one endpoint
Added some utility functions and an event for tracking the state of the
USB connection.

Updated endpoints.c to select a single endpoint to send HID reports to
based on the status of the USB and BLE connections. Partially fixes #206.

Future commits will add a user setting to control which endpoint is used if
both USB and BLE are ready.
2020-10-28 18:15:05 -05:00
Pete Johanson bbf5a5905a refactor(usb): Report USB status w/o HID output. 2020-10-04 21:56:09 -04:00
Renamed from app/src/usb_hid.c (Browse further)