[How-To] Set default volume at startup

Ideas and dreaming will go this forum

flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

hmm, interesting idea. i will try that, maybe this weekend, if the wife doesn't mind me turning the tv on and off a lot :mrgreen:

i'll post the results, maybe a small perl script or perhaps i can trigger something on the fritzbox when it receives the intital (emtpy) dhcp discover or something like that...
nbd wrote:Ok, I tried, but it only showed analog channels and I had chosen the DTV source (maybe CDTV would have been the correct) and wasn't able to tune the digital channels.
it shows the current mode at the top of the screen when in the hotel mode menu. in my case it was CDTV for digital cable.
nbd
Posts: 161
Joined: Wed Jan 13, 2010 12:02 pm

Re: default volume at startup

Post by nbd »

Yes, that upnp thing crossed my mind also, but I thought there was only vol+ / vol-. Hopefully we'll someday discover the software way...
flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

well, good news is, that this should be easy :)

using upnp-inspector, there is a function "SetVolume" which does exactly what you would expect of it. i traced the connection in wireshark, simple http post to port 52235

Post

Code: Select all

POST /upnp/control/RenderingControl1 HTTP/1.0
Host: 192.168.8.7
User-Agent: Twisted PageGetter
Content-Length: 366
SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#SetVolume"
content-type: text/xml ;charset="utf-8"
connection: close

<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><ns0:SetVolume xmlns:ns0="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel><DesiredVolume>4</DesiredVolume></ns0:SetVolume></s:Body></s:Envelope
Reply

Code: Select all

HTTP/1.1 200 OK
CONTENT-LENGTH: 257
CONTENT-TYPE: text/xml; charset="utf-8"
DATE: Thu, 01 Jan 1970 00:14:40 GMT
EXT:
SERVER: Linux/9.0 UPnP/1.0 PROTOTYPE/1.0

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetVolumeResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"></u:SetVolumeResponse></s:Body></s:Envelope>
the volume is encoded at

Code: Select all

<DesiredVolume>4</DesiredVolume>
in the post

so what to do with this? simple way would be some bash script with curl or in perl. but i would like to find a way to execute this on the television itself, this way we don't depend on any other devices. does anyone know where the upnp server is running? is it part of exeDSP? if not, we should be able to do the same call the upnp server does but directly. or maybe any way to open a connection localhost to the upnp server? netcat comes to mind, but that won't be availibe on the tv, or is it?
User avatar
juusso
SamyGO Moderator
Posts: 10129
Joined: Sun Mar 07, 2010 6:20 pm

Re: default volume at startup

Post by juusso »

It is enought to call script from samygo.sh on patched B series firmwares. Now the easiest step - to make script :mrgreen:
Anyone can make script, which sends right format data to localhost:52235? Or we need a simple http server running on TV to do this job ?

P.s. Here is directory: /mtd_rwarea/dlna_web_root/dmr
with some dlna config files. One of it is RenderingControl1.xml:

Code: Select all

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <actionList>
    <action>  
      <name>ListPresets</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentPresetNameList</name>
          <direction>out</direction>
          <relatedStateVariable>PresetNameList</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SelectPreset</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>PresetName</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_PresetName</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>GetMute</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>Channel</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_Channel</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentMute</name>
          <direction>out</direction>
          <relatedStateVariable>Mute</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetMute</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>Channel</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_Channel</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredMute</name>
          <direction>in</direction>
          <relatedStateVariable>Mute</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>GetVolume</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>Channel</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_Channel</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentVolume</name>
          <direction>out</direction>
          <relatedStateVariable>Volume</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetVolume</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>Channel</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_Channel</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredVolume</name>
          <direction>in</direction>
          <relatedStateVariable>Volume</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>GetBrightness</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentBrightness</name>
          <direction>out</direction>
          <relatedStateVariable>Brightness</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetBrightness</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredBrightness</name>
          <direction>in</direction>
          <relatedStateVariable>Brightness</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>GetContrast</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentContrast</name>
          <direction>out</direction>
          <relatedStateVariable>Contrast</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetContrast</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredContrast</name>
          <direction>in</direction>
          <relatedStateVariable>Contrast</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>GetSharpness</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentSharpness</name>
          <direction>out</direction>
          <relatedStateVariable>Sharpness</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetSharpness</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredSharpness</name>
          <direction>in</direction>
          <relatedStateVariable>Sharpness</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>GetColorTemperature</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>CurrentColorTemperature</name>
          <direction>out</direction>
          <relatedStateVariable>ColorTemperature</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>SetColorTemperature</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>DesiredColorTemperature</name>
          <direction>in</direction>
          <relatedStateVariable>ColorTemperature</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>X_GetSlideShowEffect</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>SlideShowEffect</name>
          <direction>out</direction>
          <relatedStateVariable>X_SlideShowEffect</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>X_SetSlideShowEffect</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>SlideShowEffect</name>
          <direction>in</direction>
          <relatedStateVariable>X_SlideShowEffect</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>X_GetImageScale</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>ImageScale</name>
          <direction>out</direction>
          <relatedStateVariable>X_ImageScale</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>X_SetImageScale</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>ImageScale</name>
          <direction>in</direction>
          <relatedStateVariable>X_ImageScale</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
    <action> 
      <name>X_GetImageRotation</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>ImageRotation</name>
          <direction>out</direction>
          <relatedStateVariable>X_ImageRotation</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action> 
      <name>X_SetImageRotation</name>
      <argumentList>
        <argument>
          <name>InstanceID</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
        </argument>
        <argument>
          <name>ImageRotation</name>
          <direction>in</direction>
          <relatedStateVariable>X_ImageRotation</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    
  </actionList>
  <serviceStateTable>
    <stateVariable sendEvents="no">
      <name>PresetNameList</name> 
      <dataType>string</dataType>
      <defaultValue>FactoryDefaults</defaultValue>
    </stateVariable>
    <stateVariable sendEvents="yes"> 
      <name>LastChange</name> 
      <dataType>string</dataType>
    </stateVariable>
    
    <stateVariable sendEvents="no"> 
      <name>Brightness</name>  
      <dataType>ui2</dataType>
      <allowedValueRange>
        <minimum>0</minimum> 
        <step>1</step> 
        <maximum>100</maximum>
      </allowedValueRange>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>Contrast</name>  
      <dataType>ui2</dataType>
      <allowedValueRange>
        <minimum>0</minimum> 
        <step>1</step> 
        <maximum>100</maximum>
      </allowedValueRange>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>Sharpness</name>  
      <dataType>ui2</dataType>
      <allowedValueRange>
        <minimum>0</minimum> 
        <step>1</step> 
        <maximum>100</maximum>
      </allowedValueRange>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>ColorTemperature</name>  
      <dataType>ui2</dataType>
      <allowedValueRange>
        <minimum>0</minimum> 
        <step>1</step> 
        <maximum>4</maximum>
      </allowedValueRange>
    </stateVariable>
    
    <stateVariable sendEvents="no"> 
      <name>Mute</name>  
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>Volume</name>  
      <dataType>ui2</dataType>
      <allowedValueRange>
        <minimum>0</minimum>
        <maximum>100</maximum>
        <step>1</step>
      </allowedValueRange>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>A_ARG_TYPE_Channel</name>  
      <dataType>string</dataType>
      <allowedValueList>
        <allowedValue>Master</allowedValue>
      </allowedValueList>
    </stateVariable>
    <stateVariable sendEvents="no"> 
      <name>A_ARG_TYPE_InstanceID</name>  
      <dataType>ui4</dataType>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>A_ARG_TYPE_PresetName</name>  
      <dataType>string</dataType>
      <allowedValueList>
        <allowedValue>FactoryDefaults</allowedValue>
      </allowedValueList>
    </stateVariable>
    
    <stateVariable sendEvents="no">
      <name>X_SlideShowEffect</name>  
      <dataType>string</dataType>
      <defaultValue>DEFAULT</defaultValue>
      <allowedValueList>
        <allowedValue>DEFAULT</allowedValue>
      </allowedValueList>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>X_ImageScale</name>  
      <dataType>i2</dataType>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>X_ImageRotation</name>  
      <dataType>ui2</dataType>
      <defaultValue>0</defaultValue>
      <allowedValueRange>
        <minimum>0</minimum>
        <maximum>360</maximum>
        <step>90</step>
      </allowedValueRange>
    </stateVariable>
    
  </serviceStateTable>
</scpd> 
SO we need something like MsgBoxService as we have for sending messages to TV from PC, but console tool to be executed on TV by it self. Here we can set not only volume as we see in xml file.
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE
flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

i've looked a bit around on the tv, i don't see any obvious way of of sending something anywhere... there is simply no program on that thing that could possibly do that, at least to my knowledge.

so if nobody comes up with anything we would need to compile something (which does our the http post) or find out what the upnp daemon does.

EDIT: After killing exeDSP i get a tcp-reset back at any connection attempts to the upnp port. so i guess this is integrated into exeDSP, which seems kind of obvious if you look at the process list :mrgreen:
arris69
Official SamyGO Developer
Posts: 1700
Joined: Fri Oct 02, 2009 8:52 am
Location: Austria/Vienna (no Kangaroos here)
Contact:

Re: default volume at startup

Post by arris69 »

flo-ogb wrote:i've looked a bit around on the tv, i don't see any obvious way of of sending something anywhere... there is simply no program on that thing that could possibly do that, at least to my knowledge.

so if nobody comes up with anything we would need to compile something (which does our the http post) or find out what the upnp daemon does.

EDIT: After killing exeDSP i get a tcp-reset back at any connection attempts to the upnp port. so i guess this is integrated into exeDSP, which seems kind of obvious if you look at the process list :mrgreen:
there is no netcat in extensions pack or the shipped busybox is without nc applet :?:
seems this extensions packages are useless

arris
flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

let me check... i stripped down the extension to the minimum and did my own startup scripts. i'll take a quick look what else is inside it. also i'm unpacking the native toolchain right now (which is just a debootstraped chroot) but at least then we can take a look inside the tv with *good* tools ;)

EDIT: yeah, netcat is inside. now if i remember correctly http has some of the worst specs anywhere so this could work :D
reaper7
Posts: 44
Joined: Thu Oct 01, 2009 11:16 am

Re: default volume at startup

Post by reaper7 »

You can download netcat in this post too:
http://forum.samygo.tv/viewtopic.php?f=5&t=982#p11102
flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

it works, at least on the cli. i'm currently struggeling to get it all into a shell script, for some reason i can't seem to produce the correct input for nc... also i used the netcat from debian and not the one inside the extensions. somehow that one won't do anything i tell it to do :shock:

now i'm orderd to make dinner 8-) will try to post a package containing shell script and nc binary later.
flo-ogb
Posts: 23
Joined: Sun Sep 19, 2010 9:43 am

Re: default volume at startup

Post by flo-ogb »

so, here it is. you need to adjust the path to nc at the top and there is a switch to allow you to set the volume higher then 15 with this script. give it the desired volume as calling parameter.

playing a bit with the tv startup, it turns out the timing is very difficult. delaying for 11 seconds does nothing but delaying for 12 seconds results in a short "unregulated" time. to be safe i just call the script 3 times, each delayed 1 second. ugly but...maybe useful :roll:

here's the top part of my SamyGO.sh (i splitted the 20sec usb-wait delay)

Code: Select all

#!/bin/sh

# Enable Telnetd
if [ `cat /proc/mounts | grep -c "/dev/pts"` -lt "1" ] ; then
        echo "SamyGO: Starting telnetd"
        mount -t devpts devpts /dev/pts
        telnetd
else
        echo "SamyGO: /dev/pts is already mounted, skipping telnetd"
fi

# Open back-door for fixing boot-loop situations
echo "SamyGO: Let system settle for 20 secs..."
sleep 11            # Allow USB-stick to settle
echo "SamyGO: Setting initial volume to 6"
/mtd_rwarea/SamyGO/setvol.sh 6 &
sleep 1
/mtd_rwarea/SamyGO/setvol.sh 6 &
sleep 1
/mtd_rwarea/SamyGO/setvol.sh 6 &
sleep 7            # Allow USB-stick to settle
USB="/dtv/usb/sda1" # USB mount-point

[...]
Uploaded it to webspace:
http://www.beverb.org/files/setvol.tgz
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “[B] Brainstorm”