mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
xduoox3ii/x20: Proper lineout detection and volume mangling.
hotplugging hp and lineout works, without blowing out eardrums. Change-Id: I2df5c7a618bb2d1d77d416548d45dff9cfc619db
This commit is contained in:
parent
6d47dc9a88
commit
b030bf5885
10 changed files with 80 additions and 48 deletions
|
|
@ -41,6 +41,13 @@ bool dbg_hw_info(void)
|
|||
line = 0;
|
||||
|
||||
lcd_putsf(0, line++, "pcm srate: %d", pcm_alsa_get_rate());
|
||||
#ifdef HAVE_HEADPHONE_DETECTION
|
||||
lcd_putsf(0, line++, "hp: %d", headphones_inserted());
|
||||
#endif
|
||||
#ifdef HAVE_LINEOUT_DETECTION
|
||||
lcd_putsf(0, line++, "lo: %d", lineout_inserted());
|
||||
#endif
|
||||
|
||||
btn = button_read_device();
|
||||
|
||||
lcd_update();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2016 Amaury Pouly
|
||||
*
|
||||
|
|
|
|||
|
|
@ -166,25 +166,16 @@ int button_read_device(void)
|
|||
|
||||
bool headphones_inserted(void)
|
||||
{
|
||||
int status = 0;
|
||||
const char * const sysfs_lo_switch = "/sys/class/switch/lineout/state";
|
||||
const char * const sysfs_hs_switch = "/sys/class/switch/headset/state";
|
||||
#ifdef XDUOO_X20
|
||||
const char * const sysfs_bal_switch = "/sys/class/switch/balance/state";
|
||||
#endif
|
||||
int ps = xduoo_get_outputs();
|
||||
|
||||
sysfs_get_int(sysfs_lo_switch, &status);
|
||||
if (status) return true;
|
||||
return (ps == 2 || ps == 3);
|
||||
}
|
||||
|
||||
sysfs_get_int(sysfs_hs_switch, &status);
|
||||
if (status) return true;
|
||||
bool lineout_inserted(void)
|
||||
{
|
||||
int ps = xduoo_get_outputs();
|
||||
|
||||
#ifdef XDUOO_X20
|
||||
sysfs_get_int(sysfs_bal_switch, &status);
|
||||
if (status) return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
return (ps == 1);
|
||||
}
|
||||
|
||||
void button_close_device(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue