• Status Assigned
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System Another
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by mc2739 - 2010-06-07
Last edited by mc2739 - 2010-06-27

FS#11367 - e200v2 enable line out and detect dock connection

This is a beginning of support for line out and dock connection detection for the e200v2 (and possibly fuze).

The first patch enables line out in as3514.c. Line out is always enabled at this point, so battery life may suffer. Line out volume is set to 0dB and does not change unless the volume is set below -40dB at which point the DAC volume begins to decrease. This patch does not support as3525v2 at this time.

The second patch detects a connection to a dock on e200v2 (and possibly Fuze) and prevents switching to USB mode and rebooting to the OF. For this to work properly, you need to have Rockbox already booted. There is no need to press any button on connection. If a normal USB cable is attached, the OF will be booted.

1. Only enable line out when connected to a dock and disable line out when the dock is disconnected.
2. Provide support for additional as3525 and as3525v2 devices. Information on IO port changes when connecting a dock is needed for this.

Leaving line out enabled doesn't impact battery life (tested on fuzev1)

It looks like as3543 (as3525v2) will need some more thought. According to the data sheet, it appears that if the line out is enabled, the headphones are disabled. Line out mode cannot be always on, but will need to be switched on and off. This will cause problems with the case where a user wants to use the dock for charging but still wants to use the headphone jack for listening.

Also, since the same register controls line out volume and headphone volume, if line out volume is to be adjusted, then we should probably remember the headphone volume setting so that it can be restored when line out is disabled.

This patch removes the line out volume changes for as3543 until this is further resolved.

These two patches deal with dock connect detection. These are for e200v2 and Fuzev1 only.

I have added the check to the usb thread since this is also where other cable insert routines are (screendump and charge only). The dualboot.S patch allows a dock connection to bypass the USB test and boot straight into Rockbox (a left button press will still boot the OF).

With these patches applied, booting Rockbox and connecting to a dock does not reboot to the OF and enables charging mode.

Connecting the dock with power off, it boots into Rockbox and does not reboot into OF, but the charging mode is not enabled. Is there something I am missing that is causing charging mode to not be enabled?

WARNING: the dualboot.S patch has only been tested on e200v2. Although it should work on Fuzev1, it has not been tested and could potentially cause failures.

Here are some I/O results from my FuzeV2.

Firstly, the dock I have is this one; (It's the official e200 dock, it has USB in and power in + line out. It uses the same ridax connector as the FuzeV2)

Nothing plugged in (either to the Fuze or to the Dock)

GPIOA: 25 DIR: 21
GPIOB: DC or FC DIR: 3F or 1F
GPIOC: 00 DIR: 00

CP15: 0X0005107D

With Power Plugged In

GPIOA: 2D or AD DIR: 21
GPIOB: DC or FC DIR: 3F or 1F
GPIOC: 00 DIR: 00

CP15: 0X0005107D

USB Plugged In

GPIOA: 2D or AD DIR: 21
GPIOB: FC or DC DIR: 3F or 1F
GPIOC: 00 DIR: 00

CP15: 0X0005107D

Notes; General:

GPIOA changes when the scroll wheel moves… GPIOB changes when scrollwheel off (DC) or on (FC), DIR for GPIOB seems to change when scrollwheel is on (3f) or off (1f).

Notes; Power in:

Just left alone GPIOB goes to either 2D or AD. Seems to go to 2D randomly, and is mostly at AD. It seems to change rather randomly (or at least, not a pattern that I've observed)

Notes; USB in:

GPIOB only seems to go to AD sometimes, and only briefly? Is at 2D the rest of the time.


The only thing I can see in I/O is that with the dock's power in in the player's GPIOB is mostly set to AD, whereas with USB it's usually at 2D… Seems pretty inconclusive.

@ sunami88

Thanks for these readings from your Fuzev2.

Can you give me some more information on how your dock handles USB connection and playback modes? Are both active, or do you need to select the mode you wish to be in?

Here is the latest lineout patch. I will commit this later today if there are no objections.

The dock_connect patch is no longer needed due to the recent USB changes.

Committed lineout-v4.diff as r27162

TODO: enable/disable line out based on dock connection status, add additional devices (Fuzev2 and c200v2)


Glad I could help; With regards to how it handlles USB/playback modes, it decides itself, with the default going to USB.

If power, line out, and USB are all plugged in, it goes to USB. Unplug USB and it goes into playback mode. With nothing but the player plugged into the dock I assume it leaves the headphone jack enabled (connect your headphones to the rear "line out" and there's no sound, and with the Fuze's headphone jack then being covered I can't plug into it).

So with no power or USB in, the player doesn't even seem to know it's plugged into a dock. Plug power in and line out is enabled. Plug USB in too, and it goes to USB.

This patch enables and disables line out based on dock connection status for e200v2 and Fuzev1. There should be no noticeable difference with this over svn.

What about adding HAVE_SANSA_DOCK in config/*.h ?

I think this would make the #ifdefs a bit cleaner and make it easy to add c200v2 / fuzev2 / view or whatever new sansa model gets supported in some uncertain future

Added HAVE_SANSA_DOCK as suggested by funman

Does this patch work for the C200(V1) as well? I'm having trouble getting my unit to xmit when plugged via my iTrip. I've confirmed the unit works when booting OF, however with the latest (28363 (upgraded from latest stable)), neither attempt to xmit worked – All I get is a brief 5 seconds or so of nearly inaudible screeching interference.

A patch previous to this was applied to the C200:


No it does not. The c200v1 is a different player based on different hardware. This patch only applies to the devices mentioned here.

Not trying to overstep my boundaries here,being new to this and not being very well versed in all things Rockbox – been a user for years, but I'm no programmer…

The only reason I ask is because the as3514 is the same chip in the C200V1 and given all three devices suffer the same problem and share the same connector interface, as well as the fact that both of these patches appear to address virtually the same issue – I thought it might be a newer iteration given the first patch's filename relates to the as3514. Looking at the code – they appear to try to do the same thing, but I'm no programmer…

Should I direct my questions to the other "older" topic's author or is it possible to add the C200 to the "supported" list given the use of the 3514?


The as3514 is used in a number of different devices but is not necessarily wired up the same in all devices. Enabling line out on the c200v1 may be accomplished in a similar manner to these devices, but the patch which was committed is limited to the e200v2 and fuze because it was known to work on those devices.

This patch definitely did not work for the e200v1 due to the way its hardware is configured. The line out connection on the e200v1 is connected directly the headphone output.

Reading the comments in FS#8305 (, it implies that the line out and headphone connections may be separate outputs, but I cannot verify that since I do not have the hardware available for testing. If you are willing to test on your hardware, I can give you a patch or a patched build to try.

Okay – wasn't sure if syntax for the v1 could be rolled into this patch. Thanks for explaining, Michael.

I haven't done any board level testing of this, as I don't know how to pull I/O info from the unit – Diagnostics?

I can confirm that plugging the unit in with the OF booted, the unit transmits. When Booted with Rockbox, it does not. I checked the headphone output while booted in RB and the headphone output IS active.

Point me in the right direction and I can do all the testing you need – I have three V1 units to work with. I started down this path originally for my Dad as part of his 70th birthday gift this year (I bought the unit for him two or three years ago and he hadn't used it at all) thinking I might be able to mod a cable, but then checked here first and found that there WAS work to try solving the issue, but it looked like it wasn't completed and/or wasn't committed to the latest release. Rather than tear apart the only good cables I have, I'd rather do it with software, since it seems possible.

Anyway, let me know what I need to do to provide you with testing data you need.


The first thing you can test is the behavior in the OF when the iTrip is connected. Does the line out volume change when you adjust the c200 volume controls, or does it remain constant. Also, while connected to the iTrip with headphones also connected, what is the volume level of the headphones and does it change when the volume controls are adjusted?

After firing up RB connected to the iTrip, the volume is active and variable. In addition, connecting to the iTrip while powered off forces the unit ON, but doesn't appear to be charging. When powering the unit on while connected, the same behavior is exhibited – doesn't appear to be noticeably charging. I did also note that while cranking the volume all the way up to 6+db, the line noise I described before IS sound from the unit, just dampened and very noisy, in the sense of interference. Volume via the headphone jack is clean and constant, plugged or un-plugged to/from the iTrip.

Upon powering the unit while connected in the OF, the variable volume adjustment vanishes and sticks to the set volume pre-connection. If I disconnect from the iTrip, the volume becomes adjustable again. Upon reconnecting, the volume adjustment vanishes and isn't affected by any keypress up or down. I noted too that the unit appears to be in charge mode when connected as indicated by an animated power icon. Audio via the headphone jack fades and switches to line out when powered on in the OF and connected to the iTrip. Disconnecting from the iTrip immediately restores audio to the headphone jack.

Thanks for testing and documenting your results. The OF results seem to be identical to what I see with my e200v2.

Here is a patch to the current SVN code that adds the c200 to the list of devices that has the line out output enabled. If you have a build environment set up, will you try compiling a build for your c200 with this patch included?

If you do not have a build environment set up, let me know and I will provide a build for you to test.

Unfortunately, I don't have a build environment set up at the moment. I would like to sometime soon, but I'm afraid that's lower on my list of wants at the moment. I'm currently juggling a spyware infestation on a friend's PC, a basement renovation, this and 3 monkeys from a place called school in about 2 hours. lol

If you can provide me with a compiled build, I'd GREATLY appreciate it, otherwise it'll be a bit longer before I can return with some detailed results.

Thanks, Michael!

I have uploaded a c200v1 test build here:

It is svn revision r28365 with the above patch applied.

If this works like the current code for the e200v2 and fuzev1, then the line out connection should be enabled with the volume fixed at 0dB. The headphones will not be muted and the volume controls will still control the headphone volume.

If the c200 does not appear to be charging, try holding the select button while connecting the iTrip to see if that allows charging to be enabled.

Michael, You are THE MAN!!! This seems to work on all counts… Unit charges, provides variable audio via the headphone, static setting via line out (unless one pushes the volume down below 40% or so, and then it becomes variable), all via the iTrip! Let me know if there's any further testing you need for the V1. I'm happy to oblige.

Thanks for the quick replies and assistance through all of this!

Never let it be said that the RockBox community and developers don't ROCK!


I'm glad that it worked so well. Thank you for being able to test the patch.

The issue with volume being variable below -40dB is due to the way Rockbox uses two stages to control the volume. This is not a problem for most users.

I will commit these changes to svn shortly, but unfortunately, it is too late to get this into the v3.7 stable release.


Can I get you to check for some diagnostic info on your c200?

1. Go to the System→Debug (Keep Out!)→View I/O ports screen.
2. Note the GPIO_INPUT_VAL. Most will be static, but a few may have changing values.
3. Connect your c200 to your computer with the USB cable and look for one of the values to change.
4. Connect your c200 to your iTrip and your iTrip to power. Again look for a value change.
5. Report back here with the port letter (A-L), the original value, and the new value of any inputs that change when you connect.

i have a Fuze V2,
as far as i can understand, we have been trying to do this:
as the Line Out Dock is plugged in, it should be detected by the Sansa and signal to the Headphone out should be off.we are also trying here to code in such a way that the player decided between LOD and USB connection, now

i feel, making the Player (Fuze V2) in this case decide what to do incase an LOD or USB is connected is getting difficult, why not code something that enables the user to switch between Headphone Out And line out through Rockbox?

Hey Michael,
i dont know if ur gonna check here again, but the link has a lot of useful information in it

might help making Line Out accessible on sansa fuze v2


Available keyboard shortcuts


Task Details

Task Editing