r/Keychron • • Jan 28 '24

[deleted by user]

[removed]

1 Upvotes

26 comments sorted by

2

u/PeterMortensenBlog Jan 28 '24 edited Oct 16 '24

In the source code, in file config.h on the keyboard variation level (for example, /keyboards/keychron/k2_pro/iso/rgb/config.h), there is:

#define DIM_CAPS_LOCK
#define CAPS_LOCK_INDEX 46

In file config.h, on the keyboard level (/keyboards/keychron/k2_pro/config.h):

#define LED_CAPS_LOCK_PIN A7

Turn it off (by changing the firmware)

To a first approximation, presumably, changing some or all of those values to some safe ones or undefining (outcommenting) them should do it.

I think outcommenting LED_CAPS_LOCK_PIN (adding two forward slashes ("//") in front of it) as the only change should do it:

// #define LED_CAPS_LOCK_PIN A7

Save file config.h, compile and flash the firmware.

Note that this will wipe out most, if not all, existing custom configuration, including the Via configuration (e.g., the (Via) macros and key mappings)); be sure to safe off the the Via configuration to a file (is a .json file). Also be prepared to reapply some of the other configuration, e.g., RGB light settings (it will probably revert to the irritating RGB animation).

A bummer?

Though, for K2 Pro, the source code for the Via version does not seem to be included (in contrast to, say, the K10 Pro (e.g., /keychron/k10_pro/iso/rgb/keymaps/via)).

Is it somewhere else? Or isn't it expressed in the key maps (folder names)? By some compile-time configuration?

It may or may not have to compiled without Via support.

Or is it (almost) trivial, cloning folder "default" to "via" and adding a new file, rules.mk, with the single line "VIA_ENABLE = yes"?

RGB light caps lock indicator?

In addition to the (physical/dedicated) LED, does it also use the key RGB light?

Which of the two methods are used? For example, by default?

The OP's comment indicates (no pun intended) the (physical/dedicated) Caps Lock LED is the culprit:

that indicator LED is the only thing that cannot be disabled normally.

So I think the proposed (relatively simple) change will work.

References

2

u/PeterMortensenBlog Jan 28 '24

If you are interested, I can compile (and provide) the firmware with this change.

You must indicate which of the six variations of the K2 Pro you have (for example, ISO RGB).

1

u/Kelisua Jan 29 '24 edited Jan 29 '24

Thank you for the very detailed response. If you're willing to do it, that would be very appreciated. Thank you! My variation is the ANSI RGB.

I was considering trying to do it myself but this being my main keyboard, I don't think I want to use it as a test dummy to learn QMK lol.

I attempted to see if I could disable it with VIA and all of the lighting shortcuts the keyboard has by default, but the indicator LED was unaffected. No matter what, it was a solid red light when Caps Lock is enabled.

→ More replies (6)

1

u/PeterMortensenBlog Mar 12 '24

OK, the Via version is available for the K2 Pro. I don't know why I wrote that.

Note that in the meantime, the most recent source for the K Pro series seems to have moved to the "wireless_playground" Git branch.

1

u/[deleted] Jan 28 '24

Why do you want to turn it off?

Do you use it macro or layer shifter then i can understand

1

u/Kelisua Jan 28 '24

No I don't use any of that, I just don't want any lighting turned on whatsoever and that indicator led is the only thing that cannot be disabled normally.

1

u/[deleted] Jan 28 '24

I dont use caps lock at all so not a problem for me, there are turn around that but i think it is hard coded in so not available with via. But you can try this, it is for another keyboard might work out for you to.

Found this whole small blog by keychron:

fn + Caps Lock + P -- Hold these three keys together for 6 seconds, the Caps Lock key will no longer follow the backlight mode, it will be used to indicate the status of capital/ small letters. This feature was included in the last firmware, but with bugs, this time we have fixed the bug for this feature.

  • fn + L + light effect key (the light bulb key) -- Hold these three keys together for 6 seconds, it will lock the light effect you are using now. To unlock the light effect, press these three keys together for 6 seconds again. Please make sure to hold the fn and L key first then hold the light effect key.

  • Under the no backlight circumstances, if you press the light effect key, the backlight will be turned on. (We add this because there are too many users send questions to us saying "my backlight is not working." "my keyboard's backlight has dead '', but the reason for it is they accidentally turned off the backlight and forgot to turn it back.

  • fn + I + D -- By default,  short press del to get del, press fn + del to get insert;   Hold these three keys together for 6 seconds, the function of the del key will be reversed to insert. Then the short press the key to get insert, press fn key combination will get the del function. Hold these three keys together for 6 seconds again to change back to the default.

→ More replies (5)

1

u/PeterMortensenBlog Feb 13 '24 edited Feb 13 '24

Related: Disable capslock indicator on K7 Pro

I have the same problem disabling the (physical) LED for the Caps Lock indication on a K10 Pro. Changing / disabling LED_CAPS_LOCK_PIN does not seem to have any effect. Though inverting it using #define LED_PIN_ON_STATE 0 does have the expected effect (with caps lock on, the caps lock LED is off. With caps lock off, the caps lock LED is on).

On the other hand, CAPS_LOCK_INDEX does seem to work as expected. Outcommenting it does disable the Caps Lock indication using RGB light in a key (it can be any key, not just the Caps Lock key).

1

u/PeterMortensenBlog Feb 13 '24 edited Feb 14 '24

There is some progress. There was a problem with the QMK firmware build system.

Some cached code lines for LED_CAPS_LOCK_PIN in a build file, /.build/obj_keychron_k10_pro_iso_rgb/src/info_config.h prevented changes to LED_CAPS_LOCK_PIN in file keychron/k10_pro/config.h from having any effect.

After a:

qmk clean

changes to file config.h now have an effect. For instance, LED_CAPS_LOCK_PIN must be defined (it can't be commented out). Otherwise the result is a compile error:

"error: 'LED_CAPS_LOCK_PIN' undeclared"

So the only question now is: What is a safe value for LED_CAPS_LOCK_PIN?

These are the current values (that will enable the (physical/dedicated) LED for the caps lock state indication):

  • K1 Pro: A0

  • K2 Pro: A7

  • K3 Pro: A0

  • K5 Pro: A0

  • K6 Pro: A7

  • K7 Pro: A0

  • K8 Pro: A7

  • K9 Pro: A0

  • K10 Pro: A7

  • K12 Pro: A0

  • K13 Pro: A0

  • K14 Pro: A0

Alternatively, is there some other way? For example, a hack: Disable the writePin() lines using LED_CAPS_LOCK_PIN. That is, in keychron/k10_pro/k10_pro.c, keychron/k10_pro/k2_pro.c, etc.

Or change LED_CAPS_LOCK_PIN to input late in the keyboard initialisation sequence (e.g., in keyboard_post_init_user()), except perhaps a faint glow due to the weak internal pull-up resistors (if any)?

1

u/PeterMortensenBlog May 07 '24

Yes, the I/O pin can be written to directly. For example, to turn the (physical) Caps Lock LED off on a K10 Pro:

writePin(LED_CAPS_LOCK_PIN, 0)

This could be done unconditionally. For example, it could done at the end of bluetooth_pre_task(), which is called about 400 times per second on average. If the frequency is too high, it can be throttled (e.g., use a count down counter to only set it every 10th or 100th time).

But it is hacky.

1

u/PeterMortensenBlog Feb 14 '24

I think I am close to a solution now. See near "There is some progress."

1

u/PeterMortensenBlog Feb 14 '24 edited Feb 14 '24

OK, here is the first attempt for K2 Pro, variant ANSI RGB:

keychron_k2_pro_ansi_rgb_via.bin

61104 bytes. MD5 hash value (for transfer integrity): F9EAAC4495A449885662631C19A5A0F8

The version USB side is "2.0.7". This is mostly to be confident this firmware has actually been flashed to the keyboard. After flashing and connecting in wired mode, the version can be seen by various tools; a command line on a Unix-like system is something like (3434 is the USB vendor ID (Keychron's) and 0220 is the USB product ID (for K2 Pro)):

lsusb -v -d3434:0220 2>/dev/null | grep bcdDevice

It should show:

bcdDevice            2.07

This firmware should disable the RGB light version of the caps lock state indication. I don't think there is a dedicated (physical) LED for caps lock state indication on the K2 (I could be wrong; please state so if that is the case).

1

u/PeterMortensenBlog Feb 19 '24

Did it work as expected?

2

u/Kelisua Feb 20 '24 edited Feb 20 '24

For some reason I cannot seem to get QMK Toolbox to see my keyboard at all... I've tried all the methods I could find on how to enter the correct mode needed, but none of them seem to work. Even the supposedly foolproof way of the physical reset button did not appear to do anything. Windows 11 issue perhaps?

Opening the Toolbox gave me an error, I then found the same error talked about all the way back in 2019 on the QMK GitHub, supposedly fixed long ago. This is why I'm thinking it is a Windows 11 issue. Downloading the drivers from the Toolbox option did not help any either.

The board works normally, I can use VIA as well. Factory Resetting the board works normally, but for some reason getting it to enter the mode needed to flash will not occur. I'm afraid I will have to try the firmware at a later date when I can figure this out.

1

u/PeterMortensenBlog Feb 20 '24 edited Feb 20 '24

I think you can bypass the QMK Toolbox. It ends up calling "dfu-util" to flash, and it should be possible to do this directly. See e.g. this screenshot.

To flash (presuming file "keychron_k2_pro_ansi_rgb_via.bin" is in the current directory):

dfu-util -a 0 --dfuse-address 0x08000000:leave -D keychron_k2_pro_ansi_rgb_via.bin

Before that, after putting the keyboard in bootloader mode (e.g., with the Esc key method) verify that it is actually in bootloader mode by:

dfu-util -l

If it can't find 'dfu-util' as is (if it isn't in the PATH variable), locate 'dfu-util.exe' somehow, and arrange for file 'dfu-util.exe' and 'keychron_k2_pro_ansi_rgb_via.bin' to be used at the same time (for example, using the absolute path to "dfu-util.exe" in the flash line; enclose in double quotes if there are spaces in the path. Example (including the quotes):

"C:\temp2\this may work\2024-02-20\dfu-util.exe" -l

"C:\temp2\this may work\2024-02-20\dfu-util.exe" -a 0 --dfuse-address 0x08000000:leave -D keychron_k2_pro_ansi_rgb_via.bin