Index: firmware/target/arm/as3525/sansa-e200v2/button-target.h =================================================================== --- firmware/target/arm/as3525/sansa-e200v2/button-target.h (revision 26809) +++ firmware/target/arm/as3525/sansa-e200v2/button-target.h (working copy) @@ -28,6 +28,7 @@ #define HAS_BUTTON_HOLD bool button_hold(void); +bool dock_connect(void); void button_init_device(void); int button_read_device(void); unsigned short button_read_dbop(void); Index: firmware/target/arm/as3525/button-e200v2-fuze.c =================================================================== --- firmware/target/arm/as3525/button-e200v2-fuze.c (revision 26809) +++ firmware/target/arm/as3525/button-e200v2-fuze.c (working copy) @@ -43,6 +43,9 @@ static bool hold_button_old = false; #endif +/* Dock connect */ +static bool dock_is_connected = false; + void button_init_device(void) { GPIOA_DIR |= (1<<1); @@ -54,6 +57,11 @@ return hold_button; } +bool dock_connect(void) +{ + return dock_is_connected; +} + unsigned short button_read_dbop(void) { unsigned dbop_din = dbop_read_input(); @@ -77,6 +85,9 @@ dbop_din = button_read_dbop(); + /* Dock connect handling */ + dock_is_connected = ((dbop_din & (1 << 9)) != 0); + /* hold button handling */ hold_button = ((dbop_din & (1<<12)) != 0); #ifndef BOOTLOADER Index: firmware/usb.c =================================================================== --- firmware/usb.c (revision 26809) +++ firmware/usb.c (working copy) @@ -209,6 +209,13 @@ #endif } +#if defined(SANSA_E200V2) || defined(SANSA_FUZE) +static inline bool usb_dock_connect(void) +{ + return (dock_connect()); +} +#endif /* SANSA_E200V2 || SANSA_FUZE */ + #ifdef USB_FIREWIRE_HANDLING static inline bool usb_reboot_button(void) { @@ -262,6 +269,13 @@ break; #endif /* USB_DETECT_BY_DRV */ case USB_INSERTED: +#if defined(SANSA_E200V2) || defined(SANSA_FUZE) + if(usb_dock_connect()) + { + usb_state = USB_POWERED; + break; + } +#endif /* SANSA_E200V2 || SANSA_FUZE */ #ifdef HAVE_LCD_BITMAP if(do_screendump_instead_of_usb) {