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

Addition of Numpad Keybindings in js_badusb.c #30

Closed
oldip opened this issue Mar 13, 2024 · 2 comments
Closed

Addition of Numpad Keybindings in js_badusb.c #30

oldip opened this issue Mar 13, 2024 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@oldip
Copy link
Contributor

oldip commented Mar 13, 2024

Description of the feature you're suggesting.

I'm suggesting the addition of Numpad keybindings in the js_badusb.c file to enhance the functionality of the firmware. Currently, there are issues with input methods that are not US when using the script. By adding Numpad keybindings, users can utilize combinations like ALT+Numpad to input text, thereby overcoming these issues.

What It Should Do:
The suggested modification involves adding the following lines to js_badusb.c:

{"NUMPAD_0", HID_KEYPAD_0},
{"NUMPAD_1", HID_KEYPAD_1},
{"NUMPAD_2", HID_KEYPAD_2},
{"NUMPAD_3", HID_KEYPAD_3},
...

This addition will enable users to employ ALT+Numpad combinations in their scripts, such as the following JavaScript function:

function sendStringViaAltNumpad(str) {
    for (let i = 0; i < str.length; i++) {
        let asciiCode = str.charCodeAt(i);
        badusb.hold("ALT");
        asciiCode.toString().split('').forEach(digit => {
            badusb.press(`NUMPAD_${digit}`);
            delay(10); // Slight delay to ensure keyboard events are processed correctly
        });
        badusb.release("ALT");
        delay(10); // Slight delay to ensure keyboard events are processed correctly
    }
    badusb.press("ENTER"); // Finally, press ENTER key to simulate the behavior of println
}

Note:
This feature request aims to extend the existing functionality of the firmware by incorporating Numpad keybindings. It addresses the issue of non-US input methods when using the script, offering users greater flexibility in text input.

Anything else?

As a beginner, I'm unsure about the process of converting the .c format to .fal. Any guidance on this would be appreciated.

Thank you for considering this feature request.

@oldip

@Willy-JL Willy-JL added feature New feature or request release-pending This is done, will be in next release labels Mar 19, 2024
@oldip oldip closed this as completed Mar 19, 2024
@Willy-JL
Copy link
Member

I'll keep this open since it's not in a release yet 😄

@Willy-JL
Copy link
Member

Was released in mntm-002

@Willy-JL Willy-JL removed the release-pending This is done, will be in next release label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants