• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Bluetooth support, Ionics Stratus, /usr/bin/mute-agent?  (Read 2008 times)
tomplug
Newbie
*

Karma: 0
Posts: 15


View Profile
« on: August 27, 2010, 06:45:16 PM »

I recently received an Ionics Stratus - it has Bluetooth built-in.  I'm interested in learning how to program with Bluetooth.  Ideally I'd like to figure out how to pair with the Plug on another Linux machine and send some character strings over a bluetooth serial port.  I'm hoping this can be the beginning of learning about using Bluetooth.

Right now I am investigating what software is available on the Plug.  I've found hciconfig, hcitool, sdptool and rfcomm.  /usr/bin/hcid is running.

There is a Python program, started up by script "/init_setup.sh" that is called mute-agent.py.  This Python program listens for DBUS commands related to Bluetooth and does ... something.  I don't really know what it does and am looking for some information.

Anyone know what it does?

Best regards,
Tom


 
Logged

tomplug
Newbie
*

Karma: 0
Posts: 15


View Profile
« Reply #1 on: August 31, 2010, 07:39:58 AM »

I posted this question and since it didn't receive any replies, I had to figure it out for myself.  Here is what I learned: I'll describe both what "mute-agent.py" does and an *error* in the default Bluetooth configuration that prevents it from working properly.

BlueZ is the preferred Bluetooth stack implementation included in Linux 2.6. (http://www.bluez.org/).  To "pair" with a bluetooth computer, a little program that prompts the user for permission is required.  This program is a bluetooth pincode "agent."  In many Linux distributions this program is called /usr/bin/simple-agent.py. (Here's a pretty good explanation of it: http://wiki.openmoko.org/wiki/Manually_using_Bluetooth).

The Plug doesn't have a default window environment, so there isn't a standard way to prompt a user for permission.  Instead, the development Plug has a simplified agent that accepts pairing with anyone and offers a fixed pincode of "0000."  This type of bluetooth agent has been described here: http://it-result.me/bluetooth-network-on-linux/

Summary: in most Linux distributions the Bluetooth agent is called "simple-agent.py"  Our Plug distribution with fixed pincode and no prompting for permission is called "mute-agent.py."

These two articles helped me to understand what the agent was supposed to do.  However, once understanding this I was still unable to "pair" with the Plug.  If I initiated pairing from a Mac I observed the following error in /var/log/syslog.

Aug 31 16:26:24 debian hcid[1609]: Agent replied with an error: org.freedesktop.DBus.Error.AccessDenied, Rejected send message, 1 matched rules; type="method_call", sender=":1.0" (uid=0 pid=1609 comm="/usr/sbin/hcid -x -s ") interface="org.bluez.Agent" member="RequestPinCode" error name="(unset)" requested_reply=0 destination=":1.1" (uid=0 pid=1768 comm="/usr/bin/python /usr/bin/mute-agent "))

For some reason, the mute-agent was not given permission by dbus.

Upon more reading, I found some information about configuring permissions for dbus.  The file /etc/dbus-1/system.d/bluetooth.conf grants permissions for specific interfaces.  Our mute-agent is using the interface "org.bluez.Agent" and it was not granted permission in the distributed bluetooth.conf.  (I'm guessing that in other versions of BlueZ utilities, the agent is named "PasskeyAgent" or "AuthorizationAgent".  Ours is named "Agent" and is not granted.)  I added the line below marked with !!!!.  The I restarted the Plug.

/etc/dbus-1/system.d/bluetooth.conf


  <policy user="root">
    <allow own="org.bluez"/>
    <allow send_destination="org.bluez"/>

    <!-- allow root to send to agents -->
    <allow send_interface="org.bluez.PasskeyAgent"/>
    <allow send_interface="org.bluez.Agent"/>    !!!!
    <allow send_interface="org.bluez.AuthorizationAgent"/>
  </policy>


Hope this helps someone else new to working with Bluetooth on Linux.

-T

Logged

feith
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #2 on: November 14, 2010, 03:12:50 PM »

Can you give me info what type Bluetooth is in Stratus ? USB or UART ?
Run from root:
# hciconfig -a

And paste the result, thanks

Regards feith
« Last Edit: November 14, 2010, 03:17:13 PM by feith » Logged

tomplug
Newbie
*

Karma: 0
Posts: 15


View Profile
« Reply #3 on: November 15, 2010, 08:38:43 AM »


# hciconfig -a
hci0:   Type: SDIO
        BD Address: 00:21:19:EA:61:03 ACL MTU: 1021:7 SCO MTU: 240:3
        UP RUNNING PSCAN ISCAN
        RX bytes:1415 acl:0 sco:0 events:34 errors:0
        TX bytes:1008 acl:0 sco:0 commands:34 errors:0
        Features: 0xff 0xef 0x8d 0xfe 0x9b 0xff 0x79 0x83
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: ''
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Ver: 2.1 (0x4) HCI Rev: 0x8300 LMP Ver: 2.1 (0x4) LMP Subver: 0x501
        Manufacturer: Marvell Technology Group Ltd. (72)

Logged

kwikrick
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #4 on: January 09, 2011, 12:47:57 PM »

@tomplug,
Thank you, that info was just what I was looking for.  My guruplug's bluetooth is working now (although it's still a bit fussy about making connections; sometimes i need to try a couple of times).

I got mpd (music player daemon) and remuco-mpd (bluetooth remote for mpd)  running on my guruplug. So, using any cheap java phone I can control what's playing on my stereo. It's great!







Logged

Pages: [1]
Print
Jump to: