Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ibasso: Use correct API to query power input and charging state

Instead of using the generic hosted sysfs code, which expects
a full path, the ibasso code's sysfs code uses an enumeration.
Unfortunatley the generic power input/charging code used the former
API but linked with the latter. oops.

Correct this by placing a private copy of these functions in
the ibasso-specific port, and removing the generic version from
that build.

(A "proper" fix would be to rework all 17 of the ibasso sysfs calls
to use the generic sysfs API)

Change-Id: Ic13adc9782d85560f0c74d77f60a629619d38668

+28 -9
-1
firmware/SOURCES
··· 2032 2032 target/hosted/ibasso/audiohw-ibasso.c 2033 2033 target/hosted/ibasso/backlight-ibasso.c 2034 2034 target/hosted/ibasso/button-ibasso.c 2035 - target/hosted/power-linux.c 2036 2035 #ifdef DEBUG 2037 2036 target/hosted/ibasso/debug-ibasso.c 2038 2037 #endif
-4
firmware/export/config/ibassodx50.h
··· 140 140 #define NUM_DRIVES 2 141 141 #define HAVE_HOTSWAP 142 142 #define MULTIDRIVE_DIR "/mnt/external_sd" 143 - 144 - /* More common stuff */ 145 - #define BATTERY_DEV_NAME "battery" 146 - #define POWER_DEV_NAME "usb"
-4
firmware/export/config/ibassodx90.h
··· 137 137 #define NUM_DRIVES 2 138 138 #define HAVE_HOTSWAP 139 139 #define MULTIDRIVE_DIR "/mnt/external_sd" 140 - 141 - /* More common stuff */ 142 - #define BATTERY_DEV_NAME "battery" 143 - #define POWER_DEV_NAME "usb"
+28
firmware/target/hosted/ibasso/powermgmt-ibasso.c
··· 112 112 113 113 return(val / 1000); 114 114 } 115 + 116 + /* NOTE: This is largely lifted from the generic hostedpower-linux.c 117 + but that uses a different sysfs api (expecting a path strning rather than 118 + an enumeration */ 119 + #include "tick.h" 120 + #include "power.h" 121 + 122 + static long last_tick = 0; 123 + static bool last_power = false; 124 + bool charging_state(void) 125 + { 126 + if ((current_tick - last_tick) > HZ/2 ) { 127 + char buf[12] = {0}; 128 + sysfs_get_string(SYSFS_BATTERY_STATUS, buf, sizeof(buf)); 129 + 130 + last_tick = current_tick; 131 + last_power = (strncmp(buf, "Charging", 8) == 0); 132 + } 133 + return last_power; 134 + } 135 + 136 + unsigned int power_input_status(void) 137 + { 138 + int present = 0; 139 + sysfs_get_int(SYSFS_USB_POWER_ONLINE, &present); 140 + 141 + return present ? POWER_INPUT_USB_CHARGER : POWER_INPUT_NONE; 142 + }