Am 17.03.2013 20:31, schrieb Lukas Märdian: >>> So there's definitely something wrong in the alsa router. >> >> Can you or somebody else provide a patch? I have no idea how to solve this. > > I'm not sure how to fix this either, but I'll try to have a deeper look > before my vacation (still few days left). I hope I'll be able to provide > a patch for it soon.
Hi Rico, attached is a patch, which should apply cleanly atop of the 0.12 branch of cornucopia. I do not yet understand all the alsa stuff, but this first patch seems to fix the issue on my laptop. Could you please try, if it fixes your use case as well? Please comment on any problems you see. I'll try to clean it up and push it into git after my vacations. Cheers, Lukas
From d97a178308a0596d37bff4f3ad081398c3335513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= <l...@slyon.de> Date: Mon, 18 Mar 2013 17:43:45 +0100 Subject: [PATCH] fsodeviced: fix get/set main_volume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukas Märdian <l...@slyon.de> --- fsodeviced/src/lib/alsa.vala | 38 ++++++++++++++++++++++++ fsodeviced/src/plugins/router_alsa/plugin.vala | 7 +++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/fsodeviced/src/lib/alsa.vala b/fsodeviced/src/lib/alsa.vala index 4029837..dd8e723 100644 --- a/fsodeviced/src/lib/alsa.vala +++ b/fsodeviced/src/lib/alsa.vala @@ -296,6 +296,44 @@ public class FsoDevice.SoundDevice : FsoFramework.AbstractObject return (uint8) Math.round(( (val-min) * 100 / (double)( max-min ) ) ); } + public uint8 getVolume( BunchOfMixerControls scenario ) + { + uint idx = scenario.idxMainVolume; + MixerControl[] controls = scenario.controls; + + for ( int i = 0; i < controls.length; ++i ) + { + var type = controls[i].info.get_type(); + if ( controls[i].eid.get_numid() == idx && type == ElemType.INTEGER ) + { + debug( @"getVolume: $(controls[i])" ); + //FIXME: what about controls with more than 1 value? (controls[i].info.get_count() > 1) + return (uint8)controls[i].value.get_integer(0); + } + } + + warning( @"main_volume with id $idx not found" ); + return 0; + } + + public void setVolume( BunchOfMixerControls scenario, uint8 vol ) + { + uint idx = scenario.idxMainVolume; + MixerControl[] controls = scenario.controls; + + for ( int i = 0; i < controls.length; ++i ) + { + var type = controls[i].info.get_type(); + if ( controls[i].eid.get_numid() == idx && type == ElemType.INTEGER ) + { + //FIXME: what about controls with more than 1 value? (controls[i].info.get_count() > 1) + controls[i].value.set_integer(0, (long)vol); + setControl(controls[i]); + debug( @"setVolume: $(controls[i])" ); + } + } + } + /** * @set volume percent for mixer element with @a id **/ diff --git a/fsodeviced/src/plugins/router_alsa/plugin.vala b/fsodeviced/src/plugins/router_alsa/plugin.vala index 7cfb445..e273807 100644 --- a/fsodeviced/src/plugins/router_alsa/plugin.vala +++ b/fsodeviced/src/plugins/router_alsa/plugin.vala @@ -317,15 +317,16 @@ class LibAlsa : FsoDevice.BaseAudioRouter { var scenario = allscenarios[currentscenario]; assert( scenario != null ); - - return device.volumeForIndex( scenario.idxMainVolume ); + //return device.volumeForIndex( scenario.idxMainVolume ); + return device.getVolume( scenario ); } public override void setVolume( uint8 volume ) throws FreeSmartphone.Error { var scenario = allscenarios[currentscenario]; assert( scenario != null ); - device.setVolumeForIndex( scenario.idxMainVolume, volume ); + //device.setVolumeForIndex( scenario.idxMainVolume, volume ); + device.setVolume( scenario, volume ); } public override string repr() -- 1.7.9.5
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Smartphones-userland mailing list Smartphones-userland@linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-userland