Add HID keymap handling in usb screen. This allows to use the DAP as a keypad to control the PC. The current keymaps are audio-oriented (play/pause/volume/...) (FS#10218 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21054 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c61a75173b
commit
08fb988e87
14 changed files with 422 additions and 11 deletions
|
@ -74,6 +74,7 @@ enum {
|
||||||
CONTEXT_RECSCREEN,
|
CONTEXT_RECSCREEN,
|
||||||
CONTEXT_KEYBOARD,
|
CONTEXT_KEYBOARD,
|
||||||
CONTEXT_FM,
|
CONTEXT_FM,
|
||||||
|
CONTEXT_USB_HID,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,6 +238,15 @@ enum {
|
||||||
ACTION_TOUCH_REPMODE,
|
ACTION_TOUCH_REPMODE,
|
||||||
#endif
|
#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_MENU,
|
||||||
|
|
||||||
LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */
|
LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */
|
||||||
};
|
};
|
||||||
|
|
|
@ -269,6 +269,19 @@ static const struct button_mapping button_context_bmark[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
}; /* button_context_bmark */
|
}; /* button_context_bmark */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
static const struct button_mapping button_context_usb_hid[] = {
|
||||||
|
{ ACTION_USB_HID_PLAY, BUTTON_VOLUP, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_STOP, BUTTON_VOLUP|BUTTON_REPEAT, 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_MENU, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +330,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
#endif
|
#endif
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,23 @@ static const struct button_mapping button_context_bmark[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
}; /* button_context_bmark */
|
}; /* button_context_bmark */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
static const struct button_mapping button_context_usb_hid[] = {
|
||||||
|
{ ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_STOP, BUTTON_UP|BUTTON_REPEAT, 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_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
|
@ -330,7 +347,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
#endif
|
#endif
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,6 +265,23 @@ static const struct button_mapping button_context_bmark[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
}; /* button_context_bmark */
|
}; /* button_context_bmark */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +327,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_recscreen;
|
return button_context_recscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,23 @@ static const struct button_mapping button_context_bmark[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
}; /* button_context_bmark */
|
}; /* button_context_bmark */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
|
@ -318,7 +335,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_recscreen;
|
return button_context_recscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,6 +464,42 @@ static const struct button_mapping remote_button_context_right_is_inc[] = {
|
||||||
LAST_ITEM_IN_LIST
|
LAST_ITEM_IN_LIST
|
||||||
}; /* remote_button_context_right_is_inc */
|
}; /* remote_button_context_right_is_inc */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
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_POWER, 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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* remote_button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct button_mapping* get_context_mapping_remote( int context )
|
static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
{
|
{
|
||||||
context &= ~CONTEXT_REMOTE;
|
context &= ~CONTEXT_REMOTE;
|
||||||
|
@ -506,6 +542,10 @@ static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
case CONTEXT_FM:
|
case CONTEXT_FM:
|
||||||
return remote_button_context_radio;
|
return remote_button_context_radio;
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return remote_button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return remote_button_context_standard;
|
return remote_button_context_standard;
|
||||||
}
|
}
|
||||||
|
@ -573,6 +613,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
case CONTEXT_FM:
|
case CONTEXT_FM:
|
||||||
return button_context_radio;
|
return button_context_radio;
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,6 +332,61 @@ static const struct button_mapping button_context_radio[] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static const struct button_mapping remote_button_context_wps[] = {
|
||||||
|
{ ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
|
||||||
|
{ ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT,BUTTON_RC_PLAY },
|
||||||
|
{ ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW},
|
||||||
|
{ ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
|
||||||
|
{ ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
|
||||||
|
{ ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
|
||||||
|
|
||||||
|
{ ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_WPS_PITCHSCREEN, BUTTON_RC_PLAY|BUTTON_LEFT, BUTTON_RC_PLAY },
|
||||||
|
{ ACTION_WPS_ID3SCREEN, BUTTON_RC_PLAY|BUTTON_RIGHT, BUTTON_RC_PLAY },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* remote_button_context_wps */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
static const struct button_mapping button_context_usb_hid[] = {
|
||||||
|
{ ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ 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 },
|
||||||
|
|
||||||
|
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_SCROLL_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLUP, BUTTON_RC_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_SCROLL_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* remote_button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct button_mapping* get_context_mapping_remote( int context )
|
static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
{
|
{
|
||||||
context ^= CONTEXT_REMOTE;
|
context ^= CONTEXT_REMOTE;
|
||||||
|
@ -361,6 +416,10 @@ static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
return remote_button_context_pitchscreen;
|
return remote_button_context_pitchscreen;
|
||||||
case CONTEXT_RECSCREEN:
|
case CONTEXT_RECSCREEN:
|
||||||
return button_context_recscreen;
|
return button_context_recscreen;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return remote_button_context_usb_hid;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return remote_button_context_standard;
|
return remote_button_context_standard;
|
||||||
|
@ -415,6 +474,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_recscreen;
|
return button_context_recscreen;
|
||||||
case CONTEXT_FM:
|
case CONTEXT_FM:
|
||||||
return button_context_radio;
|
return button_context_radio;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,27 @@ static const struct button_mapping button_context_radio[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
switch (context)
|
switch (context)
|
||||||
|
@ -328,6 +349,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
case CONTEXT_FM:
|
case CONTEXT_FM:
|
||||||
return button_context_radio;
|
return button_context_radio;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
|
|
|
@ -188,6 +188,23 @@ const struct button_mapping button_context_recscreen[] = {
|
||||||
}; /* button_context_recscreen */
|
}; /* button_context_recscreen */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
static const struct button_mapping button_context_usb_hid[] = {
|
||||||
|
{ ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, 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_MENU, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BUTTON_REMOTE != 0
|
#if BUTTON_REMOTE != 0
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Remote control mappings
|
* Remote control mappings
|
||||||
|
@ -220,6 +237,20 @@ static const struct button_mapping remote_button_context_wps[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* remote_button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct button_mapping* get_context_mapping_remote( int context )
|
static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
{
|
{
|
||||||
|
@ -229,7 +260,10 @@ static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
{
|
{
|
||||||
case CONTEXT_WPS:
|
case CONTEXT_WPS:
|
||||||
return remote_button_context_wps;
|
return remote_button_context_wps;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return remote_button_context_usb_hid;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return remote_button_context_standard;
|
return remote_button_context_standard;
|
||||||
}
|
}
|
||||||
|
@ -281,6 +315,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
case CONTEXT_RECSCREEN:
|
case CONTEXT_RECSCREEN:
|
||||||
return button_context_recscreen;
|
return button_context_recscreen;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
|
|
|
@ -313,6 +313,37 @@ static const struct button_mapping remote_button_context_tree[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
|
||||||
|
|
||||||
|
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_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLUP, BUTTON_RC_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_MENU, BUTTON_RC_FAV, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* remote_button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct button_mapping* get_context_mapping_remote( int context )
|
static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
{
|
{
|
||||||
context ^= CONTEXT_REMOTE;
|
context ^= CONTEXT_REMOTE;
|
||||||
|
@ -324,6 +355,10 @@ static const struct button_mapping* get_context_mapping_remote( int context )
|
||||||
case CONTEXT_MAINMENU:
|
case CONTEXT_MAINMENU:
|
||||||
case CONTEXT_TREE:
|
case CONTEXT_TREE:
|
||||||
return remote_button_context_tree;
|
return remote_button_context_tree;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return remote_button_context_usb_hid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return remote_button_context_standard;
|
return remote_button_context_standard;
|
||||||
}
|
}
|
||||||
|
@ -374,6 +409,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_pitchscreen;
|
return button_context_pitchscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,19 @@ static const struct button_mapping button_context_keyboard[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||||
}; /* button_context_keyboard */
|
}; /* button_context_keyboard */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct button_mapping* target_get_context_mapping(int context)
|
const struct button_mapping* target_get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
switch (context)
|
switch (context)
|
||||||
|
@ -196,6 +209,10 @@ const struct button_mapping* target_get_context_mapping(int context)
|
||||||
return button_context_pitchscreen;
|
return button_context_pitchscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,27 @@ static const struct button_mapping button_context_keyboard[] = {
|
||||||
LAST_ITEM_IN_LIST
|
LAST_ITEM_IN_LIST
|
||||||
}; /* button_context_keyboard */
|
}; /* button_context_keyboard */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
static const struct button_mapping button_context_usb_hid[] = {
|
||||||
|
{ ACTION_USB_HID_PLAY, BUTTON_RIGHT, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE },
|
||||||
|
{ ACTION_USB_HID_SKIPNEXT, BUTTON_FFWD, 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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
switch (context)
|
switch (context)
|
||||||
|
@ -312,6 +333,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_pitchscreen;
|
return button_context_pitchscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,18 @@ static const struct button_mapping button_context_radio[] = {
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM)
|
||||||
}; /* button_context_radio */
|
}; /* button_context_radio */
|
||||||
|
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
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 },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_USB_HID)
|
||||||
|
}; /* button_context_usb_hid */
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct button_mapping* get_context_mapping(int context)
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
{
|
{
|
||||||
if (context & CONTEXT_CUSTOM2
|
if (context & CONTEXT_CUSTOM2
|
||||||
|
@ -297,6 +309,10 @@ const struct button_mapping* get_context_mapping(int context)
|
||||||
return button_context_pitchscreen;
|
return button_context_pitchscreen;
|
||||||
case CONTEXT_KEYBOARD:
|
case CONTEXT_KEYBOARD:
|
||||||
return button_context_keyboard;
|
return button_context_keyboard;
|
||||||
|
#ifdef HAVE_USBSTACK
|
||||||
|
case CONTEXT_USB_HID:
|
||||||
|
return button_context_usb_hid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return button_context_standard;
|
return button_context_standard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
|
#if defined(HAVE_USBSTACK)
|
||||||
|
#include "usb_core.h"
|
||||||
|
#ifdef USB_CLASS_HID
|
||||||
|
#include "usbstack/usb_hid.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
@ -90,23 +96,70 @@ static int clamp_value_wrap(int value, int max, int min)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
static int handle_usb_events(struct event_queue *q)
|
static int handle_usb_events(void)
|
||||||
{
|
{
|
||||||
struct queue_event ev;
|
|
||||||
int next_update=0;
|
int next_update=0;
|
||||||
|
#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 */
|
/* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
queue_wait_w_tmo(q, &ev, HZ/4);
|
int button;
|
||||||
switch(ev.id)
|
#if defined(HAVE_USBSTACK) && defined(USB_CLASS_HID)
|
||||||
|
bool hid_enabled = usb_core_driver_enabled(USB_DRIVER_HID);
|
||||||
|
|
||||||
|
if (hid_enabled)
|
||||||
|
{
|
||||||
|
consumer_usage_page_t cmd = UNASSIGNED;
|
||||||
|
button = get_action(CONTEXT_USB_HID, HZ/4);
|
||||||
|
|
||||||
|
switch (button)
|
||||||
|
{
|
||||||
|
case ACTION_USB_HID_PLAY:
|
||||||
|
cmd = PLAY_PAUSE;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_STOP:
|
||||||
|
cmd = STOP;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_SKIPPREV:
|
||||||
|
cmd = SCAN_PREVIOUS_TRACK;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_SKIPNEXT:
|
||||||
|
cmd = SCAN_NEXT_TRACK;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_VOLDOWN:
|
||||||
|
cmd = VOLUME_DECREMENT;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_VOLUP:
|
||||||
|
cmd = VOLUME_INCREMENT;
|
||||||
|
break;
|
||||||
|
case ACTION_USB_HID_MUTE:
|
||||||
|
cmd = MUTE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd != UNASSIGNED)
|
||||||
|
usb_hid_send_consumer_usage(cmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
button = button_get_w_tmo(HZ/4);
|
||||||
|
|
||||||
|
switch(button)
|
||||||
{
|
{
|
||||||
case SYS_USB_DISCONNECTED:
|
case SYS_USB_DISCONNECTED:
|
||||||
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
|
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
|
||||||
return 0;
|
goto Exit;
|
||||||
case SYS_TIMEOUT:
|
case SYS_TIMEOUT:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TIME_AFTER(current_tick,next_update))
|
if(TIME_AFTER(current_tick,next_update))
|
||||||
{
|
{
|
||||||
if(usb_inserted()) {
|
if(usb_inserted()) {
|
||||||
|
@ -118,6 +171,11 @@ static int handle_usb_events(struct event_queue *q)
|
||||||
next_update=current_tick+HZ/2;
|
next_update=current_tick+HZ/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Exit:
|
||||||
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
touchscreen_set_mode(old_mode);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -172,7 +230,7 @@ void usb_screen(void)
|
||||||
while (button_get(true) & BUTTON_REL);
|
while (button_get(true) & BUTTON_REL);
|
||||||
#else
|
#else
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
||||||
while(handle_usb_events(&button_queue));
|
while (handle_usb_events());
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
status_set_usb(false);
|
status_set_usb(false);
|
||||||
|
|
Loading…
Reference in a new issue