1 2 Previous Next 18 Replies Latest reply on Apr 11, 2014 12:45 PM by BillyCW

    Pairing Intel Galileo w/Device via Bluetooth

    jesuse

      Hi all,

       

      I want to connect my cell phone via bluetooth with my Galileo. I am using the suggested wireless card N135. I am using the SD linux image. I would like to pair my device to control galileo. This is what i have right now.

       

       

       

        
      void setup() {
      
      // put your setup code here, to run once:
      
      delay(1000);
      
      system("hciconfig hci0 up > /dev/ttyGS0");
      
      system("hciconfig > /dev/ttyGS0");
      
      system("hcitool scan > /dev/ttyGS0");
      
      system("bluetooth-agent 0000 & > /dev/ttyGS0");
      
      system("rfcomm connect rfcomm0");
      
      }
      
      void loop() {
      
      // put your main code here, to run repeatedly:
      
      }
      
      
      

      I also edit the rfcomm.conf

       

       

      rfcomm0{
            ind yes;
       device 11:22:33:44:55:66;
       channel 1;
       comment "example bluetooth device";
       }
      
      
        • 1. Re: Pairing Intel Galileo w/Device via Bluetooth
          jesuse

          One more thing, when i do the following command in linux to make my device discoverable i still can not see it when i scan for devices on my phone.

           

           

          hciconfig hci0 piscan
          
          
          • 2. Pairing Intel Galileo w/Device via Bluetooth
            JamesBond

            Once a connection is established between the two devices, can they interact (e.g. can the Galileo be controlled/can the phone-user input stuff into an app that connects to the Galileo)?

            • 3. Re: Pairing Intel Galileo w/Device via Bluetooth
              Bob Bianca

              On line 8 change:

              1. system("bluetooth-agent 0000 & > /dev/ttyGS0"); 

              to:

              1. system("bluetooth-agent 0000  > /dev/ttyGS0  2> /dev/ttyGS0 &"); 

               

              I.e., Add "2> /dev/ttyGS0" and move the ampersand to the end.

               

              When you do, you will see the error message: /bin/sh: bluetooth-agent: command not found

               

              bluetooth-agent is not a command in Galileo Linux.

               

              Also, add "2> /dev/ttyGS0" to every "system" string to print out error messages.

               

              I don't know if this will solve your problem. But at least it fix one error. I will look at your script more tommorrow.

               

              Regards,

                Bob

              • 4. Re: Pairing Intel Galileo w/Device via Bluetooth
                jesuse

                Thanks for the suggestion Bob.

                 

                I am able to set the board to discoverable and i am able to see it from other devices but i have not been able to successfully pair it. I dont know the pairing code and the usual are not working "0000" or "1234" Any sugestions on how to set the pin or know the default pin?

                 

                Thanks.

                • 5. Re: Pairing Intel Galileo w/Device via Bluetooth
                  AlexanderMerz

                  Try:


                  hciconfig hci0 sspmode 1

                   

                  this enables Secure Simple Pairing and should work with most modern BT devices.

                  • 6. Re: Pairing Intel Galileo w/Device via Bluetooth
                    jesuse

                    AlexanderMerz,

                     

                    Thanks. I gave it a try. Indeed it disables the pin, but the pairing was unsuccessful.

                    Other suggestions?

                    • 7. Re: Pairing Intel Galileo w/Device via Bluetooth
                      antoncivit

                      Has anybody solved this?

                      I am trying to create a bloototh serial connection to galileo and I am not able to pair the board,

                      I am using this code from ssh:

                      root@clanton:~# hciconfig hci0 sspmode 1

                      root@clanton:~# hciconfig hci0 sspmode

                      hci0:   Type: BR/EDR  Bus: USB

                              BD Address: 0C:D2:92:6D:62:F2  ACL MTU: 310:10  SCO MTU: 64:8

                              Simple Pairing mode: Enabled

                      root@clanton:~# hciconfig hci0 piscan

                      root@clanton:~# sdptool add SP

                      root@clanton:~# hcitool scan

                      Scanning ...

                              B8:8D:12:15:63:2B       ANTONCIVIT-PC

                      root@clanton:~# rfcomm connect /dev/rfcomm0 B8:8D:12:15:63:2B 1&

                      [1] 1518

                      root@clanton:~# Can't connect RFCOMM socket: Operation now in progress

                       

                      I can´t pair from pc either.

                      My rfcomm.conf is:

                       

                      #

                      # RFCOMM configuration file.

                      #

                       

                       

                      rfcomm0 {

                      # # Automatically bind the device at startup

                        bind no;

                      #

                      # # Bluetooth address of the device

                        device b8:8d:12:15:63:2b;

                      #

                      # # RFCOMM channel for the connection

                        channel 1;

                      #

                      # # Description of the connection

                       

                      I have tried with bind yes with no results.

                       

                      My bluetooth main.conf is;

                       

                      [General]

                       

                       

                      # List of plugins that should not be loaded on bluetoothd startup

                      #DisablePlugins = network,input

                       

                       

                      # Default adaper name

                      # %h - substituted for hostname

                      # %d - substituted for adapter id

                      Name = %h-%d

                       

                       

                      # Default device class. Only the major and minor device class bits are

                      # considered.

                      Class = 0x100100

                       

                       

                      # How long to stay in discoverable mode before going back to non-discoverable

                      # The value is in seconds. Default is 180, i.e. 3 minutes.

                      # 0 = disable timer, i.e. stay discoverable forever

                      DiscoverableTimeout = 0

                       

                       

                      # How long to stay in pairable mode before going back to non-discoverable

                      # The value is in seconds. Default is 0.

                      # 0 = disable timer, i.e. stay pairable forever

                      PairableTimeout = 0

                       

                       

                      # Use some other page timeout than the controller default one

                      # which is 16384 (10 seconds).

                      PageTimeout = 8192

                       

                       

                      # Automatic connection for bonded devices driven by platform/user events.

                      # If a platform plugin uses this mechanism, automatic connections will be

                      # enabled during the interval defined below. Initially, this feature

                      # intends to be used to establish connections to ATT channels.

                      AutoConnectTimeout = 60

                       

                       

                      # What value should be assumed for the adapter Powered property when

                      # SetProperty(Powered, ...) hasn't been called yet. Defaults to true

                      InitiallyPowered = true

                       

                       

                      # Remember the previously stored Powered state when initializing adapters

                      RememberPowered = true

                       

                      I also made several changes with no results

                       

                      # Use vendor id source (assigner), vendor, product and version information for

                      # DID profile support. The values are separated by ":" and assigner, VID, PID

                      # and version.

                      # Possible vendor id source values: bluetooth, usb (defaults to usb)

                      DeviceID = bluetooth:9234:9678:abcd

                       

                       

                      # Do reverse service discovery for previously unknown devices that connect to

                      # us. This option is really only needed for qualification since the BITE tester

                      # doesn't like us doing reverse SDP for some test cases (though there could in

                      # theory be other useful purposes for this too). Defaults to true.

                      ReverseServiceDiscovery = true

                       

                       

                      # Enable name resolving after inquiry. Set it to 'false' if you don't need

                      # remote devices name and want shorter discovery cycle. Defaults to 'true'.

                      NameResolving = true

                       

                       

                      # Enable runtime persistency of debug link keys. Default is false which

                      # makes debug link keys valid only for the duration of the connection

                      # that they were created for.

                      DebugKeys = false

                       

                       

                      # Enable the GATT functionality. Default is false

                      EnableGatt = false

                      # comment "Example Bluetooth device";

                      }

                      • 8. Re: Pairing Intel Galileo w/Device via Bluetooth
                        BillyCW

                        Ok. I think I figured out how enable simple bluetooth pairing and it seems painfully simple.

                         

                        Simply call "bluetoothd" give it a few seconds and you can see and pair with it from another device.

                         

                        Based on my experimenting, this will perform the following:

                        - Power on / enable the radio (equivalent to "hciconfig hci0 up")
                        - Make the radio visible to other devices (equivalent to "hciconfig hci0 pscan")
                        - Make the rename the radio to clanton0 (equivalent to "hciconfig hci0 name 'clanton0'")

                        - Enable simple pairing mode (equivalent to "hciconfig hci0 sspmode 1")

                        Plus some other unknown changes that I have yet to figure out since doing all of the above itself could not enable pairing between my Galileo board and my phone (Nexus 4)

                         

                        Note that I'm using the following:

                        • The official SD card version of the 0.7.5.7 Linux firmware image
                        • Intel Centrino-N 6235 mini PCIe WiFi/Bluetooth radio

                         

                        My main.conf file is as follows:

                         

                        main.conf

                        [General]

                        # List of plugins that should not be loaded on bluetoothd startup
                        #DisablePlugins = network,input

                        # Default adaper name
                        # %h - substituted for hostname
                        # %d - substituted for adapter id
                        Name = %h-%d

                        # Default device class. Only the major and minor device class bits are
                        # considered.
                        Class = 0x000100

                        # How long to stay in discoverable mode before going back to non-discoverable
                        # The value is in seconds. Default is 180, i.e. 3 minutes.
                        # 0 = disable timer, i.e. stay discoverable forever
                        DiscoverableTimeout = 0

                        # How long to stay in pairable mode before going back to non-discoverable
                        # The value is in seconds. Default is 0.
                        # 0 = disable timer, i.e. stay pairable forever
                        PairableTimeout = 0

                        # Use some other page timeout than the controller default one
                        # which is 16384 (10 seconds).
                        PageTimeout = 8192

                        # Automatic connection for bonded devices driven by platform/user events.
                        # If a platform plugin uses this mechanism, automatic connections will be
                        # enabled during the interval defined below. Initially, this feature
                        # intends to be used to establish connections to ATT channels.
                        AutoConnectTimeout = 60

                        # What value should be assumed for the adapter Powered property when
                        # SetProperty(Powered, ...) hasn't been called yet. Defaults to true
                        InitiallyPowered = true

                        # Remember the previously stored Powered state when initializing adapters
                        RememberPowered = true

                        # Use vendor id source (assigner), vendor, product and version information for
                        # DID profile support. The values are separated by ":" and assigner, VID, PID
                        # and version.
                        # Possible vendor id source values: bluetooth, usb (defaults to usb)
                        #DeviceID = bluetooth:1234:5678:abcd

                        # Do reverse service discovery for previously unknown devices that connect to
                        # us. This option is really only needed for qualification since the BITE tester
                        # doesn't like us doing reverse SDP for some test cases (though there could in
                        # theory be other useful purposes for this too). Defaults to true.
                        ReverseServiceDiscovery = true

                        # Enable name resolving after inquiry. Set it to 'false' if you don't need
                        # remote devices name and want shorter discovery cycle. Defaults to 'true'.
                        NameResolving = true

                        # Enable runtime persistency of debug link keys. Default is false which
                        # makes debug link keys valid only for the duration of the connection
                        # that they were created for.
                        DebugKeys = false

                        # Enable the GATT functionality. Default is false
                        EnableGatt = false

                        1 of 1 people found this helpful
                        • 9. Re: Pairing Intel Galileo w/Device via Bluetooth
                          DexoDan

                          I'm also using the official v0.7.5 SD image and the N6235 (after adding the drivers for it to the official image).

                           

                          Running bluetoothd also seems to work for me.  Now I can pair other devices to my Galileo successfully, but...

                           

                          How do I send/receive data on the bluetooth connection from linux on the Galileo?  To start with, I want to use an app on the Mac, or my phone to just send simple ASCII text (over Bluetooth) and read it on the Galileo.  I will then interpret the text as commands to control motors on the motor shield I have attached to the Galileo.

                           

                          Eventually, I want to use a Wii remote to control the motors (again over Bluetooth).

                           

                          I saw mention of sdptool, and I see that it can be used to add services (including SP and WIIMOTE).

                          I also saw mention of rfcomm which seems to allow one to "bind" a device (like /dev/rfcomm0) to the Bluetooth module.

                           

                          They both seem relevant, but I haven't been able to figure out how to use them to accomplish my goals.

                          Any ideas or pointers on how to do this?

                          • 10. Re: Pairing Intel Galileo w/Device via Bluetooth
                            jonash

                            DexoDan

                                 Could you post the whole process you've done to pair Galileo via bluetooth?  I always get the result ''Connection is reset by peer''  when I use rfcomm command and I cannot pair successfully. How to use the command ‘’bluetoothd‘’?

                            • 11. Re: Pairing Intel Galileo w/Device via Bluetooth
                              AlexanderMerz

                              SDP: The Service Discovery Protocol provides information, which profiles and profile properties a specific device supports (the term "Service" in SDP is a little bit misleading, it is mostly about bluetooth profiles).

                               

                              Each bluetooth device must support SDP, so devices know how to deal with each other on a higher level. For example a bluetooth headset announces with SDP it can handle a audio stream (through a specific profile) and also music player controls (through another profile). Important: SDP must be understood a simple announcement function. If a device (like your Mac) is paired with another device (like a headset or the Galileo)  you schould check in your application that both devices can talk to each other via specific protocol. A successful paring does not mean, that both understand the rfcomm profile ie.

                               

                              BlueZ, the linux bluetooth stack turns a linux device into a bluetooth device. The Bluetooth handling is done by the bluetoothd daemon. In current versions the SDP support is handled by bluetoothd. (but not in really old versions, then there is a sdpd - a specific daemon to handle SDP, but this is just fyi)

                               

                              Sdptool is a tool to manipulate you local SDP configuration (what the Galileo announces to other bluetooth devices) and to view remote SDP configurations (what other devices like your Mac announces).

                               

                              The local SDP configuration is compiled into bluetooth but can be partly managed through the main.conf (the disable-/enable keys to switch Profiles and corresponding SDP entries on/off). But don’t care about this at the moment, RFComm is build into the local SDP config.

                               

                              RFComm itself is what you are looking for. It is basically an emulation of a classic serial port. You send data to the „port“ and it shows up on the other device „as is“.

                               

                              Here you find a simple introduction: http://people.csail.mit.edu/albert/bluez-intro/x232.html

                               

                              If you want to connect to a Mac - there is some kind of bug/feature. Mac OS X try to guess the type of the device not by SDP but the bluetooth device class. So, the Galileo might get recognized as keyboard or so. You can set the device class in Bluez via the „Class“-Keyword in main.conf. To get a matching value, you can use this generator:

                               

                              http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html

                              • 12. Re: Pairing Intel Galileo w/Device via Bluetooth
                                DexoDan

                                All I did was run "bluetoothd" (no arguments) from the command prompt on Galileo as reported by BillyCW.  I use SSH over WiFi to connect Galileo to get to the command prompt, but you can also use a serial cable.  You should also be able to use the "system" command in an Arduino sketch to run bluetoothd.

                                 

                                My /etc/bluetooth/main.conf config file was the same as BillyCW's.

                                 

                                After running bluetoothd, I was able to pair -- but not transfer any data.  On the Mac, after pairing, it drops the connection and shows as "not connected".  From my Android phone, it also pairs, but doesn't seem to be connected.

                                 

                                I plan to follow up on the links posted by AlexanderMerz to see if I can get a connection established and transfer data.

                                • 13. Re: Pairing Intel Galileo w/Device via Bluetooth
                                  jesuse

                                  I am using the comand "bluetoothd" as you specified. My main.conf is the same as yours. I wait a few minutes and i do not see galileo with any devices. When i run the command i get the following output.

                                  screen.png

                                  • 14. Re: Pairing Intel Galileo w/Device via Bluetooth
                                    zking

                                    There seems to be several distinct aspects of using bluetooth on the PCIe slot:

                                     

                                    1.  Pairing Galileo Linux with another device.

                                         a.  Windows

                                         c,  OS x

                                         b.  iOS

                                         c. Android

                                    2.  Adding and configuring the correct bluetooth modules from the Galileo Linux side such that, after pairing with another device, an active connection is sustained to allow data xfer.

                                    3.  Passing bluetooth data, eg. serial ASCII or bytes, from external device to Galileo Linux to Galileo Atmega emulator, and vice versa.

                                     

                                    Aspect 1 seems to be what most people in this thread are trying to accomplish with some success.  I purchased the N135 module thinking I could accomplish all 3 aspects.  My fear is that aspect 1 and 2 are possible but aspect 3 is not possible, at least not without substantial development.  Does anyone have insight into the possibility of aspect 3?

                                    1 2 Previous Next