Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to old init order for host driver #15029

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions quantum/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@
void platform_setup(void);

void protocol_setup(void);
void protocol_init(void);
void protocol_pre_init(void);
void protocol_post_init(void);
void protocol_pre_task(void);
void protocol_post_task(void);

// Bodge as refactoring vusb sucks....
// Bodge as refactoring this area sucks....
void protocol_init(void) __attribute__((weak));
void protocol_init(void) {
protocol_pre_init();

keyboard_init();

protocol_post_init();
}

void protocol_task(void) __attribute__((weak));
void protocol_task(void) {
protocol_pre_task();
Expand All @@ -44,7 +54,6 @@ int main(void) {
keyboard_setup();

protocol_init();
keyboard_init();

/* Main loop */
while (true) {
Expand Down
6 changes: 3 additions & 3 deletions tmk_core/protocol/chibios/chibios.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void protocol_setup(void) {
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
}

void protocol_init(void) {
void protocol_pre_init(void) {
/* Init USB */
usb_event_queue_init();
init_usb_driver(&USB_DRIVER);
Expand Down Expand Up @@ -173,10 +173,10 @@ void protocol_init(void) {
wait_ms(50);

print("USB configured.\n");

host_set_driver(driver);
}

void protocol_post_init(void) { host_set_driver(driver); }

void protocol_pre_task(void) {
usb_event_queue_task();

Expand Down
6 changes: 3 additions & 3 deletions tmk_core/protocol/lufa/lufa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ void protocol_setup(void) {
usb_device_state_init();
}

void protocol_init(void) {
void protocol_pre_init(void) {
setup_usb();
sei();

Expand All @@ -1094,10 +1094,10 @@ void protocol_init(void) {
#else
USB_USBTask();
#endif

host_set_driver(&lufa_driver);
}

void protocol_post_init(void) { host_set_driver(&lufa_driver); }

void protocol_pre_task(void) {
#if !defined(NO_USB_STARTUP_CHECK)
if (USB_DeviceState == DEVICE_STATE_Suspended) {
Expand Down
5 changes: 3 additions & 2 deletions tmk_core/protocol/vusb/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ void protocol_setup(void) {
#endif
}

void protocol_init(void) {
void protocol_pre_init(void) {
setup_usb();
sei();
}

void protocol_post_init(void) {
host_set_driver(vusb_driver());

wait_ms(50);
}

Expand Down