Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Call Forward
Summary Forums Tracker Lists Tasks Docs News SCM Files Wiki

Tools

DBus tools

These are the tools which are useful in discovering, testing and using the CSD DBus APIs:

dbus-send

dbus-send is used to send DBus messages from the command line and shell scripts. The syntax to invoke CSD methods is:

 dbus-send --system --dest=<service> --type=method_call --print-reply <path> <method>

For example, the following command retrieves the IMEI number:

 dbus-send --system --dest=com.nokia.csd.Info --type=method_call --print-reply /com/nokia/csd/info com.nokia.csd.Info.GetIMEINumber

dbus-monitor

dbus-monitor can be used to watch (or "eavesdrop") on DBus communication. In particular, it can be used to observe what method calls and signals are sent to/from the CSD services by other system components, for example when making a phone call or receiving an SMS. Due to a bug in the DBus server used in Maemo 5, method replies cannot be watched.

In order to eavesdrop on the system bus (which is what CSD uses) it is necessary to change some security settings. To do this, gain root and create a file called /etc/dbus-1/system-local.conf containing the following text:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"

 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>

  <policy context="default">
    <!-- All messages may be received by default -->
    <allow receive_requested_reply="false" receive_type="method_call" eavesdrop="true"/>
    <allow receive_requested_reply="false" receive_type="method_return" eavesdrop="true"/>
    <allow receive_requested_reply="false" receive_type="error" eavesdrop="true"/>
    <allow receive_requested_reply="false" receive_type="signal" eavesdrop="true"/>
  </policy>

</busconfig>

Then tell the system DBus daemon to re-read the configuration using:

 kill -HUP `cat /var/run/dbus/pid`

To watch for all activity to do with CSD using the following dbus-monitor command:

dbus-monitor --system destination=com.nokia.csd.Call \

 destination=com.nokia.csd.SS \
 destination=com.nokia.csd.Info destination=com.nokia.csd.GPRS \
 destination=com.nokia.phone.SMS destination=com.nokia.phone.Net \
 destination=com.nokia.phone.SAT destination=com.nokia.phone.SIM \
 interface=com.nokia.csd.Call interface=com.nokia.csd.Call.Instance \
 interface=com.nokia.csd.Conference interface=com.nokia.csd.SS \
 interface=com.nokia.csd.Info interface=com.nokia.csd.GPRS \
 interface=Phone.SMS interface=Phone.Net interface=Phone.SAT \
 interface=Phone.Sim interface=Phone.Sim.Security \
 interface=Phone.Sim.Phonebook \
 interface=com.nokia.csd.SMS.Outgoing interface=com.nokia.csd.SMS.SIM

Alternatively, just watch everything:

 dbus-monitor --system >n900-dbus-system.log

I find that watching everything results in about 2-3 MBytes of data every day but your results may be different.

DBus introspection

DBus has a facility to request a service to tell you what operations it supports. Not all objects support this (but most do) and it doesn't tell you the meaning of the various parameters, but it is very useful.

The following python script can be put into a file and executed to see all the CSD interfaces that support introspection:

  1. !/usr/bin/python

from dbus import SystemBus?, SessionBus?, Interface from dbus._expat_introspect_parser import process_introspection_data

def introspect_object(named_service, object_path):

    obj = SystemBus?().get_object(named_service, object_path)
    iface = Interface(obj, 'org.freedesktop.DBus.Introspectable')
  1. return process_introspection_data(iface.Introspect())
    return iface.Introspect()

print introspect_object('com.nokia.csd', '/com/nokia/csd') print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call') print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/1')

  1. print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/active')
  2. print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/all')

print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/conference')

  1. print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/hold')
  2. print introspect_object('com.nokia.csd.Call', '/com/nokia/csd/call/waiting')

print introspect_object('com.nokia.csd.Info', '/com/nokia/csd/info') print introspect_object('com.nokia.csd.GPRS', '/com/nokia/csd/gprs') print introspect_object('com.nokia.csd.SS', '/com/nokia/csd/ss') print introspect_object('com.nokia.phone.SMS', '/com/nokia/phone/SMS')

  1. print introspect_object('com.nokia.phone.net', '/com/nokia/phone/net')
  2. print introspect_object('com.nokia.phone.SAT', '/com/nokia/phone/SAT')
  3. print introspect_object('com.nokia.phone.SIM', '/com/nokia/phone/SIM')
  4. print introspect_object('com.nokia.phone.SIM', '/com/nokia/phone/SIM/phonebook')
  5. print introspect_object('com.nokia.phone.SIM', '/com/nokia/phone/SIM/security')

Feel free to uncomment the commented out lines: they either represent services which expose the same interfaces as others or services which do not support introspection.

strings

When introspection fails, the last resort is to use strings to look for text strings that might represent services, paths, interfaces or methods. strings can be installed as part of the binutils package (which is in the SDK). The CSD plugins are shareable images in /usr/lib/csd/plugins/ and running strings on the shareable libraries in that directory can reveal useful information.

csd-test

I have gathered a lot of the information I have found out into a shell script which tests out various methods. The latest version of this script is shown below:

  1. !/bin/sh

GetInfo?() {

 CSDGet info Info Get$1

}

  1. Get a return value without the dbus stuff

CSDGet () {

 path="$1"
 dest="$2"
 method="$3"
 shift 3
 DBusExecute "/com/nokia/csd/$path" "com.nokia.csd.$dest" "com.nokia.csd.$dest.$method" "=literal" "$@"

}

  1. Perform a method and return the full output

CSDMethod() {

 path="$1"
 dest="$2"
 method="$3"
 shift 3
 DBusExecute "/com/nokia/csd/$path" "com.nokia.csd.$dest" "com.nokia.csd.$dest.$method" "" "$@"

}

PhoneGet?() {

 path="$1"
 dest="$2"
 method="$3"
 shift 3
 DBusExecute "/com/nokia/phone/$path" "com.nokia.phone.$dest" "Phone.$method" "=literal" "$@"

}

DBusExecute () {

 path="$1"
 dest="$2"
 method="$3"
 literal="$4"
 shift 4
 value=`dbus-send --system --dest=$dest --type=method_call --print-reply$literal $path $method "$@" 2>/tmp/csd-test.err`
 if $? != 0?
 then
   value=`cat /tmp/csd-test.err`
 fi
 echo $value

}

  1. libcsd-net

echo "Registration Status = `PhoneGet? net net Net.get_registration_status`" reg=`PhoneGet? net net Net.get_registration_status` status=`echo $reg | cut -f 2 -d " "` if $status -eq 0? ; then echo " Status : Home network" elif $status -eq 1? ; then echo " Status : Roaming" elif $status -eq 2? ; then echo " Status : Roaming (blink?)" elif $status -eq 3? ; then echo " Status : No service" elif $status -eq 4? ; then echo " Status : No service (searching)" elif $status -eq 5? ; then echo " Status : No service (not searching)" elif $status -eq 6? ; then echo " Status : No SIM" elif $status -eq 8? ; then echo " Status : Power off" elif $status -eq 9? ; then echo " Status : NSPS?" elif $status -eq 10? ; then echo " Status : NSPS? (no coverage)" elif $status -eq 11? ; then echo " Status : SIM rejected" else echo " Status : unrecognised ($status)" fi lac=`echo $reg | cut -f 4 -d " "` echo " Location area : $lac" cell_id=`echo $reg | cut -f 6 -d " "` echo " Cell ID : $cell_id" operator_code=`echo $reg | cut -f 8 -d " "` echo " Operator code : $operator_code" country_code=`echo $reg | cut -f 10 -d " "` echo " Country code : $country_code" echo " Operator Name (name, error) = `PhoneGet? net net Net.get_operator_name byte:0 uint32:$operator_code uint32:$country_code`" network_type=`echo $reg | cut -f 12 -d " "` if $network_type -eq 0? ; then echo " Network type : Home network" elif $network_type -eq 1? ; then echo " Network type : Preferred network" elif $network_type -eq 2? ; then echo " Network type : Forbidden network" elif $network_type -eq 3? ; then echo " Network type : Neither preferred nor forbidden network" elif $network_type -eq 4? ; then echo " Network type : No network available" else echo " Network type : unrecognised ($network_type)" fi supported_services=`echo $reg | cut -f 14 -d " "` services="" if $((supported_services&1)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services GPRS" ; fi if $((supported_services&2)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services Circuit switched" ; fi if $((supported_services&4)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services EGPRS" ; fi if $((supported_services&8)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services HSDPA" ; fi if $((supported_services&16)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services HSUPA" ; fi echo " Supported services : $services"

echo Network Selection Mode = `PhoneGet? net net Net.get_network_selection_mode` echo Network Time Info = `PhoneGet? net net Net.get_network_time_info` echo "Signal Strength (signals_bar, rssi_in_dbm, error) = `PhoneGet? net net Net.get_signal_strength`"

  1. wakeup_cs_search
  2. control_cs_state

echo CS State = `PhoneGet? net net Net.get_cs_state`

  1. set_selected_radio_access_technology

echo Selected Radio Access Technology = `PhoneGet? net net Net.get_selected_radio_access_technology` echo Actual Radio Access Technology = `PhoneGet? net net Net.get_radio_access_technology`

  1. cancel_select_network
  2. select_network
  3. select_network_mode
  4. cancel_get_available_network

echo Available Network = `PhoneGet? net net Net.get_available_network` echo "Current Cell Info (?, lac, cell_id, operator_code, country_code, ?network_type, ?supported_services, error) = `PhoneGet? net net Net.get_current_cell_info`" reg=`PhoneGet? net net Net.get_current_cell_info` lac=`echo $reg | cut -f 4 -d " "` echo " Location area : $lac" cell_id=`echo $reg | cut -f 6 -d " "` echo " Cell ID : $cell_id" operator_code=`echo $reg | cut -f 8 -d " "` echo " Operator code : $operator_code" country_code=`echo $reg | cut -f 10 -d " "` echo " Country code : $country_code" echo " Operator Name (name, error) = `PhoneGet? net net Net.get_operator_name byte:0 uint32:$operator_code uint32:$country_code`" network_type=`echo $reg | cut -f 12 -d " "` if $network_type -eq 0? ; then echo " Network type : Home network" elif $network_type -eq 1? ; then echo " Network type : Preferred network" elif $network_type -eq 2? ; then echo " Network type : Forbidden network" elif $network_type -eq 3? ; then echo " Network type : Neither preferred nor forbidden network" elif $network_type -eq 4? ; then echo " Network type : No network available" else echo " Network type : unrecognised ($network_type)" fi supported_services=`echo $reg | cut -f 14 -d " "` services="" if $((supported_services&1)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services GPRS" ; fi if $((supported_services&2)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services Circuit switched" ; fi if $((supported_services&4)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services EGPRS" ; fi if $((supported_services&8)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services HSDPA" ; fi if $((supported_services&16)) -ne 0? ; then if "$services" != ""? ; then services="$services," ; fi ; services="$services HSUPA" ; fi echo " Supported services : $services"

  1. libcsd-sim

echo SIM Service Provider Info = `PhoneGet? SIM SIM Sim.get_service_provider_info` echo SIM Service Provider Name = `PhoneGet? SIM SIM Sim.get_service_provider_name` echo IMSI = `PhoneGet? SIM SIM Sim.get_imsi` echo SIM Status = `PhoneGet? SIM SIM Sim.get_sim_status`

  1. libcsd-info

echo IMEI = `GetInfo? IMEINumber` echo Serial Number = `GetInfo? ProductionSN` echo Product Code = `GetInfo? ProductCode?` echo Hardware Version = `GetInfo? HWVersion` echo MCU SW Version = `GetInfo? MCUSWVersion` echo DSP SW Version = `GetInfo? DSPSWVersion` echo "High Speed Xlink Packet Access (HSxPA) = `GetInfo? HSXPASetting`"

  1. libcsd-call

echo Emergency Numbers = `CSDGet call Call GetEmergencyNumbers?` echo Call Info = `CSDGet call Call GetCallInfoAll?` echo Timers = `CSDGet call Call GetTimers?`

  1. libcsd-gprs

echo GPRS Status = `CSDGet gprs GPRS GetStatus?`

  1. libcsd-ss

echo SS ValueNameMap? = `CSDGet ss SS ValueNameMap?`

if "$1" = "--divert"? then

 num=$2
 shift 2
 echo Unconditional Divert = `CSDGet ss SS DivertCheck? uint32:1`
  1. DivertActivate?(type, number, timer)
 echo Diverting to $num... `CSDMethod ss SS DivertActivate? uint32:1 string:$num uint32:0`

fi

if "$1" = "--divert-cancel"? then

 shift
 echo Unconditional Divert = `CSDGet ss SS DivertCheck? uint32:1`
 echo Cancelling divert... `CSDMethod ss SS DivertCancel? uint32:1`

fi

if "$1" = "--no-ss"? then

 shift

else echo Call Waiting = `CSDGet ss SS WaitingCheck?`

echo SS_ALL_DIVERTS = `CSDGet ss SS DivertCheck? uint32:0` echo Unconditional Divert = `CSDGet ss SS DivertCheck? uint32:1` echo Divert On Busy = `CSDGet ss SS DivertCheck? uint32:2` echo Divert On No Reply = `CSDGet ss SS DivertCheck? uint32:3` echo Divert On Not Reachable = `CSDGet ss SS DivertCheck? uint32:4` echo SS_DIVERT_NO_AVAIL = `CSDGet ss SS DivertCheck? uint32:5`

  1. code 5 (Not Available) is used to set both Busy and No Reply together

echo SS_ALL_BARRINGS = `CSDGet ss SS BarrCheck? uint32:6` echo Barring All Outgoing = `CSDGet ss SS BarrCheck? uint32:7` echo Barring Outgoing International = `CSDGet ss SS BarrCheck? uint32:8` echo Barring Outgoing International except Home Country = `CSDGet ss SS BarrCheck? uint32:9` echo Barring All Incoming = `CSDGet ss SS BarrCheck? uint32:10` echo Barring All Incoming when Roaming = `CSDGet ss SS BarrCheck? uint32:11` fi

  1. play with call instances

if "$1" = "--call"? then

 num=$2
 shift 2
 echo Calling $num... `CSDMethod call Call CreateWith? string:$num uint32:0`
 sleep 15

fi

echo Call instances in Conference = `CSDGet call/conference Call Conference.List`

  1. Call instance

echo Call 1 List = `CSDGet call/1 Call Instance.List` echo "Call 1 Mute (always false, false) = `CSDGet call/1 Call Instance.GetMute?`" echo Call 1 Status = `CSDGet call/1 Call Instance.GetStatus?`

  1. GetRemote? returns number, false, true for incoming and number, true, false for outgoing

echo "Call 1 Remote = `CSDGet call/1 Call Instance.GetRemote?`"

echo Releasing Call 1... `CSDMethod call/1 Call Instance.Release`


(last edited November 2, 2009) - Read Only [info] [diff])
FindPage by browsing or searching
5 best incoming links: CSD programming information (5), RecentChanges (5)
5 best outgoing links: $? != 0 (2)"$1" = "--call" (2)"$1" = "--divert" (2)"$1" = "--divert-cancel" (2)"$1" = "--no-ss" (2)
5 most popular nearby: CSD programming information (2053), RecentChanges (294), "$1" = "--divert" (94), $? != 0 (76), "$1" = "--call" (75)

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment