Example: quiz answers

embedded Linux and kernel engineering Understanding D-Bus

Meetup Toulouse, May 2016 Understanding D-BusMyl`ene Copyright 2004-2018, Commons BY-SA , suggestions, contributions and translations are welcome! embedded Linux and kernel engineering - kernel , drivers and embedded Linux - Development, consulting, training and support - What is this talk about?ID-Bus generality & IPCIThe D-Bus principlesIDifferents tools and libraries with demoIDifferent projects using D-BusIA short use case with Connman and Ofono- kernel , drivers and embedded Linux - Development, consulting, training and support - Understanding D-BusD-Bus generality- kernel , drivers and embedded Linux - Development, consulting, training and support - D-BusICreated in 2002 IIs part of by RedHat and the communityIIs an Inter-process communication mechanismIInitiated to standardize services of

Understanding D-Bus D-Bus generality - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 3/1

Tags:

  Linux, Understanding, Kernel

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of embedded Linux and kernel engineering Understanding D-Bus

1 Meetup Toulouse, May 2016 Understanding D-BusMyl`ene Copyright 2004-2018, Commons BY-SA , suggestions, contributions and translations are welcome! embedded Linux and kernel engineering - kernel , drivers and embedded Linux - Development, consulting, training and support - What is this talk about?ID-Bus generality & IPCIThe D-Bus principlesIDifferents tools and libraries with demoIDifferent projects using D-BusIA short use case with Connman and Ofono- kernel , drivers and embedded Linux - Development, consulting, training and support - Understanding D-BusD-Bus generality- kernel , drivers and embedded Linux - Development, consulting.

2 Training and support - D-BusICreated in 2002 IIs part of by RedHat and the communityIIs an Inter-process communication mechanismIInitiated to standardize services of Linuxdesktop environments- kernel , drivers and embedded Linux - Development, consulting, training and support - Inter-Process Communication (IPC)IMechanisms allowing processes tocommunicate with each otherIShared memory: read/write into adefined memory locationIMemory-mapped file: same asshared memorybut uses a fileIPipe: two-way data stream(standard input / output)INamed pipe: same aspipebutuses a file (FIFO)ISocket: communication even ondistant machinesIand others- kernel , drivers and embedded Linux - Development, consulting, training and support - IPC using D-BusIUses the socket mechanismIProvides software bus abstractionIWay simpler than most alternatives- kernel , drivers and embedded Linux - Development, consulting, training and support - Understanding D-BusHow D-Bus is working ?

3 - kernel , drivers and embedded Linux - Development, consulting, training and support - D-Bus elementsID-Bus includes:Ilibdbus: a low-level libraryIdbus-daemon: a daemon based on libdbus. Handles and controls data transfersbetween DBus peersItwo types of busses: asystemand asessionone. Each bus instance is managedby adbus-daemonIa security mechanism usingpolicyfiles- kernel , drivers and embedded Linux - Development, consulting, training and support - System & Session bussesISystem busIOn desktop, a single bus for all usersIDedicated to system servicesIIs about low-level events such as connection to a network, USB devices, etcIOn embedded Linux systems, this bus is often the only D-Bus typeISession busIOne instance per user sessionIProvides desktop services to user applicationsILinked to the X session- kernel .

4 Drivers and embedded Linux - Development, consulting, training and support - Understanding D-BusThe principles- kernel , drivers and embedded Linux - Development, consulting, training and support - GeneralityID-Bus is working with different elements:IServicesIObjectsIInterfacesICl ients: applications using a D-Bus serviceIOne D-Busservicecontainsobject(s)which implementsinterface(s)- kernel , drivers and embedded Linux - Development, consulting, training and support - ServiceIAn application can expose its services to all D-Bus users by registering to a businstanceIAserviceis a collection ofobjectsproviding a specific set of featuresIWhen an application opens a connection to a bus instance, it is assigned a uniquename ( )ICan request a more human-readable service name.

