%T#13975 Task opened by pot-horse: Keyremap plugin: text importer silently drops entries sharing the same action code within a context
Rockbox via rockbox-sf <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.sourceforge |
|---|---|
| Message-ID | <[email protected]> |
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - steven penny (pot-horse)
Attached to Project - Rockbox
Summary - Keyremap plugin: text importer silently drops entries sharing the same action code within a context
Task Type - Bugs
Category - Applications
Status - Unconfirmed
Assigned To -
Operating System - All players
Severity - Low
Priority - Very Low
Reported Version - Release 4.0
Due in Version - Undecided
Due Date - Undecided
Details - When importing a text keymap (`.txt`) via the keyremap plugin, `keymap_add_button_entry()` in `apps/plugins/keyremap.c` treats any entry with the same `(context, action_code)` pair as a duplicate and *overwrites* the existing entry instead of adding a new one. This silently discards legitimate mappings, because entries are matched at runtime by `(button_code, pre_button_code)` — not by action code — so multiple entries with the same action code in one context are valid and useful (e.g. several `ACTION_NONE` "swallow" entries that consume unwanted button events to prevent fall-through to the built-in keymap).
The core keymap format supports these entries fine (they work when the file is hand-built), but the text importer makes them impossible to load.
**Target or Device:** HiBy R1 — unmodified
**Release or version:** 20f4f9539a-260805
**Steps to reproduce:**
1. Create a text keymap file containing two entries with the same action code but different buttons in one context, e.g.:
```
CONTEXT_WPS = {
{ACTION_NONE, BUTTON_VOL_UP | BUTTON_REPEAT, BUTTON_VOL_UP | BUTTON_REPEAT},
{ACTION_NONE, BUTTON_VOL_DOWN | BUTTON_REPEAT, BUTTON_VOL_DOWN | BUTTON_REPEAT},
}
```
2. Open the keyremap plugin → Import Text Keymap → select the file.
3. Open Edit Keymap and inspect `CONTEXT_WPS`.
**Expected:** Both entries are present.
**Actual:** Only the second entry exists — the first was overwritten by the "Duplicate — Update the existing entry" path in `keymap_add_button_entry()`, which matches on `(context, action_code)` only.
**Suggested fix:** Include `button_code` and `pre_button_code` in the duplicate check, i.e. only treat an entry as a duplicate when context, action, button, *and* prebtn all match.
More information can be found at the following URL:
https://www.rockbox.org/tracker/task/13975
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
--
rockbox-sf mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-sf