Yesterday I had to transfer some files/S60 Opensource programs to my Nokia 6630 mobile and so picked up my usb bluetooth dongle (after ages) and connected to my Linux PC to achieve the same. I had forgotten the things which I had done long time back to get it working (Also one of these days I have to find out where I had noted those steps down).
Either way I started by remembering that I have to try and use obex logic to put those files on the mobile (now come on remembering that isn’t that difficult;-). Soon I remembered most of the things to do through aptitude search/show bluetooth/bluetooth packages, dpkg -L <bluetooth related packages>, some trail_N_error and net searching (googling).
But to my horror what ever I do the connection wouldn’t establish has the bluetooth stack on the PC wasn’t pickup the PIN which I just configured on the PC. After some more rtfm and dpkg -L bluez-utils and cross verification on the bluez website I realised that the way the PIN to be used is specified to the bluetooth stack has changed on the PC and now instead of the pin_handler it uses a dbus based passkey handler. So I compiled the given passkey_agent.c and resolved it. And thus could achieve the file transfer without going into windows thou with some deficit of sleep
So here are the commands one could use to work with bluetooth devices in a linux based pc =>
- 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 inq and hcitool scan
- Gives info about or rather identifies nearby bluetooth devices
hcitool info <BTAddr>
- Get info about remote bluetooth device
- One way to see if we can communicate with a remote bluetooth device
sdptool browse <BTAddr> or sdptool records <BTAddr>
- Gives info about the services provided by a remote bluetooth device
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
passkey-agent –default <Pin>
- Pin specified here is what the remote BT device should provide
or its user enter on that device when requested.
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
- 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
Note: The old style pin_handler doesn’t work with latest bluez, you require a
dbus based passkey handler and there is one provided by default by bluez-utils
Hope this helps anyone who is trying to use bluetooth devices from the commandline on a new linux distro, as well as it would help me to remember for the future for my own use.