• Status Unconfirmed
  • Percent Complete
  • Task Type Patches
  • Category User Interface
  • Assigned To No-one
  • Operating System Another
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.4
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by freddyb - 2009-11-05

FS#10763 - This patch speeds the keyboard input for scroll wheel devices

This patch is for the Sansa Fuze but easily modified for other players with scroll wheels.
apps/keymaps/keymap-[your player].c needs to be modified

This patch changes the keyboard input method for scroll wheel players to this:

Scrolling the wheel forward selects the column of the desired character moving right.
Reversing the wheel moves the keyboard cursor down (not left) to select the character.
Reversing again inserts the letter and resets the row and column to the top left.
Repeat…(right, down, right, down…)

The benefit is not leaving the scroll wheel or stopping to click anything.

The center select button is now always mapped to delete.
Left and right always move the edit position.
To make overshoot more forgiving reverse scrolling past the bottom of the keyboard moves the cursor to the top of the previous column.

The posted patch includes keymap changes for the Sansa Fuze. These are the changes required for a different target:

This patch will remove Morse code but preserves the unicode capability (not tested)

I don't use the keyboard very much but I really like this! After playing with it for 30 secs I think it really is a much easier way to use a keyboard than buttons!
As I said though, I hardly ever use the keyboard. I'm attaching a diff that simply adds the e200 keymap changes that are needed.

FlynDice, thanks for the feedback.

This is an update with a hanger on the cursor when switching columns.
I think it makes it a little easier to understand.

I added the iPod keymap if anyone wants to try that.

teru commented on 2009-11-06 03:16

Why does your patch remove Morse input code? I think it's completely unrelated and shouldn't be included to the patch.


I took it out before realizing they can co-exist and it was a bit easier to navigate all the conditionals. If there's any interest in this for inclusion I would redo it with Morse still included. Have you tried it?

Here's a gif animation of the screen.

The recent svn changes break the patch, so here's a drop in replacement for apps/recorder/keyboard.c

So this patch removes the morse input altogether? If so, not a good idea.


No, I just put that up as a proof of concept. I'm reworking it now so that it will peacefully co-exist with Morse mode (although I don't really know much about it.)

I don't have an iPod and I'm not sure what to map backspace to that won't interfere. I'm using scrollwheel for picking letters, left and right for cursor keys.

