Repository navigation
Commit d26ed7a
fwk: keyboard: optionally show Fn lock on the Caps Lock LED
Fn lock (Fn+Esc) is tracked only inside the EC: there is no host command or
HID report for it, so there is no way to tell which state the top row is in
without pressing a key. See
FrameworkComputer/SoftwareFirmwareIssueTracker#176
Add CONFIG_PLATFORM_EC_FRAMEWORK_FNLOCK_CAPS_LED (default n). When enabled,
gpio_cap_led follows Fn_key & FN_LOCKED instead of the host's 8042 Caps
Lock state, using the existing lid/S0 blanking in
keyboard_caps_led_update(). With the option off, LED behaviour is unchanged.
Independently of the option, persist the Fn-lock flag to BBRAM on every
toggle rather than only in fnkey_shutdown(), so an unclean power loss does
not restore whatever the last clean shutdown stored. fnkey_save_kbstate()
is factored out of fnkey_shutdown() for this; Fn_key moves above the LED
code so the updater can read it.
Boot-time restore relies on HOOK_CHIPSET_RESUME: HOOK_CHIPSET_STARTUP fires
while power_get_state() is still POWER_S5S3, which the blanking rejects, so
a call from fnkey_startup() would always write 0. A comment says so.
Tested on a Framework Laptop 13 Pro (sakura) with the option enabled. That
build is byte-identical to the image flashed for testing.
- Fn+Esc toggles the LED
- the LED goes dark with the lid closed and returns when it is opened
- the LED is dark in suspend and returns on wake
- Fn lock and the LED state are restored after a reboot
Not tested: restoring the Fn-lock flag after an unclean power loss, and
any hardware other than sakura. With the option off, sakura, azalea and
marigold build, but that configuration was not run on hardware.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dAnHutxgoW4y9K7DAZomY1 parent 8c891e3 commit d26ed7a
2 files changed
Lines changed: 58 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
Lines changed: 46 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
190 | 203 | | |
191 | 204 | | |
192 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
193 | 211 | | |
194 | 212 | | |
195 | | - | |
196 | | - | |
197 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
198 | 216 | | |
199 | 217 | | |
200 | 218 | | |
201 | 219 | | |
202 | 220 | | |
203 | 221 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 222 | | |
208 | 223 | | |
209 | 224 | | |
| |||
233 | 248 | | |
234 | 249 | | |
235 | 250 | | |
236 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
237 | 258 | | |
238 | 259 | | |
239 | 260 | | |
| |||
242 | 263 | | |
243 | 264 | | |
244 | 265 | | |
245 | | - | |
| 266 | + | |
246 | 267 | | |
247 | | - | |
| 268 | + | |
248 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
249 | 275 | | |
250 | 276 | | |
251 | 277 | | |
| |||
405 | 431 | | |
406 | 432 | | |
407 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
408 | 438 | | |
409 | 439 | | |
410 | 440 | | |
| |||
0 commit comments