Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What's a bluetooth utility for Linux that will let me pair and unpair devices, display messages coming from a device, send messages to a device (hopefully done using the filesystem!), and set any available flags?

The application in mind is that I just want to have say 10 tiny bluetooth keyboards and map each key on each keyboard to send a MIDI message (obviously the midi part is not part of this OP).

share|improve this question
    
Nice, thanks. But I would like to use obex push to send files instead of obex ftp. Is there a way? –  treaki Jul 19 at 17:50

1 Answer 1

Here's a list of several tools dealing with Bluetooth that you can use to interact with a device.

hciconfig

hciconfig

  • Gives info about the bluetooth hci on your pc
  • Ensure the device is up and running and has required scan modes
  • hcitool dev should also give some of this info

hcitool

hcitool inq and hcitool scan

  • Gives info about or rather identifies nearby bluetooth devices

hcitool info <BTAddr>

  • Get info about remote bluetooth device

l2ping

l2ping <BTAddr>

  • One way to see if we can communicate with a remote bluetooth device

sdptool

sdptool browse <BTAddr> or sdptool records <BTAddr>

  • Gives info about the services provided by a remote bluetooth device

obexftp

obexftp –nopath –noconn –uuid none –bluetooth <BTAddr> –channel <OPUSHChann elNo> –put <FileToPut>

  • Allows one to send file without specifying the pin on the remote device side
  • The OPush channel number for device is got from sdptool above

obexftp -b <BTAddr> -v -p <FileToPut>

  • Allows one to put a file onto the specified BT device
  • obexftp could also be used to get or list the files on the BT device
  • also allows one to identify a nearby BT device by just giving -b option

passkey-agent

passkey-agent –default <Pin>

  • Pin specified here is what the remote BT device should provide or its user enter on that device when requested.

obexpushd

obexpushd

  • Allows one to recieve files sent from a bluetooth device.
  • Depending on who started it, the recieved files will be stored in the corresponding home directory

Pairing

You can following the directions from this site to pair a device with your Linux box via the command line. The aritcle is titled: How to pair a bluetooth device from command line on Linux.

Example

  1. Find your bluetooth device mac address

    $ hcitool scan
    
    Scanning ...
        11:22:33:44:55:66   device 1
        12:34:56:78:90:12   device 2
    
  2. Setup bluetooth-agent to pass the expected pairing code

    $ bluetooth-agent 0000 &
    
  3. Edit the rfcomm config file /etc/bluetooth/rfcomm.conf, and put the MAC address from above, in it.

    rfcomm0 {
      # Automatically bind the device at startup
      bind no;
      # Bluetooth address of the device
      device 11:22:33:44:55:66;
      # RFCOMM channel for the connection
      channel 3;
      # Description of the connection
      comment "This is Device 1's serial port.";
    }
    

    NOTE: An important caveat, if you configure your device to not bind at startup (bind no;) you are going to have to manually spin up rfcomm using this command before using the serial port (which also requires root permissions).

    $ sudo rfcomm connect rfcomm0
    

References

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.