OK, this should be a better patch. It preserves Morse mode. (I'm sorry if I offended anyone. I was just trying to get a quick prototype to experiment with and I was having a hard time navigating the #ifdef's. I certainly didn't intend to have it removed from the project.)

I changed the order of the character selection to down (scroll back) then right (scroll forward)
I still think this is a very fast method for input. Anyone using the database searches would appreciate it.

I compacted this some more and changed the highlighting as shown in the gif animation. The patch no longer modifies the default keyboard but it definitely works better with a layout that starts with a blank column and most frequent characters near the top left. Again, the order is now scrolling backwards down to the correct row and then scrolling forwards to the right character. Any feedback would be appreciated.

Attached gif animation for keep_rolling-v5.diff

Some people have expressed a desire for 1 dimension side to side scroll wheel patch and this is it. Clicking left/right moves the cursor; scrolling left/right selects the keyboard char; and select inserts the current. Keymaps for Sansa Fuze, iPods, and Sansa E200 are provided. If someone wants it badly they can take it and make a new Flyspray entry for it.

Oops. This fixes the Fuze map for scroll_1d above.

Fix above: Forgot to take out recording patch. Geez.

Re-sync to svn.

Anyone looking for the simple left/right scroll wheel patch should use the scroll_1d.v3.diff patch above.

Modified key maps and updated to work with Morse code mode.
Added scroll wheel events to the UI simulator to ease testing.

Fixed display of custom keyboards for the simple linear scrolling patch.
Scrolling selects the character to insert, moving horizontally and wrapping the ends; the left/right buttons move the cursor; select inserts; and menu deletes (backspace).
Added mousewheel events to uisimulator for this patch also.

First of all, bless your heart for posting .gifs to show your idea in action. What a good idea! Though I suppose most features I follow aren't UI related. Still, though.

Would you be opposed to posting a .gif of the scroll_1d in action? I unfortunately do not have time to make a test build right now, but your description sounds like the basic idea for the bare-bones update that a lot of people would like to see added. It basically just changes scroll movement to horizontal, and wraps, correct? That would be a huge improvement over current behavior, for sure.

Also, your rollin concept is also interesting, and I wonder what others may think of it. Have you gotten feedback on irc? I feel like some may say it's too drastic, but if scroll_1d works as I think it does, perhaps you can move in baby steps towards your ultimate concept. Good luck with it either way, if either of these get in I may actually *use* my ipod for text-related purposes.

Keep Rollin' patch re-synced to SVN and reduced the changes to keyboard.c.

Added click areas and mouse scroll wheel events to the UI simulator to facilitate testing. (iPod Video, Fuze, E200)

Attached a keyboard layout for iPod and Fuze and a narrow keyboard layout for the Sansa E200.

Keyboard layout for iPod and Fuze for above.

Scroll_1D update:


Now uses original virtual keyboard layout.

Now wraps on longest line for custom layouts.

Added click areas and mouse scroll wheel events to the UI simulator to facilitate testing. (iPod Video, Fuze, E200)

This is a variation on the the plain old Scroll_1D patch that adds acceleration. The idea is to make big jumps to the desired letter and then fine tune the selection. This makes using a big virtual keyboard hurt less.

The process is to scroll just past the desired letter. Switching directions turns off acceleration so you can pick the right letter. Inserting, deleting, or edit cursor movements resets the acceleration to quickly seek to the next letter.

This should work on Fuze, iPod, and E200.

Added predictive text input (automatic word completion) to the Keep Rollin patch.

Create a dictionary file with one word per \n terminated line. Put the most common words at the top of the file. It does not need to be alphabetical. Save it as /.rockbox/pred_dict.txt MAX_DICT in keyboard.c reserves 85000 bytes for the dictionary file. Set it to something close to the actual dictionary size. The dictionary file is retained until reboot.

As text is entered the first match in the dictionary will be offered below the edit line. Press select to insert it.

Fix compiling on non-scrollwheel targets.

teru commented on 2010-02-21 12:05

some comments.
1. your patch removes two (CONFIG_KEYPAD == PBELL_VIBE500_PAD) unnecessarily.
2. please try to keep at most 80 chars per line as per docs/CONTRIBUTING.
3. could you please separate dictionaly thing to another patch so that each patch contains one change?
4. i think undefining KBD_TOGGLE_INPUT in #ifdef HAVE_SCROLLWHEEL is wrong. they could be coexist if there are enough key.
5. imo, it is better to change page when cursor reaches top/bottom than left/right since cursor moves vertically fisrt and then horizontally, so it would be annoying to input a character on another page.

Teru, thanks for the pointers. I'll clean it up as you requested. I'm thinking about changing the use morse mode menu option to let the user choose current, morse, or keep-rollin mode. Do you have any opinion on that?

I'm going to see if I can get  FS#11047  committed first and then rewrite against that.

I tested it out and installed this on my e200v2 just before  FS#11047  got committed, and it built just fine. I love it!
Except that I found it a little counter-intuitive that when you started going along a row, it started one character to the right. So I fixed it.
Maybe you could add this feature to your rewrite?

Corwyn, thanks! I've been using a custom keyboard layout with a blank 1st column but I think your modification is good.

I wanted to post this to try to get some feedback on keyboard ideas. This lets users on scroll wheel targets choose from multiple keyboard modes: Standard, Standard Sideways, Keep Rollin, Scroll 1D, Row-Column, and Morse. I know it can't be accepted like this but if I continue this is what I would like to have eventually.

Standard Sideways uses the wheel to move horizontally and left and right buttons to switch rows/edit mode.
Keep Rollin is the same except that it now includes Corwyn's modification.
Row-Column is for huge keyboard layouts. Use the wheel to switch characters within a row. Moving past the beginning or end of a row switches to row selection mode. Scroll to the desired row and press select to get back to horizontal mode.

The menu entry for selecting keyboard modes is Settings>General>System>Keyboard Mode
The Morse mode key now cycles through available modes.
Page flipping is now vertical for scroll wheel modes.
Menu is backspace on scroll wheel modes.
Predicted text is inserted by moving the cursor right at the end of the line. (This will be the last patch with predicted text. I wanted to test out different target & button combinations before i got rid of it.)

Scroll Wheel Targets: No line edit in Morse. Menu deletes, and left/right/wheel moves edit position.

iPod: Long Menu cycles modes, Play is save/quit, and Long Play is cancel

E200: Record cycles modes, Play is save/quit, and Menu is cancel

Fuze: Long Menu cycles modes


I'd like to add that I like the idea of a long press to cancel. I sometimes press "menu" by accident and cancel my edit which is a bit annoying (I know I should just not press this button). This would never happen again with long presses, which could be the standard for canceling anything.

Thanks, did you try any of the different modes?

Resync to SVN.

According to freddyb, jumbo-v2.diff is against r25056 and works against r25108.

First about the keys, if I sum up correctly for iPods:
Menu short/long is Delete/Mode
Play short/long is Ok/Cancel
In Keep-Rollin, Scroll 1D, Row-Col and Morse, Prev/Next is Left/Right

You wrote "I don't have an iPod and I'm not sure what to map backspace to that won't interfere." (, short Menu is great.

Standard and Sideways:
I'm glad to have Sideways, it better fits my quite horizontal key map. Thanks.

Keep Rollin':
I'd suggest that while choosing the line (only the thin line is displayed), pushing the Select button writes nothing (it currently prints the first char of the line). I guess that's why you suggested a blank first column. Mmmh there must be another issue…

Scroll 1D:
Works as expected but I personally don't like it.

Good idea but the behavior was unexpected: you roll for the line, Select button to choose it, then roll for the column, Select button to choose it. Nice but I thought I'd go back to "line mode" mode directly (it took me several seconds to understand I had to go out of my key map to go back to "line mode").

Christophe, thanks.

The idea for Keep Rollin' is to not use the select at all, just roll back and forth. (Scrolling back after forward inserts the character and resets to home position.) I was thinking about using select to back up in case of scrolling too far. I really had trouble with this on my iPod Video until I reduced the touch wheel sensitivity in firmware/target/arm/ipod/button-clickwheel.c.

For Row-Col the idea was to group things together on lines. Suppose you had multiple alphabets and used a small font you could put each alphabet on a separate line so that mostly you stay within the line and just go vertical when you need to change sets.

Resync to SVN.

Updated against SVN. (It's ugly because I haven't incorporated recent keyboard.c changes yet.)

Current features:

- Settings menu option for keyboard mode: Standard, Sideways, Keep Rollin, Scroll 1D, Row-Column, and Morse

- Keyboard mode cycling by holding menu key.

- Settings menu option for wheel speed on iPod video and those that use the same driver. This makes the v-keyboard more forgiving.

- Predictive text entry with word learning and prioritized words. Words entered via the keyboard will be added to the dictionary and given the highest priority. Create a dictionary file ".rockbox/pred_dict.txt" composed of one word per line with the most frequent words at the top of the file. A list of most common English words are available at The define for MAX_DICT_SIZE should be set to pred_dict.txt size plus some extra for learned words. You must have at least an empty dictionary file for the learning to work.
Learning stops if the dictionary is full.


-Sideways mode is just like standard except the the wheel moves left/right and the left/right buttons move the picker up/down.

-Keep Rollin uses a sequence of left scroll and right scroll to select the row and then the column of the letter, respectively. Left scrolling again inserts the letter and resets the position to home to start picking the row for the next letter. This makes entering text a continuous left-right scrolling action. Without having to use buttons. The most common glyphs should be at the top left of the layout for the best performance. This is my favorite mode on the Fuze. It works out to about 40 characters/minute.

-Scroll 1D uses the wheel to move the picker left/right and wraps to the next row at the ends.

-Row-Column mode is like Scroll 1D but if the picker gets to the end of a row it switches to row selection. The wheel is then used to move the row selector up or down. Selecting the row goes back to horizontal mode. This mode is good if you have many glyphs that can be grouped together by lines. This is what I use on the iPod Video because the lack of a real wheel with discreet notches makes Keep Rollin difficult.

Keep Rollin, Scroll 1D, Row-Column, and Morse mode use the left/right buttons to move the edit position. Pressing the right button at the end of the input line inserts the predicted text. (In Standard and Sideways scrolling right in edit mode at the end of the line does this.) Menu key deletes. Long Menu cycles modes.

Fixed some bugs in the dictionary learning.

St. commented on 2010-07-12 06:59

Fred Bauer (freddyb),

Are you able to split out the Learning Dictionary/Predictive Text insert to seperate patch?
That would be awesome.


St., you can get the same result by not changing the keyboard mode from Standard.

St. commented on 2010-07-14 13:04

This is true, but, I like to try and keep my build clean of things I never use.
If it wouldn't be too much hassle for you, I would appreciate it. I'm sure you know your code a lot better than I do ;)
It would be nice if each seperate entry mode was a different patch, and the learning dictionary a different patch also, then people could pick and choose exactly what they wanted, or just install your "combo-patch" if they want it all.

I personally think the the learning dictionary/Predictive text entry would have a good chance of getting committed if it were a separate patch.

Just a suggestion.


St., the dictionary is the least likely part to get accepted because it permanently allocates memory for the entire dictionary.

Incorporate recent changes in svn: touchscreen, kbd_get_ch changes, drop KBD_MODES defines. Fixed some rendering issue that caused a problem on MRobe. Removed some unrelated changes.

Here's an update on the Keep Rollin' patch resynced to current for anyone is still interested. The recent keyboard.c change that wraps cursor position conflicts a bit with this patch because CURSOR_RIGHT on the end of the line triggers dictionary completion. If this bothers you, undefine PRED_TEXT in keyboard.c.

The button mapping on the iPod is changed because the stock build doesn't seem to have a backspace.
Play - accept & exit
Long Play - abort
Menu - backspace


Available keyboard shortcuts


Task Details

Task Editing