summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-09-30 10:06:04 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-09-30 10:06:04 +0000
commit8c5141b32ea74a3093073d9bb11205acb7640233 (patch)
tree486f8e4f94053a389d840b04724567a524b9b4ea /apps
parentd7f4f9ff750872a9eb570409966e500099d84d7d (diff)
downloadrockbox-8c5141b32ea74a3093073d9bb11205acb7640233.tar.gz
rockbox-8c5141b32ea74a3093073d9bb11205acb7640233.tar.bz2
rockbox-8c5141b32ea74a3093073d9bb11205acb7640233.zip
Commit "FS#10468 - USB HID: Show keypad mode on screen"
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22852 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES3
-rw-r--r--apps/action.h53
-rw-r--r--apps/keymaps/keymap-c100.c61
-rw-r--r--apps/keymaps/keymap-c200.c67
-rw-r--r--apps/keymaps/keymap-clip.c67
-rw-r--r--apps/keymaps/keymap-e200.c67
-rw-r--r--apps/keymaps/keymap-gigabeat-s.c107
-rw-r--r--apps/keymaps/keymap-h10.c47
-rw-r--r--apps/keymaps/keymap-hdd1630.c71
-rw-r--r--apps/keymaps/keymap-ipod.c75
-rw-r--r--apps/keymaps/keymap-mr100.c6
-rw-r--r--apps/keymaps/keymap-ondavx747.c16
-rw-r--r--apps/keymaps/keymap-ondavx777.c4
-rw-r--r--apps/keymaps/keymap-sa9200.c80
-rw-r--r--apps/keymaps/keymap-touchscreen.c27
-rw-r--r--apps/lang/english.lang70
-rw-r--r--apps/menus/settings_menu.c6
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/SOURCES2
-rw-r--r--apps/screens.c177
-rw-r--r--apps/settings.h6
-rw-r--r--apps/settings_list.c7
-rw-r--r--apps/usb_keymaps.c249
-rw-r--r--apps/usb_keymaps.h28
25 files changed, 1045 insertions, 259 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 0408c32583..bac376589a 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -150,6 +150,9 @@ dsp_arm.S
eq_arm.S
#endif
#endif
+#ifdef USB_ENABLE_HID
+usb_keymaps.c
+#endif
metadata.c
metadata/mp3.c
#if CONFIG_CODEC == SWCODEC
diff --git a/apps/action.h b/apps/action.h
index 5df8639cdf..39e3e09d73 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -76,6 +76,7 @@ enum {
CONTEXT_KEYBOARD,
CONTEXT_FM,
CONTEXT_USB_HID,
+ CONTEXT_USB_HID_MOUSE,
};
@@ -241,14 +242,52 @@ enum {
#endif
/* USB HID codes */
- ACTION_USB_HID_PLAY,
- ACTION_USB_HID_STOP,
- ACTION_USB_HID_SKIPPREV,
- ACTION_USB_HID_SKIPNEXT,
- ACTION_USB_HID_VOLDOWN,
- ACTION_USB_HID_VOLUP,
- ACTION_USB_HID_MUTE,
+ ACTION_USB_HID_FIRST, /* Place holder */
+ ACTION_USB_HID_DEC,
+ ACTION_USB_HID_INC,
+ ACTION_USB_HID_START,
+ ACTION_USB_HID_START_LONG,
+ ACTION_USB_HID_QUIT,
+ ACTION_USB_HID_QUIT_LONG,
+ ACTION_USB_HID_LEFT,
+ ACTION_USB_HID_LEFT_LONG,
+ ACTION_USB_HID_RIGHT,
+ ACTION_USB_HID_RIGHT_LONG,
+ ACTION_USB_HID_SELECT,
+ ACTION_USB_HID_SELECT_LONG,
ACTION_USB_HID_MENU,
+ ACTION_USB_HID_MENU_LONG,
+ ACTION_USB_HID_MODE,
+ ACTION_USB_HID_MODE_LONG,
+ ACTION_USB_HID_MOUSE_UP,
+ ACTION_USB_HID_MOUSE_UP_REP,
+ ACTION_USB_HID_MOUSE_DOWN,
+ ACTION_USB_HID_MOUSE_DOWN_REP,
+ ACTION_USB_HID_MOUSE_LEFT,
+ ACTION_USB_HID_MOUSE_LEFT_REP,
+ ACTION_USB_HID_MOUSE_RIGHT,
+ ACTION_USB_HID_MOUSE_RIGHT_REP,
+ ACTION_USB_HID_MOUSE_LDRAG_UP,
+ ACTION_USB_HID_MOUSE_LDRAG_UP_REP,
+ ACTION_USB_HID_MOUSE_LDRAG_DOWN,
+ ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP,
+ ACTION_USB_HID_MOUSE_LDRAG_LEFT,
+ ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP,
+ ACTION_USB_HID_MOUSE_LDRAG_RIGHT,
+ ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP,
+ ACTION_USB_HID_MOUSE_RDRAG_UP,
+ ACTION_USB_HID_MOUSE_RDRAG_UP_REP,
+ ACTION_USB_HID_MOUSE_RDRAG_DOWN,
+ ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP,
+ ACTION_USB_HID_MOUSE_RDRAG_LEFT,
+ ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP,
+ ACTION_USB_HID_MOUSE_RDRAG_RIGHT,
+ ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP,
+ ACTION_USB_HID_MOUSE_BUTTON_LEFT,
+ ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL,
+ ACTION_USB_HID_MOUSE_BUTTON_RIGHT,
+ ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL,
+ ACTION_USB_HID_LAST, /* Place holder */
LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */
};
diff --git a/apps/keymaps/keymap-c100.c b/apps/keymaps/keymap-c100.c
index a19549dbd9..fcb747b5fd 100644
--- a/apps/keymaps/keymap-c100.c
+++ b/apps/keymaps/keymap-c100.c
@@ -232,17 +232,60 @@ static const struct button_mapping button_context_bmark[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_bmark */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOLUP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_USB_HID_START_LONG, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_USB_HID_MODE, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
@@ -293,9 +336,11 @@ const struct button_mapping* get_context_mapping(int context)
#endif
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-c200.c b/apps/keymaps/keymap-c200.c
index acc4a6aaf0..fa6c64cec8 100644
--- a/apps/keymaps/keymap-c200.c
+++ b/apps/keymaps/keymap-c200.c
@@ -264,21 +264,62 @@ static const struct button_mapping button_context_bmark[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_bmark */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_USB_HID_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_USB_HID_START_LONG, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_USB_HID_MODE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
@@ -327,9 +368,11 @@ const struct button_mapping* get_context_mapping(int context)
#endif
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-clip.c b/apps/keymaps/keymap-clip.c
index 5b45f4fb3d..21728db7fb 100644
--- a/apps/keymaps/keymap-clip.c
+++ b/apps/keymaps/keymap-clip.c
@@ -273,21 +273,62 @@ static const struct button_mapping button_context_bmark[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_bmark */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_USB_HID_START_LONG, BUTTON_UP|BOTTOM_REPEAT, BUTTON_UP },
+ { ACTION_USB_HID_QUIT, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_HOME|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_HOME|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_HOME|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_HOME|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_HOME|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_HOME|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_HOME|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_HOME, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_HOME|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
@@ -337,9 +378,11 @@ const struct button_mapping* get_context_mapping(int context)
#endif
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-e200.c b/apps/keymaps/keymap-e200.c
index ede06515ef..ef5c932f20 100644
--- a/apps/keymaps/keymap-e200.c
+++ b/apps/keymaps/keymap-e200.c
@@ -275,21 +275,62 @@ static const struct button_mapping button_context_bmark[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_bmark */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_USB_HID_START_LONG, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_USB_HID_MODE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
@@ -339,9 +380,11 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_recscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-gigabeat-s.c b/apps/keymaps/keymap-gigabeat-s.c
index 4fb7e1b3f1..6c5b6decb5 100644
--- a/apps/keymaps/keymap-gigabeat-s.c
+++ b/apps/keymaps/keymap-gigabeat-s.c
@@ -468,40 +468,91 @@ static const struct button_mapping remote_button_context_right_is_inc[] = {
LAST_ITEM_IN_LIST
}; /* remote_button_context_right_is_inc */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_START },
+ { ACTION_USB_HID_START_LONG, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_START },
+ { ACTION_USB_HID_QUIT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
+ { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
static const struct button_mapping remote_button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_RC_DSP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_RC_DSP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_LEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
+ { ACTION_USB_HID_RIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF},
+ { ACTION_USB_HID_SELECT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
+ { ACTION_USB_HID_MENU, BUTTON_RC_DSP|BUTTON_REPEAT, BUTTON_RC_DSP },
+ { ACTION_USB_HID_MODE, BUTTON_RC_DSP|BUTTON_REL, BUTTON_RC_DSP },
LAST_ITEM_IN_LIST
}; /* remote_button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_BACK|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_BACK|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_BACK|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_BACK|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_BACK|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_BACK|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_BACK|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_BACK|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_MENU|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_MENU|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_MENU|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_MENU|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_BACK, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
static const struct button_mapping* get_context_mapping_remote( int context )
@@ -546,7 +597,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
case CONTEXT_FM:
return remote_button_context_radio;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return remote_button_context_usb_hid;
#endif
@@ -617,9 +668,11 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_FM:
return button_context_radio;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-h10.c b/apps/keymaps/keymap-h10.c
index ad1ed64c5a..81673397c3 100644
--- a/apps/keymaps/keymap-h10.c
+++ b/apps/keymaps/keymap-h10.c
@@ -337,30 +337,37 @@ static const struct button_mapping button_context_radio[] = {
};
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
- { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_FF, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_START_LONG, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_REW|BUTTON_REL, BUTTON_REW },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
+ { ACTION_USB_HID_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
static const struct button_mapping remote_button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_LEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
+ { ACTION_USB_HID_RIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
LAST_ITEM_IN_LIST
}; /* remote_button_context_usb_hid */
@@ -395,7 +402,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
return remote_button_context_pitchscreen;
case CONTEXT_RECSCREEN:
return button_context_recscreen;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return remote_button_context_usb_hid;
#endif
@@ -453,7 +460,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_recscreen;
case CONTEXT_FM:
return button_context_radio;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
#endif
diff --git a/apps/keymaps/keymap-hdd1630.c b/apps/keymaps/keymap-hdd1630.c
index 4565c2807b..ddb357a8b1 100644
--- a/apps/keymaps/keymap-hdd1630.c
+++ b/apps/keymaps/keymap-hdd1630.c
@@ -284,25 +284,62 @@ static const struct button_mapping button_context_radio[] = {
};
#endif
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_VIEW, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_USB_HID_START_LONG, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_MODE, BUTTON_VIEW|BUTTON_REL, BUTTON_VIEW },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_VIEW|BUTTON_REPEAT, BUTTON_VIEW },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
const struct button_mapping* get_context_mapping(int context)
@@ -352,9 +389,11 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_FM:
return button_context_radio;
#endif
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
}
return button_context_standard;
diff --git a/apps/keymaps/keymap-ipod.c b/apps/keymaps/keymap-ipod.c
index 774597a3c0..99c7f93511 100644
--- a/apps/keymaps/keymap-ipod.c
+++ b/apps/keymaps/keymap-ipod.c
@@ -193,21 +193,48 @@ const struct button_mapping button_context_recscreen[] = {
}; /* button_context_recscreen */
#endif
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_MODE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
#if BUTTON_REMOTE != 0
@@ -242,16 +269,18 @@ static const struct button_mapping remote_button_context_wps[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
};
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping remote_button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
+ { ACTION_USB_HID_LEFT, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_RC_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_RC_RIGHT },
LAST_ITEM_IN_LIST
}; /* remote_button_context_usb_hid */
@@ -265,7 +294,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
{
case CONTEXT_WPS:
return remote_button_context_wps;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return remote_button_context_usb_hid;
#endif
@@ -321,9 +350,11 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_RECSCREEN:
return button_context_recscreen;
#endif
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
default:
return button_context_standard;
diff --git a/apps/keymaps/keymap-mr100.c b/apps/keymaps/keymap-mr100.c
index bf9da0de58..a605131465 100644
--- a/apps/keymaps/keymap-mr100.c
+++ b/apps/keymaps/keymap-mr100.c
@@ -315,7 +315,7 @@ static const struct button_mapping remote_button_context_tree[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
};
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
{ ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
@@ -357,7 +357,7 @@ static const struct button_mapping* get_context_mapping_remote( int context )
case CONTEXT_MAINMENU:
case CONTEXT_TREE:
return remote_button_context_tree;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return remote_button_context_usb_hid;
#endif
@@ -411,7 +411,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_pitchscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
#endif
diff --git a/apps/keymaps/keymap-ondavx747.c b/apps/keymaps/keymap-ondavx747.c
index 6eb2230d49..ee590599b6 100644
--- a/apps/keymaps/keymap-ondavx747.c
+++ b/apps/keymaps/keymap-ondavx747.c
@@ -167,14 +167,16 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_keyboard */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_USB_HID_SELECT, BUTTON_POWER|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_USB_HID_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_MODE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
diff --git a/apps/keymaps/keymap-ondavx777.c b/apps/keymaps/keymap-ondavx777.c
index 99f509b18f..f492a1964f 100644
--- a/apps/keymaps/keymap-ondavx777.c
+++ b/apps/keymaps/keymap-ondavx777.c
@@ -110,7 +110,7 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_keyboard */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
@@ -162,7 +162,7 @@ const struct button_mapping* target_get_context_mapping(int context)
return button_context_pitchscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
#endif
diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c
index 3e83932347..cb9c746cf3 100644
--- a/apps/keymaps/keymap-sa9200.c
+++ b/apps/keymaps/keymap-sa9200.c
@@ -276,30 +276,66 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_PREV, BUTTON_NONE },
- { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
-
- { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
-
- { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_USB_HID_MUTE, BUTTON_NEXT, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_START_LONG, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_QUIT, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_PREV|BUTTON_REPEAT, BUTTON_PREV },
+ { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT BUTTON_RIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT },
+ { ACTION_USB_HID_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_PREV|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_PREV|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_PREV|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_PREV|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_PREV|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_PREV|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_PREV|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_PREV|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_NEXT|BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_NEXT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_NEXT|BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_NEXT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_NEXT|BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_NEXT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_NEXT|BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_NEXT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_PREV|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mouse */
#endif
const struct button_mapping* get_context_mapping(int context)
@@ -349,9 +385,11 @@ const struct button_mapping* get_context_mapping(int context)
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
+ case CONTEXT_USB_HID_MOUSE:
+ return button_context_usb_hid_mouse;
#endif
}
return button_context_standard;
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c
index 4b86efa29e..499eb2b562 100644
--- a/apps/keymaps/keymap-touchscreen.c
+++ b/apps/keymaps/keymap-touchscreen.c
@@ -251,13 +251,26 @@ static const struct button_mapping button_context_radio[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
}; /* button_context_radio */
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_PLAY, BUTTON_TOPRIGHT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPPREV, BUTTON_MIDLEFT, BUTTON_NONE },
- { ACTION_USB_HID_SKIPNEXT, BUTTON_MIDRIGHT, BUTTON_NONE },
- { ACTION_USB_HID_MUTE, BUTTON_CENTER, BUTTON_NONE },
- { ACTION_USB_HID_MENU, BUTTON_TOPLEFT, BUTTON_NONE },
+ { ACTION_USB_HID_INC, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
+ { ACTION_USB_HID_INC, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
+ { ACTION_USB_HID_DEC, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_BOTTOMMIDDLE },
+ { ACTION_USB_HID_DEC, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_BOTTOMMIDDLE },
+ { ACTION_USB_HID_START, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_TOPMIDDLE },
+ { ACTION_USB_HID_START_LONG, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_TOPMIDDLE },
+ { ACTION_USB_HID_QUIT, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
+ { ACTION_USB_HID_QUIT_LONG, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
+ { ACTION_USB_HID_LEFT, BUTTON_MIDLEFT|BUTTON_REL, BUTTON_MIDLEFT },
+ { ACTION_USB_HID_LEFT_LONG, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_MIDLEFT },
+ { ACTION_USB_HID_RIGHT, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
+ { ACTION_USB_HID_RIGHT_LONG, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
+ { ACTION_USB_HID_SELECT, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
+ { ACTION_USB_HID_SELECT_LONG, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
+ { ACTION_USB_HID_MENU, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
+ { ACTION_USB_HID_MENU_LONG, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT },
+ { ACTION_USB_HID_MODE, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
+ { ACTION_USB_HID_MODE_LONG, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_USB_HID)
}; /* button_context_usb_hid */
@@ -315,7 +328,7 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_pitchscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
-#ifdef HAVE_USBSTACK
+#ifdef USB_ENABLE_HID
case CONTEXT_USB_HID:
return button_context_usb_hid;
#endif
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 72e0a4ce90..541e7ffbe0 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12654,6 +12654,76 @@
</voice>
</phrase>
<phrase>
+ id: LANG_USB_KEYPAD_MODE
+ desc: in settings_menu
+ user: core
+ <source>
+ *: "USB Keypad Mode:"
+ </source>
+ <dest>
+ *: "USB Keypad Mode:"
+ </dest>
+ <voice>
+ *: "USB Keypad Mode"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_MULTIMEDIA
+ desc: in settings_menu
+ user: core
+ <source>
+ *: "Multimedia"
+ </source>
+ <dest>
+ *: "Multimedia"
+ </dest>
+ <voice>
+ *: "Multimedia"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_PRESENTATION
+ desc: in settings_menu
+ user: core
+ <source>
+ *: "Presentation"
+ </source>
+ <dest>
+ *: "Presentation"
+ </dest>
+ <voice>
+ *: "Presentation"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_BROWSER
+ desc: in settings_menu
+ user: core
+ <source>
+ *: "Browser"
+ </source>
+ <dest>
+ *: "Browser"
+ </dest>
+ <voice>
+ *: "Browser"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_MOUSE
+ desc: in settings_menu
+ user: core
+ <source>
+ *: "Mouse"
+ </source>
+ <dest>
+ *: "Mouse"
+ </dest>
+ <voice>
+ *: "Mouse"
+ </voice>
+</phrase>
+<phrase>
id: LANG_SKIN_RAM_USAGE
desc: how much RAM the skins are using
user: core
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index fdc775877a..71a6089e68 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -252,6 +252,9 @@ MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL);
MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
#endif
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
+#ifdef USB_ENABLE_HID
+MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL);
+#endif
#ifdef HAVE_BUTTON_LIGHT
MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL);
@@ -300,6 +303,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
&touchpad_sensitivity,
#endif
+#ifdef USB_ENABLE_HID
+ &usb_keypad_mode,
+#endif
);
/* SYSTEM MENU */
diff --git a/apps/plugin.c b/apps/plugin.c
index aa7077edae..945e99ec71 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -51,7 +51,7 @@
#include "bidi.h"
#endif
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
+#ifdef USB_ENABLE_HID
#include "usbstack/usb_hid.h"
#endif
@@ -367,7 +367,7 @@ static const struct plugin_api rockbox_api = {
queue_reply,
#endif
usb_acknowledge,
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
+#ifdef USB_ENABLE_HID
usb_hid_send,
#endif
#ifdef RB_PROFILE
diff --git a/apps/plugin.h b/apps/plugin.h
index b4a6b4fc1b..766a309c01 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -105,7 +105,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#include "yesno.h"
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
+#ifdef USB_ENABLE_HID
#include "usbstack/usb_hid_usage_tables.h"
#endif
@@ -491,7 +491,7 @@ struct plugin_api {
#endif /* CONFIG_CODEC == SWCODEC */
void (*usb_acknowledge)(long id);
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
+#ifdef USB_ENABLE_HID
void (*usb_hid_send)(usage_page_t usage_page, int id);
#endif
#ifdef RB_PROFILE
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index b9061ee74b..4cfc3a8b0f 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -169,6 +169,6 @@ md5sum.c
lua.c
#endif
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
+#ifdef USB_ENABLE_HID
remote_control.c
#endif
diff --git a/apps/screens.c b/apps/screens.c
index a7a4b27ea8..65b64eab3e 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -37,7 +37,7 @@
#if defined(HAVE_USBSTACK)
#include "usb_core.h"
#ifdef USB_ENABLE_HID
-#include "usbstack/usb_hid.h"
+#include "usb_keymaps.h"
#endif
#endif
#include "settings.h"
@@ -93,59 +93,32 @@ static int clamp_value_wrap(int value, int max, int min)
#endif
#ifndef SIMULATOR
+
+#ifdef USB_ENABLE_HID
+int usb_keypad_mode;
+#endif
+
static int handle_usb_events(void)
{
#if (CONFIG_STORAGE & STORAGE_MMC)
int next_update=0;
#endif /* STORAGE_MMC */
-#ifdef HAVE_TOUCHSCREEN
- enum touchscreen_mode old_mode = touchscreen_get_mode();
-
- /* TODO: Paint buttons on screens OR switch to point mode and use
- * touchscreen as a touchpad to move the host's mouse cursor */
- touchscreen_set_mode(TOUCHSCREEN_BUTTON);
-#endif
-
/* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
while(1)
{
int button;
-#if defined(HAVE_USBSTACK) && defined(USB_ENABLE_HID)
- bool hid_enabled = usb_core_driver_enabled(USB_DRIVER_HID);
-
- if (hid_enabled)
+#ifdef USB_ENABLE_HID
+ if (usb_core_driver_enabled(USB_DRIVER_HID))
{
- int id = HID_CONSUMER_USAGE_UNASSIGNED;
- button = get_action(CONTEXT_USB_HID, HZ/2);
+ button = get_hid_usb_action();
- switch (button)
+ /* On mode change, we need to refresh the screen */
+ if (button == ACTION_USB_HID_MODE ||
+ button == ACTION_USB_HID_MODE_LONG)
{
- case ACTION_USB_HID_PLAY:
- id = HID_CONSUMER_USAGE_PLAY_PAUSE;
- break;
- case ACTION_USB_HID_STOP:
- id = HID_CONSUMER_USAGE_STOP;
- break;
- case ACTION_USB_HID_SKIPPREV:
- id = HID_CONSUMER_USAGE_SCAN_PREVIOUS_TRACK;
- break;
- case ACTION_USB_HID_SKIPNEXT:
- id = HID_CONSUMER_USAGE_SCAN_NEXT_TRACK;
- break;
- case ACTION_USB_HID_VOLDOWN:
- id = HID_CONSUMER_USAGE_VOLUME_DECREMENT;
- break;
- case ACTION_USB_HID_VOLUP:
- id = HID_CONSUMER_USAGE_VOLUME_INCREMENT;
- break;
- case ACTION_USB_HID_MUTE:
- id = HID_CONSUMER_USAGE_MUTE;
- break;
+ break;
}
-
- if (id != HID_CONSUMER_USAGE_UNASSIGNED)
- usb_hid_send(HID_USAGE_PAGE_CONSUMER, id);
}
else
#endif
@@ -159,7 +132,7 @@ static int handle_usb_events(void)
{
case SYS_USB_DISCONNECTED:
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
- goto Exit;
+ return 1;
case SYS_TIMEOUT:
break;
}
@@ -174,14 +147,12 @@ static int handle_usb_events(void)
}
#endif /* STORAGE_MMC */
}
-Exit:
-#ifdef HAVE_TOUCHSCREEN
- touchscreen_set_mode(old_mode);
-#endif
+
return 0;
}
#endif
+#define MODE_NAME_LEN 32
void usb_screen(void)
{
#ifdef USB_NONE
@@ -190,55 +161,107 @@ void usb_screen(void)
int i;
int usb_bars = VP_SB_ALLSCREENS; /* force statusbars */
int old_bars = viewportmanager_get_statusbar();
+#if defined HAVE_TOUCHSCREEN
+ enum touchscreen_mode old_mode = touchscreen_get_mode();
- FOR_NB_SCREENS(i)
+ /* TODO: Paint buttons on screens OR switch to point mode and use
+ * touchscreen as a touchpad to move the host's mouse cursor */
+ touchscreen_set_mode(TOUCHSCREEN_BUTTON);
+#endif
+
+#ifndef SIMULATOR
+ usb_acknowledge(SYS_USB_CONNECTED_ACK);
+#endif
+
+#ifdef USB_ENABLE_HID
+ usb_keypad_mode = global_settings.usb_keypad_mode;
+#endif
+
+ while (1)
{
- screens[i].backdrop_show(BACKDROP_MAIN);
- screens[i].backlight_on();
- screens[i].clear_display();
-#ifdef HAVE_REMOTE_LCD
- if (i == SCREEN_REMOTE)
+ FOR_NB_SCREENS(i)
{
- screens[i].bitmap(remote_usblogo,
- (LCD_REMOTE_WIDTH-BMPWIDTH_remote_usblogo),
- (LCD_REMOTE_HEIGHT-BMPHEIGHT_remote_usblogo)/2,
- BMPWIDTH_remote_usblogo, BMPHEIGHT_remote_usblogo);
- }
- else
+ screens[i].backdrop_show(BACKDROP_MAIN);
+ screens[i].backlight_on();
+ screens[i].clear_display();
+#ifdef HAVE_REMOTE_LCD
+ if (i == SCREEN_REMOTE)
+ {
+ screens[i].bitmap(remote_usblogo,
+ (LCD_REMOTE_WIDTH-BMPWIDTH_remote_usblogo),
+ (LCD_REMOTE_HEIGHT-BMPHEIGHT_remote_usblogo)/2,
+ BMPWIDTH_remote_usblogo, BMPHEIGHT_remote_usblogo);
+ }
+ else
#endif
- {
+ {
+ char mode_name[MODE_NAME_LEN];
+
#ifdef HAVE_LCD_BITMAP
- screens[i].transparent_bitmap(usblogo,
+ screens[i].transparent_bitmap(usblogo,
(LCD_WIDTH-BMPWIDTH_usblogo),
(LCD_HEIGHT-BMPHEIGHT_usblogo)/2,
- BMPWIDTH_usblogo, BMPHEIGHT_usblogo);
+ BMPWIDTH_usblogo, BMPHEIGHT_usblogo);
+
+#ifdef USB_ENABLE_HID
+ int y, w, h;
+
+ screens[i].getstringsize(str(LANG_USB_KEYPAD_MODE), &w, &h);
+
+ y = (LCD_HEIGHT - BMPHEIGHT_usblogo) / 2 + BMPHEIGHT_usblogo + h;
+ screens[i].putsxy((LCD_WIDTH - w) / 2, y,
+ str(LANG_USB_KEYPAD_MODE));
+ y += 3 * h / 2;
+
+ snprintf(mode_name, MODE_NAME_LEN, "%s",
+ str(keypad_mode_name_get()));
+ screens[i].getstringsize(mode_name, &w, &h);
+ screens[i].putsxy((LCD_WIDTH - w) / 2, y, mode_name);
+#endif /* HID */
+#else /* HAVE_LCD_BITMAP */
+ screens[i].double_height(false);
+#ifdef USB_ENABLE_HID
+ snprintf(mode_name, MODE_NAME_LEN, "[USB Mode; %s]",
+ str(keypad_mode_name_get()));
+ screens[i].puts_scroll(0, 0, mode_name);
#else
- screens[i].double_height(false);
- screens[i].puts_scroll(0, 0, "[USB Mode]");
- status_set_param(false);
- status_set_audio(false);
- status_set_usb(true);
+ screens[i].puts_scroll(0, 0, "[USB Mode]");
+#endif
+ status_set_param(false);
+ status_set_audio(false);
+ status_set_usb(true);
#endif /* HAVE_LCD_BITMAP */
- }
- screens[i].update();
+ }
+ screens[i].update();
- /* force statusbar by ignoring the setting */
- usb_bars |= VP_SB_IGNORE_SETTING(i);
- }
+ /* force statusbar by ignoring the setting */
+ usb_bars |= VP_SB_IGNORE_SETTING(i);
+ }
- viewportmanager_set_statusbar(usb_bars);
+ viewportmanager_set_statusbar(usb_bars);
#ifdef SIMULATOR
- while (1)
- {
if (button_get_w_tmo(HZ/2))
break;
send_event(GUI_EVENT_ACTIONUPDATE, NULL);
- }
#else
- usb_acknowledge(SYS_USB_CONNECTED_ACK);
- while (handle_usb_events());
+ if (handle_usb_events())
+ break;
#endif /* SIMULATOR */
+ }
+
+#ifdef USB_ENABLE_HID
+ if (global_settings.usb_keypad_mode != usb_keypad_mode)
+ {
+ global_settings.usb_keypad_mode = usb_keypad_mode;
+ settings_save();
+ }
+#endif
+
+#ifdef HAVE_TOUCHSCREEN
+ touchscreen_set_mode(old_mode);
+#endif
+
#ifdef HAVE_LCD_CHARCELLS
status_set_usb(false);
#endif /* HAVE_LCD_CHARCELLS */
@@ -248,7 +271,7 @@ void usb_screen(void)
}
viewportmanager_set_statusbar(old_bars);
send_event(GUI_EVENT_REFRESH, NULL);
-
+
#endif /* USB_NONE */
}
diff --git a/apps/settings.h b/apps/settings.h
index ec92a81734..b208ee5872 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -768,7 +768,11 @@ struct user_settings
/* If values are just added to the end, no need to bump plugin API
version. */
/* new stuff to be added at the end */
-
+
+#ifdef USB_ENABLE_HID
+ int usb_keypad_mode;
+#endif
+
#ifdef HAVE_LCD_BITMAP
unsigned char ui_vp_config[64]; /* viewport string for the lists */
#ifdef HAVE_REMOTE_LCD
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 2e3632b949..34e8854421 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1613,6 +1613,13 @@ const struct settings_list settings[] = {
#endif
#endif
+#ifdef USB_ENABLE_HID
+ CHOICE_SETTING(0, usb_keypad_mode, LANG_USB_KEYPAD_MODE, 0,
+ "usb keypad mode", "multimedia,presentation,browser,mouse",
+ NULL, 3, ID2P(LANG_MULTIMEDIA), ID2P(LANG_PRESENTATION),
+ ID2P(LANG_BROWSER), ID2P(LANG_MOUSE)),
+#endif
+
/* Customizable list */
#ifdef HAVE_LCD_BITMAP
VIEWPORT_SETTING(ui_vp_config, "ui viewport"),
diff --git a/apps/usb_keymaps.c b/apps/usb_keymaps.c
new file mode 100644
index 0000000000..c791b11b25
--- /dev/null
+++ b/apps/usb_keymaps.c
@@ -0,0 +1,249 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 Tomer Shalev
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+
+#ifdef USB_ENABLE_HID
+#include "action.h"
+#include "lang.h"
+#include "usbstack/usb_hid.h"
+//#define LOGF_ENABLE
+#include "logf.h"
+
+#define MODIFIER(modifier, key) ((key) | (modifier << 8))
+
+#define ALT(key) MODIFIER(HID_KEYBOARD_LEFT_ALT, key)
+#define CTRL(key) MODIFIER(HID_KEYBOARD_LEFT_CONTROL, key)
+#define SHIFT(key) MODIFIER(HID_KEYBOARD_LEFT_SHIFT, key)
+
+#define NUM_KEY_MAPPINGS (sizeof(hid_key_mappings) / \
+ sizeof(hid_key_mappings[0]))
+
+typedef struct
+{
+ int action;
+ int id;
+} mapping_t;
+
+typedef struct
+{
+ int lang_name;
+ usage_page_t usage_page;
+ mapping_t mapping[];
+} hid_key_mapping_t;
+
+static const hid_key_mapping_t hid_key_mapping_multimedia = {
+ LANG_MULTIMEDIA,
+ HID_USAGE_PAGE_CONSUMER,
+ {
+ /* Volume up */
+ { ACTION_USB_HID_DEC, HID_CONSUMER_USAGE_VOLUME_DECREMENT },
+ /* Volume down */
+ { ACTION_USB_HID_INC, HID_CONSUMER_USAGE_VOLUME_INCREMENT },
+ /* Volume mute */
+ { ACTION_USB_HID_SELECT, HID_CONSUMER_USAGE_MUTE },
+ /* Play / pause */
+ { ACTION_USB_HID_START, HID_CONSUMER_USAGE_PLAY_PAUSE },
+ /* Stop */
+ { ACTION_USB_HID_QUIT, HID_CONSUMER_USAGE_STOP },
+ /* Scan previous track */
+ { ACTION_USB_HID_LEFT, HID_CONSUMER_USAGE_SCAN_PREVIOUS_TRACK },
+ /* Scan next track */
+ { ACTION_USB_HID_RIGHT, HID_CONSUMER_USAGE_SCAN_NEXT_TRACK },
+ { 0, 0 },
+ }
+};
+
+static const hid_key_mapping_t hid_key_mapping_presentation = {
+ LANG_PRESENTATION,
+ HID_USAGE_PAGE_KEYBOARD_KEYPAD,
+ {
+ /* Slideshow start */
+ { ACTION_USB_HID_START, HID_KEYBOARD_F5 },
+ /* Slideshow leave */
+ { ACTION_USB_HID_QUIT, HID_KEYBOARD_ESCAPE },
+ /* Slide previous */
+ { ACTION_USB_HID_LEFT, HID_KEYBOARD_P },
+ /* Slide next */
+ { ACTION_USB_HID_RIGHT, HID_KEYBOARD_N },
+ /* Slide first */
+ { ACTION_USB_HID_LEFT_LONG, HID_KEYBOARD_HOME },
+ /* Slide Last */
+ { ACTION_USB_HID_RIGHT_LONG, HID_KEYBOARD_END },
+ /* Black screen */
+ { ACTION_USB_HID_MENU, HID_KEYBOARD_DOT },
+ /* White screen */
+ { ACTION_USB_HID_MENU_LONG, HID_KEYBOARD_COMMA },
+ /* Link previous */
+ { ACTION_USB_HID_DEC, SHIFT(HID_KEYBOARD_TAB) },
+ /* Link next */
+ { ACTION_USB_HID_INC, HID_KEYBOARD_TAB },
+ /* 'Mouse click' */
+ { ACTION_USB_HID_SELECT, HID_KEYBOARD_RETURN },
+ /* 'Mouse over' */
+ { ACTION_USB_HID_SELECT_LONG, SHIFT(HID_KEYBOARD_RETURN) },
+ { 0, 0 },
+ }
+};
+
+static const hid_key_mapping_t hid_key_mapping_browser = {
+ LANG_BROWSER,
+ HID_USAGE_PAGE_KEYBOARD_KEYPAD,
+ {
+ /* Scroll up */
+ { ACTION_USB_HID_DEC, HID_KEYBOARD_UP_ARROW },
+ /* Scroll down */
+ { ACTION_USB_HID_INC, HID_KEYBOARD_DOWN_ARROW },
+ /* Scroll page up */
+ { ACTION_USB_HID_START, HID_KEYBOARD_PAGE_UP },
+ /* Scroll page down */
+ { ACTION_USB_HID_MENU, HID_KEYBOARD_PAGE_DOWN },
+ /* Zoom in */
+ { ACTION_USB_HID_START_LONG, CTRL(HID_KEYPAD_PLUS) },
+ /* Zoom out */
+ { ACTION_USB_HID_MENU_LONG, CTRL(HID_KEYPAD_MINUS) },
+ /* Zoom reset */
+ { ACTION_USB_HID_SELECT_LONG, CTRL(HID_KEYPAD_0_AND_INSERT) },
+ /* Tab previous */
+ { ACTION_USB_HID_LEFT, CTRL(HID_KEYBOARD_PAGE_UP) },
+ /* Tab next */
+ { ACTION_USB_HID_RIGHT, CTRL(HID_KEYBOARD_PAGE_DOWN) },
+ /* Tab close */
+ { ACTION_USB_HID_QUIT_LONG, CTRL(HID_KEYBOARD_W) },
+ /* History back */
+ { ACTION_USB_HID_LEFT_LONG, ALT(HID_KEYBOARD_LEFT_ARROW) },
+ /* History forward */
+ { ACTION_USB_HID_RIGHT_LONG, ALT(HID_KEYBOARD_RIGHT_ARROW) },
+ /* Full-Screen */
+ { ACTION_USB_HID_SELECT, HID_KEYBOARD_F11 },
+ { 0, 0 },
+ }
+};
+
+#ifdef HAVE_USB_HID_MOUSE
+static const hid_key_mapping_t hid_key_mapping_mouse = {
+ LANG_MOUSE,
+ HID_USAGE_PAGE_GENERIC_DESKTOP_CONTROLS,
+ {
+ /* Mouse up */
+ { ACTION_USB_HID_MOUSE_UP, HID_MOUSE_UP },
+ { ACTION_USB_HID_MOUSE_UP_REP, HID_MOUSE_UP_REP },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP, HID_MOUSE_LDRAG_UP },
+ { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, HID_MOUSE_LDRAG_UP_REP },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP, HID_MOUSE_RDRAG_UP },
+ { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, HID_MOUSE_RDRAG_UP_REP },
+ /* Mouse down */
+ { ACTION_USB_HID_MOUSE_DOWN, HID_MOUSE_DOWN },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, HID_MOUSE_DOWN_REP },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN, HID_MOUSE_LDRAG_DOWN },
+ { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, HID_MOUSE_LDRAG_DOWN_REP },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN, HID_MOUSE_RDRAG_DOWN },
+ { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, HID_MOUSE_RDRAG_DOWN_REP },
+ /* Mouse left */
+ { ACTION_USB_HID_MOUSE_LEFT, HID_MOUSE_LEFT },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, HID_MOUSE_LEFT_REP },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT, HID_MOUSE_LDRAG_LEFT },
+ { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, HID_MOUSE_LDRAG_LEFT_REP },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT, HID_MOUSE_RDRAG_LEFT },
+ { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, HID_MOUSE_RDRAG_LEFT_REP },
+ /* Mouse right */
+ { ACTION_USB_HID_MOUSE_RIGHT, HID_MOUSE_RIGHT },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, HID_MOUSE_RIGHT_REP },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, HID_MOUSE_LDRAG_RIGHT },
+ { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, HID_MOUSE_LDRAG_RIGHT_REP },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, HID_MOUSE_RDRAG_RIGHT },
+ { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, HID_MOUSE_RDRAG_RIGHT_REP },
+ /* Mouse buttons */
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, HID_MOUSE_BUTTON_LEFT },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, HID_MOUSE_BUTTON_LEFT_REL },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, HID_MOUSE_BUTTON_RIGHT },
+ { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, HID_MOUSE_BUTTON_RIGHT_REL },
+ /* Mouse wheel scroll up */
+ { ACTION_USB_HID_DEC, HID_MOUSE_SCROLL_UP },
+ /* Mouse wheel scroll down */
+ { ACTION_USB_HID_INC, HID_MOUSE_SCROLL_DOWN },
+ { 0, 0 },
+ }
+};
+
+#define USB_KEYPAD_MODE_MOUSE 3 /* Value of the mouse setting (hard-coded) */
+#endif /* HAVE_USB_HID_MOUSE */
+
+static const hid_key_mapping_t *hid_key_mappings[] =
+{
+ &hid_key_mapping_multimedia,
+ &hid_key_mapping_presentation,
+ &hid_key_mapping_browser,
+#ifdef HAVE_USB_HID_MOUSE
+ &hid_key_mapping_mouse,
+#endif
+};
+
+extern int usb_keypad_mode;
+
+int get_hid_usb_action(void)
+{
+ int action, context = CONTEXT_USB_HID;
+
+#ifdef HAVE_USB_HID_MOUSE
+ if (usb_keypad_mode == USB_KEYPAD_MODE_MOUSE)
+ context = CONTEXT_USB_HID_MOUSE;
+#endif
+
+ action = get_action(context, HZ/4);
+ /* Skip key mappings in a cyclic way */
+ if (action == ACTION_USB_HID_MODE)
+ {
+ usb_keypad_mode = (usb_keypad_mode + 1) % NUM_KEY_MAPPINGS;
+ }
+ else if (action == ACTION_USB_HID_MODE_LONG)
+ {
+ usb_keypad_mode = (usb_keypad_mode - 1) % NUM_KEY_MAPPINGS;
+ }
+ else if (action > ACTION_USB_HID_FIRST && action < ACTION_USB_HID_LAST)
+ {
+ const mapping_t *mapping;
+ const hid_key_mapping_t *key_mapping =
+ hid_key_mappings[usb_keypad_mode];
+
+ for (mapping = key_mapping->mapping; mapping->action; mapping++)
+ {
+ if (action == mapping->action)
+ {
+ logf("Action %d", action);
+ usb_hid_send(key_mapping->usage_page, mapping->id);
+ break;
+ }
+ }
+#ifdef DEBUG
+ if (!mapping->action)
+ logf("Action %d not found", action);
+#endif
+ }
+
+ return action;
+}
+
+int keypad_mode_name_get(void)
+{
+ return hid_key_mappings[usb_keypad_mode]->lang_name;
+}
+
+#endif
diff --git a/apps/usb_keymaps.h b/apps/usb_keymaps.h
new file mode 100644
index 0000000000..8b08bfda2d
--- /dev/null
+++ b/apps/usb_keymaps.h
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 Tomer Shalev
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef _USB_KEYMAPS_H_
+#define _USB_KEYMAPS_H_
+
+int get_hid_usb_action(void);
+
+int keypad_mode_name_get(void);
+
+#endif