-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Is it okay to implement keystroke record / playback? #26
Comments
That might constitute scope creep, but it's an interesting idea. Of course the ultimate evolution of this would be to display icons on an attached touchscreen (totally not biased about which one we might choose) and enable a kind-of Stream Deck style macro system. Heck even Keybow could be attached to the Pi 400s GPIO and supply some additional dedicated macro keys. I think it's better implemented not directly in pi400kb but as a way of getting input data in/out of pi400kb to process elsewhere. Like a pipe for key events? The biggest single issue with any overloaded functionality is how we pick a shortcut key combo that takes you out of regular keyboard mode into macro mode. Otherwise all your input goes both ways and weird things will happen. There's an open issue - #27 - requesting a change of grab/release shortcut, so perhaps the first step on this road is to figure out:
Then we can say, perhaps, that in "macro" mode key events get sent to another service (written in C, Python, whatever) for processing and recording. Keep this codebase clean but extensible. I'm mostly rambling here but the TLDR is:
Sheesh even my TLDR is long. |
Some points: I predict there will be demand for QMK/ZMK-style macros (e.g. keyboard layers, double-tap keys, etc), and maybe even for hooking up an HDMI capture card and responding to the main computer's on-screen events with macros. For what it's worth, my raison d'etre for being interested in this project is because my employer doesn't allow any software to be installed. Normally I would use AutoHotkey/AutoIt to accomplish my automation tasks, but my employer's restrictions demand that automation has to be done outside the main computer. (right now, I'm not interested in implementing much beyond just record/playback macros, but I can see people being interested in more) The LOC to implement a module system would be just as much to implement a record/playback system. I'm working on the record/playback now, and I don't think it takes much to implement it. If someone else wanted to implement an extension system, I'd be willing to implement my change around it. I don't know that I'd implement an extension system myself though -- I've never implemented one, and am unsure about some of the implementation details. My conclusion is that maybe it's easier for me to just maintain a fork alongside yours. I don't know, that's not the most preferable solution either, but maybe it is what it is. (Also, it might be possible that someone wants to re-implement this in Python, which would make macros and the HDMI capture card much easier. This is another reason I don't think that spending time on an extension system here would be useful.) |
The implementation is basically complete. This is the code. *shrug* If you'd rather not integrate it into the main project, I can maintain it as a parallel fork. |
That's a lot more lightweight a macro setup than I was envisioning. I think the problem with bringing that upstream is twofold:
P.S. - For disambiguating the keyboard input, there's a complete reference map of HID scancodes to input event codes here you could probably borrow: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-input.c#L27-L44 And then TLDR: Keep the fork. It's okay to have different goals! |
input-event-codes.h's values are different from the USB HID values. For instance, input-event-codes.h defines escape as 0x01, but in USB HID it's 0x29.
It's a dumb pipe running on a very capable computer. |
Yup that's why I linked the HID scancode to input code lookup here - https://github.com/torvalds/linux/blob/master/drivers/hid/hid-input.c#L27-L44 The raw scancodes don't correspond to any particular letter (it varies depending upon region), so storing constants for them is a recipe for angry Belgians. |
Ahh, I see. Thanks for the info. |
Still this opens nice options of turning the pi into a inconspicuous HID-keyboard masked rubber ducky, not only grabbing real keyboard input, but sending prerecorded commands to the connected system as well f.i. X minutes after connection (or maybe even using Wi-Fi to do it live?). |
It would be nice to have complex macros like the QMK / ZMK keyboard firmware, but I'm not ready to implement that. But I'm definitely interested in keystroke recording/playback, as a primitive macro system. Would that be welcomed as part of this project?
The text was updated successfully, but these errors were encountered: