forked from len0rd/rockbox
[Feature] Simulator add headphone and lineout toggling
Change-Id: I0b019414643e5c9037c0128093488da49e1a4c0d
This commit is contained in:
parent
7ec1151ddd
commit
aca41be3ca
4 changed files with 52 additions and 15 deletions
|
|
@ -320,6 +320,26 @@ static void button_event(int key, bool pressed)
|
||||||
sim_trigger_usb(usb_connected);
|
sim_trigger_usb(usb_connected);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
#ifdef HAVE_HEADPHONE_DETECTION
|
||||||
|
case SDLK_p:
|
||||||
|
if (!pressed)
|
||||||
|
{
|
||||||
|
static bool hp_connected = false;
|
||||||
|
hp_connected = !hp_connected;
|
||||||
|
sim_trigger_hp(hp_connected);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LINEOUT_DETECTION
|
||||||
|
case SDLK_l:
|
||||||
|
if (!pressed)
|
||||||
|
{
|
||||||
|
static bool lo_connected = false;
|
||||||
|
lo_connected = !lo_connected;
|
||||||
|
sim_trigger_lo(lo_connected);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_MULTIDRIVE
|
#ifdef HAVE_MULTIDRIVE
|
||||||
case EXT_KEY:
|
case EXT_KEY:
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,32 @@ void sim_trigger_screendump(void)
|
||||||
queue_post(&sim_queue, SIM_SCREENDUMP, 0);
|
queue_post(&sim_queue, SIM_SCREENDUMP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HEADPHONE_DETECTION
|
||||||
|
static bool is_hp_inserted = true;
|
||||||
|
bool headphones_inserted(void)
|
||||||
|
{
|
||||||
|
return is_hp_inserted;
|
||||||
|
}
|
||||||
|
void sim_trigger_hp(bool inserted)
|
||||||
|
{
|
||||||
|
is_hp_inserted = inserted;
|
||||||
|
DEBUGF("Headphone %s.\n", inserted ? "inserted":"removed");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LINEOUT_DETECTION
|
||||||
|
static bool is_lo_inserted = false;
|
||||||
|
bool lineout_inserted(void)
|
||||||
|
{
|
||||||
|
return is_lo_inserted;
|
||||||
|
}
|
||||||
|
void sim_trigger_lo(bool inserted)
|
||||||
|
{
|
||||||
|
is_lo_inserted = inserted;
|
||||||
|
DEBUGF("Lineout %s.\n", inserted ? "inserted":"removed");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool is_usb_inserted;
|
static bool is_usb_inserted;
|
||||||
void sim_trigger_usb(bool inserted)
|
void sim_trigger_usb(bool inserted)
|
||||||
{
|
{
|
||||||
|
|
@ -157,8 +183,10 @@ void sim_trigger_usb(bool inserted)
|
||||||
{
|
{
|
||||||
send_event(SYS_EVENT_USB_EXTRACTED, NULL);
|
send_event(SYS_EVENT_USB_EXTRACTED, NULL);
|
||||||
queue_post(&sim_queue, SIM_USB_EXTRACTED, 0);
|
queue_post(&sim_queue, SIM_USB_EXTRACTED, 0);
|
||||||
|
DEBUGF("USB %s.\n", inserted ? "inserted":"removed");
|
||||||
}
|
}
|
||||||
is_usb_inserted = inserted;
|
is_usb_inserted = inserted;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_detect(void)
|
int usb_detect(void)
|
||||||
|
|
@ -204,6 +232,8 @@ void sim_trigger_external(bool inserted)
|
||||||
queue_post(&sim_queue, SIM_EXT_INSERTED, drive);
|
queue_post(&sim_queue, SIM_EXT_INSERTED, drive);
|
||||||
else
|
else
|
||||||
queue_post(&sim_queue, SIM_EXT_EXTRACTED, drive);
|
queue_post(&sim_queue, SIM_EXT_EXTRACTED, drive);
|
||||||
|
|
||||||
|
DEBUGF("Ext %s\n", inserted ? "inserted":"removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hostfs_present(int drive)
|
bool hostfs_present(int drive)
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,6 @@ void sim_tasks_init(void);
|
||||||
void sim_trigger_screendump(void);
|
void sim_trigger_screendump(void);
|
||||||
void sim_trigger_usb(bool inserted);
|
void sim_trigger_usb(bool inserted);
|
||||||
void sim_trigger_external(bool inserted);
|
void sim_trigger_external(bool inserted);
|
||||||
|
void sim_trigger_hp(bool inserted);
|
||||||
|
void sim_trigger_lo(bool inserted);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -172,20 +172,6 @@ bool rtc_check_alarm_flag(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_HEADPHONE_DETECTION
|
|
||||||
bool headphones_inserted(void)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LINEOUT_DETECTION
|
|
||||||
bool lineout_inserted(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SPDIF_POWER
|
#ifdef HAVE_SPDIF_POWER
|
||||||
void spdif_power_enable(bool on)
|
void spdif_power_enable(bool on)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue