ad: QSKLLC-1

Desperately Seeking Susan...or somebody to talk to about DBus

Discussion in 'Computers, Hardware, and Operating Systems' started by AA7EJ, Jun 3, 2019.

ad: L-HROutlet
ad: l-rl
ad: L-MFJ
ad: Left-2
ad: abrind-2
ad: Subscribe
ad: Left-3
  1. AA7EJ

    AA7EJ Ham Member QRZ Page

    I am sorry for the title - but I keep running into dead ends in " computer" forums.

    I am trying to add bluetooth technology to my C++ VNA code. .

    After struggling with Linux "blueZ" HCI functions package I switched to dbus.
    Allegedly HCI is obsolete. Go figure.

    My first test dbus program fails to get "security permission " to "name" the dbus.

    I am following the "instructions" to change that by adding "session_local.conf" , but ...

    I cannot figure out in WHICH folder to add this "supplemental" file.
    There are several "session.conf" files located in various folders.

    Secondly - since I have never worked with dbus configuration (HTML) files I have no idea which parameter(s) to change / add to this supplemental file to allow me to "name" my own dbus - during the session of course.

    I am looking for somebody familiar with (Linux) dbus who could help me to get pass this.

    73 frustrated Shirley
  2. W5UAA

    W5UAA Ham Member QRZ Page

    Wow. Ok, not sure what you're trying to write -- trying to connect a computer to a Vector Network Analyzer using Bluetooth?

    Let me explain what I know as I try to decipher what you're asking.

    First of all, dbus is a kernel process (daemon). This may be the source of your permission problem? You may be trying to access stuff that the kernel is preventing you from accessing?

    Second, it works in conjunction with sysfs (provides virtual file system at /sys), hald (current hardware) and udev (initializes device in accordance with rules defined in /etc/udev/rules.d in Fedora).

    Third, there's already an implementation for Bluetooth hot-plug/connect/disconnect in most (if not all) current distributions (/usr/lib/modules/<kernelversion>/kernel/drivers -and- /etc/bluetooth/main.conf in Fedora).

    Fourth, after a quick look at BlueZ, you may want to stick with it as it comes with a lot of pre-written libraries to connect to Bluetooth devices.

    Fifth, maybe example code will help you figure out what you're trying to accomplish? I came across this example, which scans and reports nearby Bluetooth devices. It reports the "name" of the nearby Bluetooth devices it detects. From here, it may be easier to figure out how to actually transfer data from/to your Bluetooth device.

    I sincerely wish you good luck. Let us know if you get it figured out and what your code does.
  3. AA7EJ

    AA7EJ Ham Member QRZ Page

    Thanks for reply.
    If you do not mind , I'll take it from my current code . Maybe we can talk "blueZ" later.
    In order to be fair, I'll try to delete all stuff which is not directly related to the error.

    void sendsignal(char* sigvalue) {
    // initialise the error value
    // connect to the DBUS system bus, and check for errors
    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
    if (dbus_error_is_set(&err)) {
    cout << "register our name on the bus, and check for errors" << endl;
    ret = dbus_bus_request_name(conn, "org.bluez",

    And this is the error I get

    Sending signal with value TEST
    connect to the DBUS system bus, and check for errors
    conn = 0x251bf00
    register our name on the bus, and check for errors
    @line 254
    err.message = Connection ":1.65" is not allowed to own the service "org.bluez" due to security policies in the configuration file

    As I posted - my "problem " is to identify the folder where to add the "session-local.conf" file.

    This is what "find" tells me

    jim@jim-desktop:~$ sudo find / -name "session.conf"
    [sudo] password for jim:
    find: ‘/run/user/1000/gvfs’: Permission denied

    /etc/dbus-1/session.conf no longer used and refers to
    /usr/DBUS/share/dbus-1/session.conf this


    OK, so I hope /usr/DBUS/share/dbus-1/session.conf is correct , so how do I verify that ?
  4. W5UAA

    W5UAA Ham Member QRZ Page

    Sorry, all I can see is that it looks like structure (or object) "ret" is trying to connect to host "" and you're not allowed.

    You say you switched from Bluez to dbus. I don't know what that means--that's apples and oranges to me.

    And usually creating a "session" is something that requires significant handshaking and possibly encryption (if Active Directory is involved.) And "session-local.conf" implies you're attaching to another process on the same host, or sometimes on the same LAN, but definitely not across the WAN.

    Sorry, this is above my pay-grade. has a "developer mailing list", "Linux-bluetooth", "archive" which may provide you with the answers you seek if you skim through the posts.

    Good luck. Maybe someone else in here can help.
  5. AA7EJ

    AA7EJ Ham Member QRZ Page

    I was using "blueZ" hci functions and got as far as connecting to a bluetooth device.
    Until I found out that "hci_inquiry" function finds only ONE device and not "all nearby devices" as advertised in sample code posted by "blueZ" group. What made me "switch" to dbus a) HCI is allegedly obsolete (?) b) "blueZ" source code is undocumented , hence very difficult to use.
    "blueZ archive " group deals with bugs, mostly.
    It appears that since "blueZ" is part of Linux kernel , using it as source for software development is not expected by the developers.

    Yes, the "blueZ derived tools /commands" work, but who wants to use them in C++ code?
    I did try , but only succeeded in plain "system" calls - could not do anything involving interactive process.

    DBus on the other hand seems to be at least "two levels" "wrapper" functions, but at least with some documentation.
    Thanks for your help.

    To continue
    I am pretty sure the correct folder to modify is /usr/DBUS/share/dbus-1.

    Now I need to figure out WHAT to add to the "session-local.conf" file.

    If anybody can help me further I can post the "instruction" I think deal with the "name" security.

    73 Shirley

Share This Page