diff -durN rockbox-devel-orig/apps/debug_menu.c rockbox-devel/apps/debug_menu.c
--- rockbox-devel-orig/apps/debug_menu.c	2003-05-26 14:01:50.000000000 +0100
+++ rockbox-devel/apps/debug_menu.c	2003-06-13 13:53:03.000000000 +0100
@@ -799,9 +799,9 @@
                 snprintf(buf, 30, "Charger: %s", 
                          charger_inserted() ? "present" : "absent");
                 lcd_puts(0, 3, buf);
-#ifdef HAVE_CHARGE_CTRL
+#ifdef HAVE_CHARGE_DETECT
                 snprintf(buf, 30, "Charging: %s", 
-                         charger_enabled ? "yes" : "no");
+                         charger_is_enabled() ? "yes" : "no");
                 lcd_puts(0, 4, buf);
 #endif                
                 y = ( power_history[POWER_HISTORY_LEN-1] * 100
@@ -845,7 +845,7 @@
                 lcd_clear_display();
 
 #ifdef HAVE_CHARGE_CTRL
-                snprintf(buf, 30, "charge_state: %d", charge_state);
+                snprintf(buf, 30, "charge_state: %d", charger_status());
                 lcd_puts(0, 0, buf);
 
                 snprintf(buf, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min);
diff -durN rockbox-devel-orig/apps/main_menu.c rockbox-devel/apps/main_menu.c
--- rockbox-devel-orig/apps/main_menu.c	2003-06-08 23:02:16.000000000 +0100
+++ rockbox-devel/apps/main_menu.c	2003-06-13 13:53:03.000000000 +0100
@@ -189,11 +189,11 @@
             lcd_puts(0, y++, s);
             
 #ifdef HAVE_CHARGE_CTRL
-            if (charge_state == 1)
+            if (charger_status() == 1)
                 snprintf(s, sizeof(s), str(LANG_BATTERY_CHARGE));
-            else if (charge_state == 2)
+            else if (charger_status() == 2)
                 snprintf(s, sizeof(s), str(LANG_BATTERY_TOPOFF_CHARGE));
-            else if (charge_state == 3)
+            else if (charger_status() == 3)
                 snprintf(s, sizeof(s), str(LANG_BATTERY_TRICKLE_CHARGE));
             else
 #endif
diff -durN rockbox-devel-orig/apps/recorder/icons.c rockbox-devel/apps/recorder/icons.c
--- rockbox-devel-orig/apps/recorder/icons.c	2003-05-05 23:04:33.000000000 +0100
+++ rockbox-devel/apps/recorder/icons.c	2003-06-13 13:53:03.000000000 +0100
@@ -27,6 +27,7 @@
 #include "settings.h"
 
 #include "icons.h"
+#include "usb.h"
 
 unsigned char slider_bar[] =
 {
@@ -158,12 +159,13 @@
 #ifdef SIMULATOR
     if (global_settings.battery_type) {
 #else
-#ifdef HAVE_CHARGE_CTRL /* Recorder */
+#ifdef HAVE_CHARGE_DETECT /* Recorder & FM */
     /* show graphical animation when charging instead of numbers */
-    if ((global_settings.battery_type) && (charge_state != 1)) {
-#else /* FM */
+    if (((global_settings.battery_type) && (charger_status() != 1)) ||
+                    usb_inserted()) {
+#else
     if (global_settings.battery_type) {
-#endif /* HAVE_CHARGE_CTRL */
+#endif /* HAVE_CHARGE_DETECT */
 #endif
         /* Numeric display */
         snprintf(buffer, sizeof(buffer), "%3d", percent);
diff -durN rockbox-devel-orig/apps/screens.c rockbox-devel/apps/screens.c
--- rockbox-devel-orig/apps/screens.c	2003-05-31 14:18:04.000000000 +0100
+++ rockbox-devel/apps/screens.c	2003-06-13 13:53:03.000000000 +0100
@@ -31,6 +31,7 @@
 #include "status.h"
 #include "playlist.h"
 #include "sprintf.h"
+#include "powermgmt.h"
 
 #ifdef HAVE_LCD_BITMAP
 #define BMPHEIGHT_usb_logo 32
@@ -73,9 +74,20 @@
 
 void usb_display_info(void)
 {
-    lcd_clear_display();
+    unsigned char buffer[7];
+#ifdef HAVE_LCD_BITMAP
+    unsigned int width, height;
+#endif
+    int runtime = battery_time();
+    int hour = runtime / 60;
+    int minute = runtime % 60;
+
+    snprintf(buffer, sizeof(buffer), "%2dh%02dm", hour, minute);
 
 #ifdef HAVE_LCD_BITMAP
+    lcd_getstringsize(buffer, &width, &height);
+    lcd_clear_display();
+
     /* lcd_bitmap() only supports 16 pixels height! */
     lcd_bitmap(usb_logo, 6, 16,
                BMPWIDTH_usb_logo, 8, false);
@@ -86,9 +98,11 @@
     lcd_bitmap(usb_logo+BMPWIDTH_usb_logo*3, 6, 40,
                BMPWIDTH_usb_logo, 8, false);
     status_draw(true);
+    lcd_putsxy(0, LCD_HEIGHT - height, buffer);
     lcd_update();
 #else
     lcd_puts(0, 0, "[USB Mode]");
+    lcd_puts(0, 1, buffer);
     status_set_param(false);
     status_set_audio(false);
     status_set_usb(true);
diff -durN rockbox-devel-orig/apps/status.c rockbox-devel/apps/status.c
--- rockbox-devel-orig/apps/status.c	2003-06-08 23:02:17.000000000 +0100
+++ rockbox-devel/apps/status.c	2003-06-13 14:04:51.000000000 +0100
@@ -33,6 +33,7 @@
 #include "icons.h"
 #endif
 #include "powermgmt.h"
+#include "usb.h"
 
 static enum playmode current_mode = STATUS_STOP;
 
@@ -135,22 +136,27 @@
         if (info.inserted) {
             battery_state = true;
             plug_state = true;
-#ifdef HAVE_CHARGE_CTRL
+#ifdef HAVE_CHARGE_DETECT
             /* zero battery run time if charging */
-            if (charge_state > 0)
+            if (charger_status() > 0)
                 global_settings.runtime = 0;
             
             /* animate battery if charging */
-            if (charge_state == 1) {
+            if (charger_status() == 1) {
 #else
             {
 #endif
-                /* animate in three steps (34% per step for a better look) */
-                info.battlevel = battery_charge_step * 34;
-                if (info.battlevel > 100)
-                    info.battlevel = 100;
+                if (!usb_inserted()) {
+                    /* animate in three steps (34% per step for a better look) */
+                    info.battlevel = battery_charge_step * 34;
+                    if (info.battlevel > 100)
+                        info.battlevel = 100;
+                }
                 if(TIME_AFTER(current_tick, switch_tick)) {
                     battery_charge_step=(battery_charge_step+1)%4;
+                    if (usb_inserted()) {
+                        plug_state = battery_charge_step%2;
+                    }
                     switch_tick = current_tick + HZ;
                 }
             }
@@ -171,19 +177,21 @@
 #ifdef HAVE_LCD_BITMAP
         if (battery_state)
             statusbar_icon_battery(info.battlevel, plug_state);
-        statusbar_icon_volume(info.volume);
-        statusbar_icon_play_state(current_mode + Icon_Play);
-        switch (info.repeat) {
-            case REPEAT_ONE:
-                statusbar_icon_play_mode(Icon_RepeatOne);
-                break;
+        if (!usb_inserted()) {
+            statusbar_icon_volume(info.volume);
+            statusbar_icon_play_state(current_mode + Icon_Play);
+            switch (info.repeat) {
+                case REPEAT_ONE:
+                    statusbar_icon_play_mode(Icon_RepeatOne);
+                    break;
 
-            case REPEAT_ALL:
-                statusbar_icon_play_mode(Icon_Repeat);
-                break;
+                case REPEAT_ALL:
+                    statusbar_icon_play_mode(Icon_Repeat);
+                    break;
+            }
+            if (info.shuffle)
+                statusbar_icon_shuffle();
         }
-        if (info.shuffle)
-            statusbar_icon_shuffle();
         if (info.keylock)
             statusbar_icon_lock();
 #ifdef HAVE_RTC
diff -durN rockbox-devel-orig/apps/tree.c rockbox-devel/apps/tree.c
--- rockbox-devel-orig/apps/tree.c	2003-06-08 23:02:18.000000000 +0100
+++ rockbox-devel/apps/tree.c	2003-06-13 13:53:03.000000000 +0100
@@ -1149,6 +1149,7 @@
             case SYS_USB_CONNECTED:
                 status_set_playmode(STATUS_STOP);
                 usb_screen();
+                status_draw(true);
                 reload_root = true;
                 break;
 
diff -durN rockbox-devel-orig/firmware/drivers/power.c rockbox-devel/firmware/drivers/power.c
--- rockbox-devel-orig/firmware/drivers/power.c	2003-02-21 01:12:00.000000000 +0000
+++ rockbox-devel/firmware/drivers/power.c	2003-06-13 13:53:03.000000000 +0100
@@ -29,6 +29,22 @@
 
 #ifndef SIMULATOR
 
+bool charger_is_enabled(void)
+{
+#ifdef HAVE_CHARGE_CTRL
+    /* Recorder */
+    return charger_enabled;
+#else
+#ifdef HAVE_FMADC
+    /* FM */
+    return adc_read(ADC_EXT_POWER) > 0x0C0;
+#else
+    /* Player */
+    return 0;
+#endif /* HAVE_FMADC */
+#endif /* HAVE_CHARGE_CTRL */
+}
+
 bool charger_inserted(void)
 {
 #ifdef HAVE_CHARGE_CTRL
diff -durN rockbox-devel-orig/firmware/export/config-fmrecorder.h rockbox-devel/firmware/export/config-fmrecorder.h
--- rockbox-devel-orig/firmware/export/config-fmrecorder.h	2003-05-05 23:04:36.000000000 +0100
+++ rockbox-devel/firmware/export/config-fmrecorder.h	2003-06-13 13:53:03.000000000 +0100
@@ -16,6 +16,9 @@
 /* Define this if you have a FM Recorder key system */
 #define HAVE_FMADC 1
 
+/* Define this if you have charging detection */
+#define HAVE_CHARGE_DETECT
+
 /* Define this if you have a LiIon battery */
 #define HAVE_LIION
 
diff -durN rockbox-devel-orig/firmware/export/config-recorder.h rockbox-devel/firmware/export/config-recorder.h
--- rockbox-devel-orig/firmware/export/config-recorder.h	2003-05-05 23:41:56.000000000 +0100
+++ rockbox-devel/firmware/export/config-recorder.h	2003-06-13 13:53:03.000000000 +0100
@@ -16,6 +16,9 @@
 /* Define this if you have charging control */
 #define HAVE_CHARGE_CTRL
 
+/* Define this if you have charging detection */
+#define HAVE_CHARGE_DETECT
+
 /* Define this if you have ATA power-off control */
 #define HAVE_ATA_POWER_OFF
 
diff -durN rockbox-devel-orig/firmware/export/power.h rockbox-devel/firmware/export/power.h
--- rockbox-devel-orig/firmware/export/power.h	2003-02-07 10:07:49.000000000 +0000
+++ rockbox-devel/firmware/export/power.h	2003-06-13 13:53:03.000000000 +0100
@@ -19,10 +19,7 @@
 #ifndef _POWER_H_
 #define _POWER_H_
 
-#ifdef HAVE_CHARGE_CTRL
-extern bool charger_enabled;
-#endif
-
+bool charger_is_enabled(void);
 bool charger_inserted(void);
 void charger_enable(bool on);
 void ide_power_enable(bool on);
diff -durN rockbox-devel-orig/firmware/export/powermgmt.h rockbox-devel/firmware/export/powermgmt.h
--- rockbox-devel-orig/firmware/export/powermgmt.h	2003-05-05 23:40:58.000000000 +0100
+++ rockbox-devel/firmware/export/powermgmt.h	2003-06-13 13:53:03.000000000 +0100
@@ -68,7 +68,6 @@
 extern int battery_lazyness[20]; /* how does the battery react when plugging in/out the charger */
 void enable_trickle_charge(bool on);
 extern int trickle_sec;          /* trickle charge: How many seconds per minute are we charging actually? */
-extern int charge_state;         /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */
 
 #endif /* HAVE_CHARGE_CTRL */
 
@@ -84,6 +83,12 @@
 
 #endif /* SIMULATOR */
 
+/* Returns charging status */
+/* FM, 0: not charging, 1: charging */
+/* Recorder, 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */
+/* Player, always returns 0 */
+int charger_status(void);
+
 /* Returns battery level in percent */
 int battery_level(void);
 int battery_time(void); /* minutes */
diff -durN rockbox-devel-orig/firmware/powermgmt.c rockbox-devel/firmware/powermgmt.c
--- rockbox-devel-orig/firmware/powermgmt.c	2003-06-11 23:29:51.000000000 +0100
+++ rockbox-devel/firmware/powermgmt.c	2003-06-13 13:53:03.000000000 +0100
@@ -40,6 +40,11 @@
 
 #ifdef SIMULATOR
 
+int charger_status(void)
+{
+    return 0;
+}
+
 int battery_level(void)
 {
     return 75;
@@ -146,6 +151,22 @@
 
 unsigned short power_history[POWER_HISTORY_LEN];
 
+int charger_status(void)
+{
+#ifdef HAVE_CHARGE_CTRL
+    /* Recorder */
+    return charge_state;
+#else
+#ifdef HAVE_FMADC
+    /* FM */
+    return adc_read(ADC_EXT_POWER) > 0x0C0;
+#else
+    /* Player */
+    return 0;
+#endif /* HAVE_FMADC */
+#endif /* HAVE_CHARGE_CTRL */
+}
+
 int battery_time(void)
 {
     return powermgmt_est_runningtime_min;
@@ -598,7 +619,7 @@
                 /* the charger is enabled here only in one case: if it was
                    turned on at boot time (power_init) */
                 /* turn it off now */
-                if (charger_enabled)
+                if (charger_is_enabled())
                     charger_enable(false);
             }
 
diff -durN rockbox-devel-orig/firmware/usb.c rockbox-devel/firmware/usb.c
--- rockbox-devel-orig/firmware/usb.c	2003-05-19 06:47:49.000000000 +0100
+++ rockbox-devel/firmware/usb.c	2003-06-13 13:53:03.000000000 +0100
@@ -338,4 +338,9 @@
 {
 }
 
+bool usb_inserted(void)
+{
+    return 0;
+}
+
 #endif

