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
|
|
@ -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