Numpad alt codes?

Yes, it’s them.

2 Likes

I’ve done a little investigation into finding a way to set up a communication channel within the firmware between the keyboard and numpad. In my case, my primary goal would be to sync the backlights, but it should also be possible to cause the numpad to echo certain modifier keys (or more likely route all of its generated keycodes through the main keyboard to inherit its modifier state).

The best mechanism I’ve come up with so far (theory only) would be to use the OS synchronization of one or more keyboard status lights (Caps Lock, Num Lock, Scroll Lock, ?Kana?, ?Compose?, etc. ) to pass “messages” between the separate USB devices.

This isn’t exactly a “solved” problem, but there’s some work out there on it. My research on it was centered around the Ploopy Nano trackball, which doesn’t have any buttons. There’s an example of very basic communication with the scoll lock in the QMK repo. If you want to get more involved (particularly if you want the communication flow in both directions), there’s some code here that might be a good starting point.

The most basic way of doing it would seem to be to turn on scroll lock when the keyboard alt key is held down, and turn if off when released. The numpad firmware would just watch for scroll lock events to hold and release a virtual alt key. That would probably have the least lag, but it would rely on scroll lock not actually being used otherwise. Anything else requires “flashing” one of the keys (changing state twice in a row), which would add some lag.

Maybe here. Some replies suggest other setups to type the characters on MSWindows.
https://www.reddit.com/r/framework/comments/1aif095/framework_16_numpad_alt_codes/

Is there a way to implement a num-lock for a numeric overlay on the main keyboard? I’ve had laptops with a numlock key but no numberpad. With the numlock enabled, the keys are mapped so
7→7, 8→8, 9→9;
u→4, i→5, o→6;
j→1, k→2, l→3;
m→0, .→.
and a few others for arithmetic operators.

Sure!
May I introduce you, my friend, to QMK layers!

You actually already know layers. Shift or capslock is a type of layer. So is Fn and FnLock on laptops. You could put numpad keys on the Fn layer, or you could create a seperate layer. Either would be done point-and-click by going to https://keyboard.frame.work/ on your FW16 in Chrome or another Chromium-based browser (like Edge).

Here it is on the Fn layer. Of course, you can place the keys how ever you wish, or put it on a different layer. Note that for alt-code use you’ll want to use numpad numbers, not normal numbers, they are different. Select “Any” key (bottom right, in orange) then enter KC_P1, KC_P2, etc.

If there is anyone with the Numpad and the ANSI keyboard that wants to try a custom solution, with the caveat that it is completely untested (I don’t have my 16 yet, and I’m not even ordering a numpad right now), I’ve thrown together a quick “altsync” branch of the Framework QMK firmware here:

It uses numlock and capslock to communicate the state of the alt keys on the main keyboard. There may be timing issues, so I’ve turned on console logging which can be watched with the QMK toolbox.

If you want to try it out with pre-compiled firmware, you can get the two files here (link expires in 2 months). I could also generate it for other keyboard types if desired. That said, anyone who wants to try this should be comfortable with replacing the firmware, as I’m not even sure where to get the default firmware image or how to update it myself yet!

3 Likes

I dont know if you can edit the post to this degree, but maybe you should change this to a feature request and request they change the firmware that reads their input to instead treat them as one, it should be possible, and might even be doable by a user with qmk firmware, but that i wont know until i get mine in batch 6

Official Framework complied firmware is here Releases · FrameworkComputer/qmk_firmware · GitHub Looks like they even made little window’s .exe apps to do the flashing. I’m presuming so that people don’t have to manually put their keyboards into bootloader mode.

To get into bootloader mode manually (such as to flash Ionitor’s firmware) you have 3 options:

  • On Framework Laptop 16 Keyboard: Hold down left ALT and right ALT while
    installing the module
  • On Framework Laptop 16 Numpad: Hold down keys for 2 and 6 while installing the
    module
  • Bootmagic reset: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
  • Keycode in layout: Press the key mapped to QK_BOOT if it is available

When you do this, your keyboard will appear as a flash drive. You just drag-and-drop the approprate .uf2 file over to it. For example, framework_ansi_default_v0.2.9.uf2 for the ANSI keyboard. The keyboard will start running with the new firmware automatically.

2 Likes

One thing to check… in the USB HID IF spec, a keypad key is distinct from a keyboard key. If the QMK firmware is sending keyboard keys to the host, it wouldn’t work even with an ALT key on the keypad.

I took a quick glance at the QMK repo in the firmware github, but it wasn’t immediately obvious to me what the config is… but it’s something that could be looked at.

It sends proper keypad numbers

    [_NUMLOCK] = LAYOUT(
        KC_ESC,  KC_CALC, KC_EQL,  KC_BSPC,
        KC_NUM,  KC_PSLS, KC_PAST, KC_PMNS,
        KC_P7,   KC_P8,   KC_P9,
        KC_P4,   KC_P5,   KC_P6,   KC_PPLS,
        KC_P1,   KC_P2,   KC_P3,
            KC_P0,        KC_PDOT, KC_PENT
    ),

KC_P# are codes for keypad numbers in QMK.

1 Like

Rats… so there’s also generic desktop page that has different usage IDs for keyboard (0x06) vs. keypad (0x07) collections… so the USB data would possibly need to specify that with the mapping collection. Possibly Windows only works across the different types if the one is a keypad collection?

Not familiar with QMK, but I notice that none of the descriptors in tmk_core/protocol/usb_descriptor.c will use HID_RI_USAGE(8, 0x07)… if that’s where the descriptor comes from, possibly hacking that file to use 0x07 instead of 0x06 for the numpad would do the trick?

I’m batch 8, so it’ll be a while before I can play with this stuff.

1 Like

This is actually quite upsetting to me. Probably about 50% of the reason for taking a 16 over a 13 for me was to get a numpad, and I absolutely take for granted that a numpad will perform alt codes which I use regularly. I will not be happy with any solution other than holding an actual keyboard alt key and entering numbers on the numpad. I hope one of you clever folks much more educated in this stuff finds a solution. I’m confident I can implement anything, but I have had very limited interactions with firmware.

Honestly, same for me. I bought a numpad expecting to perform… As a regular numpad. When my Batch 15 arrives I’ll start thinkering around with the firmware, and of course I’ll try to keep this thread as active and visible as possible.

Hmmm… This is quite concerning, as I do frequently use Alt codes for non-standard characters. I hope there’s a way this could be fixed so that Alt+numpad works as you’d normally expect it to…

If not, there is a possible alternate option… I have a smaller laptop used for work provided by my employer. As the built-in keyboard doesn’t have a numpad, I use a USB connected one.

Despite the numpad being a separate device, I can still use Alt codes on it by holding Fn+Alt+numpad. Can you see if that’ll work on the Framework keyboard+numpad?

3 Likes

I’m curious, what do you actually need them for?
Do you write so many different unique symbols and are you able to keep all of the numbers in your head, or is there another way to use this?

Otherwise I’d really recommend looking into custom keyboard layers, that’s how I live and I love it.

1 Like

I’m a software dev, and my native language is not English, so for example my muscle memory for the { } brackets is ALT+123. It is actually the sole reason i got a numpad…

3 Likes

Same - but most programming languages sadly have been developed with the US keyboard as reference, hence all special chars used and place on the US keyboard.
That is also the reason I use a International English keyboard, to not having to use these workarounds.

2 Likes

I’m sorry, lol.
You should 100% look into layers, that’s a waayyy better solution for your problem.
Then you won’t need the numpad either, which means you can center the keyboard.
It must be really tedious to write the brackets with the numpad all the time…

3 Likes

Not really! The alternative for me was AlrGR+Shift+ [ or ], and it’s been 9 years, so my left hand just got used to the numpad :slight_smile:
I’ll check layers, never used QMK but looks very interesting to thinker and customize.
…I’ll have to look for other uses for the numpad as well!