-
-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
Add support for WebUSB #7778
Add support for WebUSB #7778
Conversation
great, this made online qmk configurator possible :) |
@yulei ZSA (ergodox ez, planck ez) are already using WebUSB for the "live training" feature. In fact, this is basically just backporting that code. |
Could this webusb implementation work under mac? I tested an implementation from the LUFA pr before, but they failed work under MAC OS. |
Works on MacOS, Windows, and Linux. including the "open link" popup. But it does require Chrome or a chrome based browser. |
bba1ea6
to
4e66e94
Compare
@drashna @noroadsleft Just wondering if we plan to merge this in? Thanks! |
@wiserfirst My understanding is that ZSA (makers of the ErgoDox EZ and Planck EZ) is still working on this, hence this PR being in Draft status. I would expect this to be merged when the underlying pieces are in place. So basically: "When it's done." |
It's complicated. This PR requires a change to the LUFA module first. Which hasn't happened. Without that change, this PR will fail (right now, it's pointing at the ZSA LUFA module, which is the ONLY reason it works). Additionally, we (ZSA) haven't had a chance to really test this out yet. The WebUSB part works, but the rest of it isn't tested, and we'd rather have that finished before this gets merged. That said, once things are finalized on our side, yes, we plan on finishing up this PR and getting this merged. Until then, we'd rather it remain as a draft. |
@drashna awesome. Thanks for the detailed explanation!
Can I assume that the zsa fork (https://github.com/zsa/qmk_firmware) would support WebUSB? Thanks! |
Sorry, I meant to respond sooner!
Yes, it does. And ZSA is using it for the live training mode, actively. And I just added a PR to QMK so that it doesn't have the compile errors when using a keymap for Oryx. |
550bb6a
to
9d827f9
Compare
1d4c0cd
to
65c27a3
Compare
a1b96ba
to
3430907
Compare
quantum/oryx.c
Outdated
uint8_t i; | ||
dynamic_keymap_get_buffer(offset, size, ¶m[3]); | ||
event[0] = WEBUSB_STATUS_OK; | ||
event[1] = ORYX_EVT_LIVE_UPDATE_GET_BUFFER; | ||
for (i = 0; i < size; i++) { | ||
event[i+2] = param[i]; | ||
} | ||
event[i+2] = WEBUSB_STOP_BIT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use:
uint8_t i; | |
dynamic_keymap_get_buffer(offset, size, ¶m[3]); | |
event[0] = WEBUSB_STATUS_OK; | |
event[1] = ORYX_EVT_LIVE_UPDATE_GET_BUFFER; | |
for (i = 0; i < size; i++) { | |
event[i+2] = param[i]; | |
} | |
event[i+2] = WEBUSB_STOP_BIT; | |
dynamic_keymap_get_buffer(offset, size, &event[2]); | |
event[0] = WEBUSB_STATUS_OK; | |
event[1] = ORYX_EVT_LIVE_UPDATE_GET_BUFFER; | |
event[size+2] = WEBUSB_STOP_BIT; |
? The buffer is already allocated. Also, I think there is a bug in the loop of copying things back.
change to merged branch later
fix: MS OS 2.0 Property value fix: run webusb task on chibios feat: adds pairing key chore: change manufacturer name to ZSA feat: webusb keymap examples fix: adds webusb include on test keymaps feat: update examples + pairing process fix: adds webusb include on test keymaps feat: add landing page url command chore: unused var cleanup chore: refactor webusb lp url command feat: add fw version webusb cmd fix: lufa handle disconnections gracefully chore: renaming of the get version cmds fix: only change usb vesion spec if webusb is enabled fix: chibios handle disconnections gracefully feat: add get layer command fix: remove conditional macro wrapping WEBUSB_PAIR move webusb include to quantum.h Fix merge conflict
Move webusb.h includes to quantum.h (qmk#244) Co-authored-by: Florian Didron <[email protected]> Start moving code out of webusb and to Oryx feature fix type in usb_main for chibiOS Make Dynamic Keymaps more friendly for non-VIA implementations Conflicts: quantum/dynamic_keymap.c It looks like you may be committing a cherry-pick. If this is not correct, please remove the file .git/CHERRY_PICK_HEAD and try again. Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. Add toggle for live training Add Oryx keymap, etc Add Dynamic Keymap and other webUSB commands Implement core communication Add EEPROM reset functionality Limit number of layers due to eeprom size contstraints Disable live training if other webusb commands are sent Make Dynamic Keymaps optional for Oryx Add Oryx Keymap with dynamic keymaps enabled Move webusb pairing key back into quantum Add firmware ID check Cleanup magic number and functions Cleanup oryx init check Fix function call feat: disable webusb popup by default Fix Live Training bug Forget to check if the firmware is actually paired fix: remove oryx live training boolean assignment Enable Oryx Configurator on Ergodox EZ keymap Fix Dynamic Keymaps includes to be sane
Honestly, I think that the direction that QMK is going with is webHID, which uses the raw HID endpoint. As such, I'm not sure how much use this has, and maintaining this isn't worth it. |
@drashna can you clarify, what this means for the live training support? You have previously implied that you were planning to backport webUSB and live training stuff to qmk. Now that WebUSB is apparently being abandoned, what are your plans regarding this in the future? |
Likely, a pivot to webHID. WebHID uses the raw HID endpoint via the web browser. Chrome added support for webHID 2 or so years ago, and it is supported by any chromium based browser. This would be a better way to go, as it would work with raw HID enabled apps like VIA, but also for online based apps (such as Remapper. And QMK XAP is planning on using raw HID, and we'd like to support that. |
Ah, okay, thank you for the quick answer. Last question. Just to clarify, will the zsa fork and the configure.zsa.io/train live training app also eventually move to webHID? |
I can't say for sure, but I believe that's the goal long term. Especially when QMK XAP is finalized. |
Description
This adds the WebUSB feature to QMK Firmware (for LUFA and ChibiOS, at least).
This requires qmk/lufa#8 to be merged (or to use the web_usb)
Types of Changes
Checklist