FS#10468 - USB HID: Show keypad mode on screen

Attached to Project: Rockbox
Opened by Tomer Shalev (tomers) - Sunday, 26 July 2009, 07:30 GMT
Last edited by Tomer Shalev (tomers) - Wednesday, 30 September 2009, 13:26 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To Tomer Shalev (tomers)
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch add support for changing keypad mapping to keys sent to the host computer while the DAP is connected through USB.
The user can iterate over the different keypad modes by pressing a key (e200: REC key). The different modes are:
* Media Player (Control volume, Pause/Play, Stop, Next/Previous tracks)
* PowerPoint (Start Presentation, Next/Previous slide, Black/White screen, etc)
* Acrobat Reader (Next/Previous Page/Screen, Full Screen, Scroll Up/Down)

Additional modes can be easily added.

The current mode will be shown on screen (tested on e200 - need further testing on different platforms).
This task depends upon

Closed by  Tomer Shalev (tomers)
Wednesday, 30 September 2009, 13:26 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed in r22852-22856
Comment by Paul Louden (Llorean) - Sunday, 26 July 2009, 08:45 GMT
Why not allow the mode to be set in a normal settings menu, so that *all* buttons are available while in USB mode?

This is especially helpful since many players don't have a record button, and so have even less available buttons to be able to spare one for this.
Comment by Tomer Shalev (tomers) - Monday, 27 July 2009, 06:41 GMT
> Why not allow the mode to be set in a normal settings menu, so that *all* buttons are available while in USB mode?
I think this is a good remark. I've implemented a system setting for this feature, and a manual section for it (currently enabled only in e200 - should define option USB_ENABLE_HID in manual/platform/*.tex where relevant).

Attached patch contains these additions.
Comment by Frank Gevaerts (fg) - Saturday, 01 August 2009, 14:02 GMT
I must say I'm not very comfortable with directly naming and supporting proprietary applications. Do other similar applications use the same keys? If so, how about naming the modes "Presentation" and "Document viewer"?

More generally, I'm not sure how far we should take this built-in HID mode. Personally, I think the remote_control plugin is the proper place for all this.
Comment by Will Hauck (moonscapex) - Sunday, 13 September 2009, 18:55 GMT
Doesn't patch on latest build/
Comment by Tomer Shalev (tomers) - Sunday, 20 September 2009, 20:43 GMT
Synced to r22761.

Removed support for proprietary applications, as per Frank's suggestion.

Now supports three modes: Multimedia, Presentation and Browser.
Documentation relates to OpenOffice Impress and Firefox as example applications.
Comment by Tomer Shalev (tomers) - Monday, 21 September 2009, 06:07 GMT
Updated version:
* Save settings once, on USB disconnect, instead on each keypad mode change.
* Remove redundant gui statusbar drawing calls
Comment by Tomer Shalev (tomers) - Monday, 21 September 2009, 22:31 GMT
Added support for mouse movement mode! Now the DAP can be a mouse replacement :-)
Comment by Tomer Shalev (tomers) - Tuesday, 22 September 2009, 13:30 GMT
Add Middle-Click support for mouse mode
Comment by Tomer Shalev (tomers) - Wednesday, 23 September 2009, 19:54 GMT
Changes since last patch:
-Extract the usb keymap mode logic into apps/usb_keymaps.[ch], thus make apps/screens.c neatier.

This patch tested extensively on e200. I guess this patch is stable and ready for testing. I would welcome any feedback, especially from users using other platforms.
I would appreciate if one of the committers (gevaerts?) will find the time to consider it for committing after we receive enough feedback.

Comment by Frank Gevaerts (fg) - Wednesday, 23 September 2009, 20:08 GMT
I'll review this, but it will be next week at the earliest
Comment by Tomer Shalev (tomers) - Thursday, 24 September 2009, 06:51 GMT
Changes since last patch:
- Added mouse acceleration which mouse mode more usable.
Comment by Tomer Shalev (tomers) - Saturday, 26 September 2009, 17:42 GMT
Changes since last patch:
- Support for iterating backwards over keypad modes using a long press.
- Removed support for middle mouse button
- Add support for left/right mouse dragging
- Fixed using define HAVE_USBSTACK instead of USB_ENABLE_HID
- Fixed some wrong HID buttons on various targets
- Add mouse keymaps for the following targets:
hdd1630; sa9200; ipod; gigabeat-s; clip; c100; c200; e200 (owners: please test and report)
Comment by Tomer Shalev (tomers) - Sunday, 27 September 2009, 15:18 GMT
Changes since last patch:
- Added manual section with proper keymaps for all relevant platforms.

No further enhancements are expected.
Comment by Tomer Shalev (tomers) - Sunday, 27 September 2009, 15:55 GMT
...oops, forgot this one:

- Use #define HAVE_USB_HID_MOUSE for target with sufficient number of keys to have a usable mouse emulation