5 Thewell-known name( ) See the specification- kernel , drivers and embedded Linux - Development, consulting, training and support - ObjectsIAre attached to one serviceICan be dynamically created or removedIAre uniquely identified by anobject path(ie/or/net/connman/technology/cellul ar)IImplement one or several interfaces- kernel , drivers and embedded Linux - Development, consulting, training and support - InterfacesICan be compared to a namespace in JavaIHas a unique name ressembling Java interface names, using dots ( )IContainsmembers: properties, methods and signals- kernel , drivers and embedded Linux - Development, consulting, training and support - InterfacesICan be compared to a namespace in JavaIHas a unique name ressembling Java interface names, using dots ( )IContainsmembers: properties, methods and signals- kernel , drivers and embedded Linux - Development, consulting, training and support - InterfacesID-Bus defines a few standard interfacesIThey all belong to the namespace.

6 Provides an introspection information about the object (interfaces, methods and signals it implements) : Provides methods to know if a connection is alive(ping) : Provides methods and signals to : Provides an helpful API to handlesub-tree objectsIInterfaces expose properties, methods and signals- kernel , drivers and embedded Linux - Development, consulting, training and support - PropertiesIDirectly accessible fieldsICan be read / writtenICan be of different types defined by the D-Bus specification :Ibasic types: bytes, boolean, integer, double.

7 Istring-like types : string, object path (must be valid) and signatureIcontainer-types: structure, array, variant (complex types) and dictionnary entry(hash)IVery convenient standard interface are represented by charactersbyteystringsvariantvbooleanbob ject-pathoarray of int32aiint32iarrayaarray of an array of int32aaiuint32ustruct()array of a struct with 2 int32 fieldsa(ii)doubleddict{}dict of string and int32{si}- kernel , drivers and embedded Linux - Development, consulting, training and support - MethodsIallow remote procedure calls from one process to anotherICan be passed one or several parametersICan return values/objectsILook like any method you could know from other.

8 Get (String interface_name, String property_name) => Variant valueGetAll (String interface_name) => Dict of {String, Variant} propsSet (String interface_name, String property_name, Variant value)- kernel , drivers and embedded Linux - Development, consulting, training and support - SignalsIMessages / notificationsIUnidirectionnalISent to every clients that are listening to itICan contain parametersIA client will subscribe to signals to get :PropertiesChanged (String, Dict of {String, Variant}, Array of String)- kernel , drivers and embedded Linux - Development, consulting, training and support - PolicyIAdds a security mechanismIRepresented by XML filesIHandled by eachdbus-daemon(under/etc/dbus-1 )IAllows the administrator to control which user can talk to which interface, whichuser can send message to which interface, and so onIIf you are not able to talk with a D-Bus service or get , check this file!

9 Been created to handle all security accesses- kernel , drivers and embedded Linux - Development, consulting, training and support - Policy - file exampleIIn this example, toto can :Iown the messages to the owner of the given serviceIcallGetContextsfrom <!DOCTYPE busconfig PUBLIC``-//freedesktop//DTD D-Bus Bus Configuration ''`` ''> <busconfig> <policy user="toto"> <allow own=" "/> <allow send_destination=" "/> <allow send_interface=" " send_member="GetContexts"/> </policy> </busconfig>ICanallowordeny- kernel , drivers and embedded Linux - Development, consulting, training and support - Understanding D-BusTools and libraries- kernel , drivers and embedded Linux - Development, consulting.

10 Training and support - Libraries & bindingsILibdbusIThis is the low-level library used by the the homepage of the project says: If you use this low-level API directly, you resigning up for some pain .IRecommended to use it only for small programs and you do not want to add manydependenciesIGDbusIIs part of GLib (GIO)IProvides a very comfortable APIIQtDbusIIs a Qt moduleIIs useful if you already have Qt on your systemIContains many classes to handle/interact such asQDBusInterface- kernel , drivers and embedded Linux - Development, consulting, training and support - Libraries & bindingsIBindings exist for other languages: dbus-python, dbus-java.


Related search queries