HOWTO: Debian SID + BitPim + LG VX5300 + Bluetooth

Been meaning to post this one for a while, but gah life is busy. As regular readers know, I upgraded my cellphone recently to an LG VX5300. I found out only after I got it home that it had only been out a week. Thus, there is currently no standard USB cable available, and no BitPim support. This means that there is no obvious way to get pictures taken with the lovely phonecam off the phone and onto my Linux box, or even to back up the onboard phonebook…

Fortunately, with a bunch of help from the web and from various local gurus, I was able to get it all to work. (B)


Note: You could destroy everything on your phone and void your warranty, so please don't follow these instructions.

The basic strategy is to use a slightly-hacked BitPim to talk Bluetooth to the phone. I assume that everything starts out-of-the-box unconfigured. If this is not the case, be careful: some of the instructions given here could damage your existing configuration.

Here's how:

  1. Turn off Bluetooth on your phone. MENU-rt-rt-7-off
  2. Get Bluetooth hardware for the Linux box. If you don't already have some kind of BT HW, I recommend a USB dongle as portable, compatible, and cheap. I used a Cables Unlimited 100M, which I bought at Fry's for about $25, but almost any USB 2.0 HS BT adapter should work out of the box on any modern Linux distro.
  3. Set up Bluetooth kernel and devices for the Linux box. If you build your own kernels, go turn on all the relevant-looking Bluetooth options and install.
  4. Get the Bluetooth stack for the Linux box. You'll want to make sure you have USB 2.0 EHCI working. Then you install the Bluez BT stack. In Debian SID, this is a matter of
    apt-get install bluez-utils
    /etc/init.d/bluetooth start
    

    Do not install any other Bluez packages, as they may misconfigure you.

  5. Set up devices for udev. If you are running udev, you will need to make sure that it is clued in. Run
    /etc/init.d/udev stop
    /etc/init.d/udev start
    

    to get the hotplug stuff working.

  6. Plug in the adapter. Plug in your USB adapter. After a few seconds, the light on my adapter starts to blink, indicating that the stack has been inited.
  7. If it doesn't seem to be working, it could be any of a million things. The first thing to try is a complicated dance, which appears to be especially necessary when the adapter is connected through an external USB hub—weird, but there it is:

    1. Unplug the adapter.
    2. rmmod hci_usb
      modprobe hci_usb
      
    3. Replug the adapter.
    4. If it still didn't work, unplug and replug the adapter again. Try a different port this time.

    Always watch /var/log/syslog and /var/log/messages carefully for signs of trouble; for example, my USB lineprinter has been known to confuse things.

  8. Configure bluez. Edit /etc/bluetooth/hcid.conf . It should be mostly OK, but make sure that it is set to security mode "auto", that the default link mode is "accept", and that you pick something different than "1234" for the default passkey (although 4 decimal digits is still recommended). Give the device some host-independent name like "BT dongle" so that you can move the adapter from machine to machine without confusing things. Now reset everything by running
    /etc/init.d/bluetooth stop
    rm -rf /var/lib/bluetooth/*
    /etc/init.d/bluetooth start
    
  9. Pair the phone and the dongle. This has been really twitchy for me; fortunately you only have to make it work once.
    1. As you know by now, the BT menu on the phone is menu-rt-rt-7 . Go there, and turn on BT for the phone.
    2. From there, go to settings-2 and turn discovery mode on. For the next 60 seconds, your phone will be exposed to the world.
    3. Quickly go back to the bluetooth menu and select "Add New Device".
    4. When the phone finishes scanning, it should find the adapter and offer you the option to pair with it. Quickly say yes.
    5. The phone will prompt you for the passkey. Quickly enter the key you set earlier.
    6. If all goes well (ha) you should get a message from the phone saying you've paired. If not, try again, tweaking various things. I'm serious; this is all fragile as heck, so don't give up.
  10. Obtain the latest BitPim source. You'll want to see the BitPim home page for current info, but for me it works to do
    svn co https://svn.sourceforge.net/svnroot/bitpim/trunk/bitpim
    
  11. Patch the BitPim source to work with the LG VX5300. BitPim doesn't yet officially support the VX5300. I have written a horrid little patch script that will add support. Since the VX5300 seems to be essentially identical to the supported VX8300 except for some identification strings, I just changed the strings. Yuck. Run the supplied shell script in the bitpim source root directory.
  12. Get an rfcomm connection to the phone. This basically involves the use of the hcitool and rfcomm utilities from Bluez, and is documented well elsewhere on the net. I have a little helper script I have written to automate the process. You will need to replace the bogus BT MAC address in the script with the MAC address of your phone. You can get this by going to settings-1 in the Bluetooth menu on the phone. Alternatively, you can get it by putting the phone in Discovery mode and running "hcitool scan". In any case, once you've patched the shell script, run it. If all goes well, it will silently start an rfcomm connection to your phone in the background. (If the script fails, try turning off Bluetooth, turning off your phone, unplugging your adapter, then turning on the phone, turning on Bluetooth, and replugging your adapter. Then run the script again. This got it for me when doing a walkthrough; my phone was screwed up. In fact, the phone gets screwed up quite easily, so don't be shy about all this.)
  13. Run the modified BitPim. Go to the bitpim source directory and
    cd src
    sudo python bp.py
    

    Once BitPim is up and running, go to the Settings dialog (wrenches icon at top) and select LG VX5300 as your phone and /dev/rfcomm0 as your communications port. Then exit, and

    sudo chown -R $USER $HOME/.bitpim-files
    

    just to make sure that you haven't screwed up permissions. Then restart BitPim as yourself

    python bp.py

    and click the Get Phone Data icon (right-facing green arrow and phone). This will bring up a task dialog that is fairly self-explanatory, except that to get images from the phone (my common task) you choose "wallpaper". When you click "OK", BitPim should grind for a really long time, with a status bar at the bottom.

  14. Save images from BitPim and erase the phone. Open Media/Images in the list on the left side of BitPim. You should see the pictures from your phone! Now right-click on Images, and you will see a popup menu that will let you save all the images. I think it's easier to clear the images from the phone once they're saved from the phone menu: camera_button-MY_PIX-options-8. Alternatively, you can use the popup to clear all images, then upload data to phone in replace mode.

And there you have it. In just a few simple steps you can download stuff from your LG VX5300.

By the way, I do not recommend upgrading your LG VX5300 firmware. Verizon has a long history of preventing downloads from their phones. If I'd realized how bad they were about this, I probably would have switched carriers back to Cingular this time around. Oh well—it's fun while it lasts.

Last, but not least: no, I won't help you if you get stuck :-). This whole process is a nightmare, and I spend many hours stuck on my own. I apologize for any defects in these instructions; while I'll be happy to hear about them and try to correct them, I think I've typed enough on this topic now to last me a while.