Feature

CLI Magic: Access your Bluetooth phone via the command line

Recently, I upgraded my cell phone to a Motorola RAZR v3 from T-Mobile, a Bluetooth-enabled device. I wanted to copy files to this device using my Laptop running Debian testing (Etch) using command line tools. I found what I needed in a package of Bluetooth tools and daemons called BlueZ.

After I installed bluez-utils with apt-get, I found a utility installed with the package named sdptool that speaks the Bluetooth Service Discovery Protocol. SDP provides for the discovery of services available on Bluetooth devices. Some common services available on cell phones are Dial-Up Networking for PPP connections, LAN for network connections, and OPUSH (Object PUSH) for sending files to a phone. The OPUSH service seemed to best fit my needs.

My phone does not broadcast its available services unless prompted to (for security reasons), so in the menu options of the phone, I enabled broadcast mode and ran sdptool search OPUSH to see if my phone provided Object PUSH and on which channel it was provided. My results were as follows:

The line "Searching for OPUSH on 00:11:22:33:44:55 ..." told me that the command found my phone and that its network address was "00:11:22:33:44:55". The next line of interest was "Channel: 8" which told me that the OPUSH service was available on my phone on channel 8 via the RFCOMM protocol.

Now I was ready to copy a test file over to the phone. I used an application called obex_test from the bluez-utils package to push the test file to the phone. I provided the obex_test application with the address of my phone and the channel on which the OPUSH service was available with the command obex_test -b 00:11:22:33:44:55 8. After running the command, I was provided with a prompt. I typed the command c to connect to the phone, then issued the command p to give a put request
and typed the path to the file to be uploaded -- /pics/tux.jpg -- and the name of the file as I wanted it to appear on the phone -- tux.jpg. The phone then prompted me to accept the incoming transfer. When it finished, I issued the command q to quit the session. The output of the session is shown below.

Using the obex_test application to start a new interactive session every time I wanted to copy a new file to my phone would be too tedious. After a quick search, I found a script called obexsend.sh that serves as wrapper for the obex_test application, thus simplifying the process of moving files to the phone. The obexsend.sh script takes the network address of the phone, the channel of the OPUSH service, and the path of the file to be pushed as its parameters. The command obexsend.sh 00:11:22:33:44:55 8 /pics/tux.jpg accomplishes the same task as the interactive obex_test session above but makes executing and scripting this task much easier.

Users who are interested in transferring files from their phone to their computer using the command line may be out of luck. I had no problem telling my phone to send a file to my computer, but I was unsuccessful in finding a way to accept the file except by using a GUI -- specifically the gnome-bluetooth package. Once that package is installed, you can click on Applications -> Accessories -> Bluetooth File Sharing in the GNOME menu. You should see a Bluetooth icon appear in your system tray. When you tell your phone to transfer to your computer, a window should appear on your desktop asking you to accept the file. Tip: The accept window did not appear on top of the other windows on my desktop and it wasn't listed in the window list. I suggest minimizing all windows on your desktop before you perform the transfer so that the transfer accept window is easily visible.

If you find BlueZ useful, another interesting tool you might want to consider is btscanner, which scans for Bluetooth devices in range and extracts as much information as possible from a device without the requirement to pair with it. Also check out hcitool, which is included in the bluez-utils package. It provides information about the connection to a phone, such as link quality and signal strength, and allows you to configure things like connection
encryption and authorization. As always, you should read the man page for each command.

Duane Odom is a computer programmer for the US Department of Defense and a freelance writer. He has been a Linux user since 2001.

Re:fuse

sync, sync, sync

Posted by: Anonymous Coward
on February 26, 2007 09:08 PM

In my day to day, this is probably the largest shortfall. Admittidly, it's probably more me than a limitation of Linux distros. Under Windows, my T5 was a duplication of outlook, my music and office documents. Motorola's software (why wouldn't they publish for non-win32? also?) makes my phone a second duplication of outlook. To keep both devices syncronized, I'm still limited to booting back to windows.

Anyone out there have some good websites on Linux/PalmOS or more Linux/Phone syncronization? Ideally, my PalmOS should sync calendar, tasks, contacts, documents, images, music, video.. those last three are not so bad with the Palm in flashdrivemode but the tasks/calendar/contacts sync still illudes me.

Are You Servious?

(why wouldn't they publish for non-win32? also?)Because they don't feel that the expenditure on development and support is worth the return for 5% or less of the market.

There is plenty of Palm OS sync support for Linux desktops out there. Linux.com <a href="http://www.linux.com/article.pl?sid=06/01/06/233210" title="linux.com">published an article last year</a linux.com> about it. Evolution, the Linux Outlook has Palm support built in. Google has page after page about Linux and Palm synchronization. For PalmOS support, choices abound!

Experiences with USB Bluetooth dongles on Linux

Posted by: Anonymous Coward
on February 28, 2007 01:51 AM

I am using a super cheapo cellphone. I wanted to transfer my own graphics, mp3s, videos, and my own Java midlets for execution on the phone. I can put these on my Apache webserver, but my cell carrier charges me for bandwidth.

I knew Bluetooth would be zero cost. But what hardware to use? I researched, and found out that the official Bluetooth SIG does not allow anyone to designate anything as bluetooth compatible unless it has been certified by them for major bucks. Therefore, there is no official hardware compatibility list for Linux.

Here is my personal experience. I'm using a very ancient SuSE 9.1 (yeah, I know, I'm planning to upgrade to a shiny new Ubuntu in a few weeks). I thought that with such ancient software, there was little hope. I borrowed a friends USB Bluetooth dongle, and then tried the KDE Bluetooth Sync program. To my astonishment(!) it just worked! It found my phone. I could drag-drop files into it and click Send, then the phone would vibrate to tell me there was an incomming file.

Later, I bought my own different brand (Zoom) USB Dongle for about $20 at Microcenter. It also just worked. Furthermore, both dongles just worked on my partner's out of date Mac OS X system. No additional software needed. The stock OS just recognized it. I took my Zoom dongle in to work with me and tried it on Windows XP. It also just worked. This is stock Windows XP. I did not use any of the software that was included on the CD that came with the dongle.

Hope that experience helps. I expect that if you get a $20 Zoom usb bluetooth dongle, it will just work on Linux. YMMV. Hope that helps.

Send files from mobile to pc

Posted by: Anonymous
[ip: 84.114.162.241]
on August 17, 2007 10:22 AM

I managed to send files from my mobile to the pc with obexftpd -b -c /tmp, but for some reason this don't work anymore, my mobile disconnects immediately.
[Modified by: Anonymous on August 17, 2007 10:24 AM]

linux drivers for RAZOR V3 AS DIAL UP MODEM

I am interested in trying ubuntu 6.10 as os in an old pc i try it and work excellent but i live in a rurak area and depend on my razr v3 as a modem . Do you know if there is drivers already written for this purpose . Actually i am using win xp an there is drivers for this os using the cel as a dial-up connection , fortune it is a flat rate by month .