The SonyEricsson P900 and Linux


General
Introduction
Curriculum
CS Projects
SMSLink
frf
Linux on RS/6000
SonyEricsson P900
Historical Research
Slide #893

Jump to Vim Home Page

Introduction

I just bought myself a new GSM, a SonyEricsson P900. This page will be dedicated to my attempts to integrate it as well as possible with my current Linux desktop, and I hope it may serve as a reference for others who would like to do the same.

The P900 provides three media for direct communication with the PC. Those are Infrared, Bluetooth and USB (through the use of its craddle). According to the user's manual, all media provide the same functionalities: each can be used for file transfer, data synchronization and modem emulation.

Of course, since the phone supports GPRS and features a mail client and a browser, an additional way of communicating with the PC would be to do it remotely over the Internet.

Those will be the topics I'll further develop below. But first I would like to thank Alfonso Martone for his very informative page on the same topic (see the links section below). It's his testimony that the phone was indeed compatible with Linux that determined my decision to buy it.

Table of Contents

  1. Hardware / Software / Firmware
  2. IrDA setup
  3. Bluetooth setup
  4. File transfer
    1. OBEX setup
    2. over Infrared
    3. over Bluetooth
    4. over USB
  5. Data synchronisation
    1. over Infrared
    2. over Bluetooth
    3. over USB
  6. Modem emulation
    1. over Infrared
    2. over Bluetooth
    3. over USB
  7. File formats
  8. Internet access (GPRS)
  9. Related links
    1. SonyEricsson P900
    2. Other SE P900 + Linux pages
    3. IrDA (infrared)
    4. Bluetooth
    5. USB
    6. OBEX
    7. SyncML
    8. Integrated Frameworks
    9. Various Utilities

Hardware / Software / Firmware

I will list here the hardware and software components I'm using for my tests.

  • Laptop: Dell Latitude C610 with SuSE Linux 9.0 (default SuSE kernel, 2.4.21-166-default).
  • PC-side Bluetooth: MSI Pc2Pc USB dongle.
  • Phone: SonyEricsson P900. Firmware versions:
    • Phone: R3C006
    • Bluetooth: R5D
    • Organizer: R2B02
    • CDA: R2B01

IrDA setup

(The assumption here is that you're trying to get IR working on a laptop with a built-in IR port. The use of peripheral IR devices, whether serial, USB or others, is beyond the scope of this document, as I don't have any. Also please note that since I've not succeeded yet in getting IR to work on my own laptop, what I report here has to be taken for what it's worth).

First, you need to install the appropriate drivers, scripts and utilities. Under SuSE Linux, simply install the following package:

  • irda

Make sure that the required IR devices are available (below /dev). SuSE has them by default. Here is a list of them:

crw-rw-rw-    1 root     uucp     161,   0 2003-09-23 20:01 /dev/ircomm0
crw-rw-rw-    1 root     uucp     161,   1 2003-09-23 20:01 /dev/ircomm1
crw-rw-rw-    1 root     uucp     161,   2 2003-09-23 20:01 /dev/ircomm2
crw-rw-rw-    1 root     uucp     161,   3 2003-09-23 20:01 /dev/ircomm3
crw-rw-rw-    1 root     lp       161,  16 2003-09-23 20:01 /dev/irlpt0
crw-rw-rw-    1 root     lp       161,  17 2003-09-23 20:01 /dev/irlpt1
crw-rw-rw-    1 root     lp       161,  18 2003-09-23 20:01 /dev/irlpt2
crw-rw-rw-    1 root     lp       161,  19 2003-09-23 20:01 /dev/irlpt3
crw-rw-rw-    1 root     root      10, 187 2003-09-23 19:59 /dev/irnet

If you don't have them, just mknod(1) them, using the majors and minors given above. You may want, as I did, to chmod(1) those world writeable in order for any user to be able to use them. Alternatively, make your own user a member of the appropriate group.

Then, visit your BIOS in order to find out (or select) which serial port will be associated with your IR device. If your PC supports it, you may also be offered a choice between SIR mode (= "Serial IR") and FIR mode (= "Fast IR"). For a first attempt, I would recommend you select SIR mode, even though it's much slower, because it is more easily supported by the Linux kernel. Later on, you may want to check whether your FIR chipset is supported by your kernel, and switch to that mode if it is (please remember that the remote device has to support FIR mode as well for it to be any use).

Please note: should you want to configure FIR mode, you can use the findchip command to find out what chipset your computer features (you need to be root to invoque it). In my case, it fails to probe any supported chipset.

Once you know which serial port to use, you need to edit the configuration file used by the IrDA stack (for SuSE, this is /etc/sysconfig/irda). Just set IRDA_PORT to the appropriate serial port, like so:

IRDA_PORT="/dev/ttyS2"

You can then start your IrDA stack by calling /etc/init.d/irda start (as root). When you do that, you should see the following message appear in your syslog:

IrDA: Registered device irda0

Now, check that communication is possible with an external device over IrDA by starting irdadump (as root). Position an IR device in front of your PC IR port, wait for a good 20-30 secs., and you should see packets flowing in both directions (indicated with ">" for outgoing packets and "<" for incoming ones). If you can't see any incoming packet, you have a problem (I should know, I'm facing the same problem myself). Here is what an IrDA dump (with outgoing packets only) looks like:

kermit:~ # irdadump
07:02:33.276050 xid:cmd a02180f2 > ffffffff S=6 s=1 (14)
07:02:43.263922 xid:cmd a02180f2 > ffffffff S=6 s=2 (14)
07:02:53.264749 xid:cmd a02180f2 > ffffffff S=6 s=3 (14)
07:03:03.265574 xid:cmd a02180f2 > ffffffff S=6 s=4 (14)
07:03:13.266404 xid:cmd a02180f2 > ffffffff S=6 s=5 (14)
07:03:23.267227 xid:cmd a02180f2 > ffffffff S=6 s=* kermit hint=0400 [ Computer ] (22)
07:03:33.268055 xid:cmd a02180f2 > ffffffff S=6 s=0 (14)
07:03:43.268879 xid:cmd a02180f2 > ffffffff S=6 s=1 (14)
07:03:53.269706 xid:cmd a02180f2 > ffffffff S=6 s=2 (14)
07:04:03.270531 xid:cmd a02180f2 > ffffffff S=6 s=3 (14)

10 packets received by filter
kermit:~ #

If you make this test with your P900, please remember that you have to activate IR first. Go to Control Panel, Connections tab, Infrared, select either PC connect or Modem (irrelevant for this test), and On for 10 minutes. The IR port on the P900 is located next to the power button, on the left side of the device.


Bluetooth setup

(Please note: In the following descriptions, the actual Bluetooth device addresses will have been anonymized. Those device addresses have the format of typical NIC MAC addresses, six pairs of hex digits, separated by colons. The 11:11:11:11:11:11 address will represent my laptop (well, its Bluetooth dongle, actually), and the 22:22:22:22:22:22 address will represent my P900).

First of all, you need to install the required Bluetooth libraries and utilies. Those are provided by the BlueZ project (see the Links section). If you're using a SuSE distribution, just install the following packages (in that order):

  • bluez-libs
  • bluez-sdp
  • bluez-pan
  • bluez-utils

Then customize the Bluetooth configuration files where needed. Those will be located in /etc/bluetooth. You will no doubt want to customize the pin file: this one contain the PIN, i.e. the code or password that you will have to enter on your phone when completing the bonding process with your PC. In theory, any character string would do, but I seemed to have problems completing the bonding process until I chose a PIN that was 4 digits (didn't perform too many tests, though. YMMV). Another file to consider is hcid.conf: this one contains the configuration parameters of the HCI daemon. Among those, the name parameter is one of interest (this is the name under which your PC will be visible to other Bluetooth devices). I kept the others to their default values.

Once this is done, you can plug in your USB dongle and type:

# /etc/init.d/bluetooth start

(Please note: under SuSE 9.0 at least, this manual starting of the Bluetooth stack won't be needed after the next reboot, as this service will be automatically added to the system startup).

Now test that your setup is working.

First verify that the new interface (hci0) is available:

# hcitool dev
	hci0   11:11:11:11:11:11

You can then scan the network to verify that you can see the P900:

# hcitool scan
	22:22:22:22:22:22   P900

Good ! Now you can launch the device discovery on the phone (Control panel, Connections tab, Bluetooth, Devices tab, then Add button). If your PC is detected, you should see its name (the one defined in hcid.conf), at first italicized. If you then click on the name, you will be prompted for the PIN and the phone will attempt bonding with the PC. This should succeed with just the software components you already installed.

At this stage, you can already gather some information about your phone. Just type the hcitool info <devaddr> command (you have to be root to run it). Here is the output I got:

kermit:/home/pan # hcitool info 22:22:22:22:22:22
Requesting information ...
        BD Address:  22:22:22:22:22:22
        Device Name: P900
        LMP Version: 1.1 (0x1) LMP Subversion: 0x9040
        Manufacturer: Ericsson Mobile Comunications (0)
        Features: 0xff 0xfb 0x01 0x00
                <3-slot packets> <5-slot packets> <encryption> <slot offset>
                <timing accuracy> <role switch> <hold mode> <sniff mode>
                <park mode> <RSSI> <SCO link> <HV2 packets>
                <HV3 packets> <u-law log> <A-law log> <CVSD>

kermit:/home/pan #

Even more information may be gleaned at the SDP level, using the sdptool browse <devaddr> command (this can be run as any user). This will give you a detailed list of all the "services" offered by your phone, one per BT channel. Those that interest you most for file transfer are "object push" and "file transfer". Here is the result I got:

pan@kermit:~> sdptool browse 22:22:22:22:22:22
Browsing 22:22:22:22:22:22 ...
Service Name: Voice gateway
Service Description: Voice gateway
Service Provider: Sony Ericsson
Service RecHandle: 0x10000
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 8
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100

Service Name: Bluetooth Serial Port
Service Description: Bluetooth Serial Port
Service Provider: Symbian Ltd.
Service RecHandle: 0x10001
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100

Service Name: Dial-up Networking
Service Description: Dial-up Networking
Service Provider: Sony Ericsson
Service RecHandle: 0x10002
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Service Name: OBEX Object Push
Service RecHandle: 0x10003
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x10004
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
  "OBEX" (0x0008)

pan@kermit:~>

Now, in order to really be able to open a connection to the phone, you will need an RFCOMM device. The first time I tried, I got an error message stating: Can't open RFCOMM device: no such file...

Running the process through strace(1), it turned out I was indeed missing the /dev/rfcommx devices. Just creating them like so:

# mknod /dev/rfcomm0 c 136 6
# mknod /dev/rfcomm1 c 136 7

solved my problem. I was then able to open a channel to the phone using the following command:

$ rfcomm conn 1 22:22:22:22:22:22 1
Connected /dev/rfcomm1 to 22:22:22:22:22:22 on channel 1
Press Ctrl-C for hangup

The first 1 in the parameters specifies the use of /dev/rfcomm1, whereas the last 1 requests a connection to the device on channel 1 (i.e. its serial port, according to the SDP browse dump given above). If this test works, the rfcomm(1) utility shouldn't return (it keeps the connection open and loops until Ctrl-C is pressed), and you should see that the blue LED on your P900 starts flashing more rapidly (from the "idle" flash once every other second to approx. 3 times per sec.).

When all those components are in place, and all those test succeed, it means that your BT stack is properly configured and that we'll be able to proceed to the next step.


File transfer

There are basically two ways of transferring files between your PC and your phone. The first one is to "beam" the files (one at a time) from one device to the other over one of the supported transports. Support for this technique is native to the phone, and uses the OBEX protocol on top of the low-level transport.

Another way of doing it is to install on the phone some (GPLed) third party software that implements a custom NFS server. With this module installed on the phone (and its client part on the PC), you will be able to "mount" your phone and access part of its memory as a regular filesystem.

OBEX setup

This is actually the easiest part of the whole setup. If you're using a SuSE distribution, just install the openobex package (provided in version 1.0.0 under SuSE 9.0).

You can also download the source tar file from the OpenOBEX web site and compile it yourself. I did so myself, since version 1.0.1 was offered on the site. I don't think that update is mandatory, though.

Since the OBEX support is encapsulated in a library, and since it requires no configuration file, having installed it, you're all set.

File transfer over Infrared

Alfonso is using this medium through the obex_p900 utility, so I know it is possible, but I couldn't get the infrared port to work on my laptop yet. I can't give more details on this topic at this stage.

File transfer over Bluetooth

After some trial and errors, and some good advice from Marcel Holtmann, I was able to get this working both ways. Here is how.

At first, I tried to use Alfonso's version of the obex_p900 utility, since he specially modified it to also support Bluetooth. Try as I might, I was never able to make it work. I then looked at the code and tried to improve on it (BT support requires specific function calls into the openobex API), but to no avail.

I then heard about the ussp-push package, that also contains the obextool utility. (If you want to use this tool, first make sure you got version 0.2 or above of the package, and please consider reading the enclosed README file first). With this latter utility, I was able to push a file to my phone on the first attempt. In order to do this, you need to have your BT stack configured and running (see above for details on that topic), but the obextool utility itself will take care of opening a channel to the phone, of pushing the file, and of closing the connection afterwards. The syntax to use it is as follows:

$ ./obextool push <filename> 22:22:22:22:22:22 4

In the previous command, the final parameter "4" represents the BT channel to use. As shown in the SDP browse dump above, channel 4 corresponds to the "OBEX file transfer" service. During transfer, a progress bar is shown on the phone display, and upon successful transfer, the file arrives in the Messages | Beamed inbox. From there, you should view the file and save it somewhere else (preferably on the memory stick, to save core phone memory).

Unfortunately, the obextool utility doesn't implement the "receive" functionality at all. Uploading new ringtones to the phone is quite fun, but what about all those digital photos that are now stuck in the memory stick ?

So here comes in the good advice from Marcel Holtmann: he mentionned to me first the btobex utility (available in the obex CVS repository of the BlueZ project). This one reportedly supports file transfers in both directions. I haven't tested it yet, though, because the next solution is far better.

It turned out, as Marcel kindly pointed out to me, that both Gnome and KDE now sport a full-featured Bluetooth framework, completely integrated in the desktop. Those projects are still at an early phase of their development, and as such are not packaged yet by the commercial distributions (as far as I know, and certainly in the case of SuSE).

For links to the home pages of those frameworks, please have a look below.

Being a KDE user, I'll describe here my experiences with the kde-bluetooth framework.

First, have a look at the Building page, and make sure your system fulfils all the prerequisites listed there. Of course, all the packages mentionned are mandatory, but even using older versions of some of them (artsc, bluez-sdp), you should get a working result (I did). Upgrading those is next on my "todo" list.

Then, go to the Download page. If you're using SuSE, I strongly recommend that you follow the RPM building technique described there: basically, pull the latest version of the sources through anonymous CVS access, tar(1) it and compress it with bzip2(1), then call rmpbuild(1) on it (for a step-by-step description of this procedure, please refer to the aforementionned page).

When the compilation and RPM building is over, just install the resulting RPM with the usual command. I had to force the installation with the --force and --nodeps parameters, to override a dependency check on the OpenOBEX library (even though this library was obviously installed).

With this in place, file transfer becomes completely trivial. To upload a file, simply right-click on it (either on your desktop or in the file manager). A new Send with Bluetooth... entry will have appeared in the context menu. You will be prompted for the target device. Reception works as transparently. Incoming connections are handled by the kde-bluetooth framework. A pop-up dialog will show download progress and allow you to save the file locally.

File transfer over USB

I'm not aware of anyone having been able to get file transfer working over USB. Please correct me if I'm wrong.


Data synchronisation

Haven't tried any of this yet. The P900 support SyncML, so synchronisation should be possible with Linux program supporting that standard. The MultiSync project (see the links section below) may help, here.

Data synchronisation over Infrared

Data synchronisation over Bluetooth

Data synchronisation over USB


Modem emulation

Alfonso got it working over IR and USB. I didn't try over BT yet.

Modem emulation over Infrared

Modem emulation over Bluetooth

Modem emulation over USB


File formats

Nothing to report yet.


Internet access (GPRS)

(This section is concerned only with the P900. Nothing Linux-specific here.)

This is actually the easy part. The P900 can not only be used as as a modem to access the Internet from your Laptop, it can access it on its own. Its default software kit provides a browser and a mail client. Here are the steps needed to configure it.

SIM card

The first step is to make sure your current SIM card offers support for GPRS. Only the most recent models of SIM cards do. If you're still using an older SIM card, you may want to check with your provider and ask for a replacement. In the case of my provider (Proximus), the exchange was free of charge and could take place in the time it took me to fill-in a form.

An added advantage of those newer SIM card models is that they offer more memory slots for address book entries and for SMS storage.

Provider

The next step is to call your provider and ask for the internet access feature to be enabled on your account. In Proximus case, that feature is called "Mobile Internet". YMMV.

GPRS configuration

Upon "Mobile Internet" service activation, the only configuration item you should receive from your provider is a server address (just a fully-qualified host name, internet.proximus.be in this case). There is, normally, no user-specific configuration item to the connection.

To enable the Internet connection on the device, go to Control Panel | Connection | Internet Accounts. Select the default "GPRS" account and make sure the Connection Type is GPRS. Click on Advanced, and in Address, fill in the host name you just received from your provider. When done, click on Done.

Your device is now ready to connect with the Browser.

A side note: even though the provided browser is a general-purpose one, don't expect to be able to easily read complex web pages. Due to the size of the screen, the P900 is still better suited to displaying pages that have been designed with PDA-friendliness in mind (or WAP pages, obviously).

e-Mail account creation

Before you can send and receive e-mails on your P900, you need to have an e-mail account. This e-mail account is not generally provided by your GSM network provider. You may wish to create one specifically for that purpose, but that might not be necessary. The only restriction is that it should be reachable over the Internet using the POP3 or IMAP protocols. Such e-Mail accounts available for free are easily found on the Internet (Yahoo and Tiscali would both be valid choices), but you might even want to use your existing corporate account (if POP3 and/or IMAP connectivity is allowed through the firewall, of course).

There are 2 important concerns regarding this e-mail account that I should dispel immediately:

  • My existing account sees a heavy traffic. Will this be a problem for the P900 ? The e-mail client on the P900 will first download only the (unread ?) e-mail headers, thereby allowing you to select and pull to the phone only those messages that you really wish to read. This approach mitigates the problem of using a heavily loaded mailbox. Now, of course, in situations where the traffic on the mailbox is really intense, even just the headers might represent a hefty volume to pull (remember that "Mobile Internet" traffic is invoiced by volume, not by connection time). In this case, it might make sense to use another mailbox for that purpose.
  • I don't want to spread my messages over several computers. Once again, the e-mail client on the P900 acts sensibly and keeps on the server even those messages that you select for download to the phone. So this concern is actually a non-issue. All your messages remain in a central place (on the server, or wherever you choose to download them for good), and you can read and kill the messages on the phone without fear of anything getting lost.

e-Mail configuration

Once you know which e-mail account you will be using on the P900, you need to configure it, of course.

Go to Control Panel | Connection | Messaging Accounts. Select eMail and click on New. You will then get to a multi-tab screen full of fields you'll have to fill.

First, the Basic tab. This one defines some global settings:

  • Account Name: You can choose any identifier you like. You might want to use the name of the provider where the mailbox has been created, or the name of your company.
  • Your Name: Put your full name here. This will be used in the "From:" field for outgoing emails.
  • eMail Address: The e-mail address of your mailbox. This will also be featured in the "From:" field.
  • Connection Type: POP3 or IMAP, according to what the server supports / requires.
  • Internet Account: the name of the internet access profile you created earlier (see above, GPRS configuration).

Then the Inbox tab. Those are the fields:

  • User name: The username you need to login on the server where your mailbox is hosted.
  • Password: The password matching the above username, obviously.
  • Incoming server address: The fully-qualified name of the server where your mailbox is hosted (e.g. pop.tiscali.be).
  • Download: by default, "just headers". Recommended choice.
  • Smaller than: if you set the field above to "emails smaller than", you can specify the max. size here. Default 100 KB.

On to the Outbox tab:

  • Outgoing server address: The fully-qualified host name of the SMTP relay you will be using for outbound mail. This configuration item, you should actually get it from your GSM network provider -- an SMTP relay is generally local to your network, and in this case it means the GPRS network (e.g. relay.proximus.be).
  • Other fields on this tab deal with SMTP authentication. They are rarely needed and disabled by default.

Last, you get the Advanced tab. You can use it to configure your P900 to use non-standard ports for POP3 or SMTP communication. The default values you will find there are suitable in most cases.

Once all of those fields are set to your liking, click on Done to save the configuration. To initiate your first mailbox sync., go to the main application menu (or click on the small envelope icon). In the list of message types, below SMS and MMS, you will now have an entry with the e-mail account name you selected above (first field of the Basic tab). Clicking on it will initiate the P900 to activate the internet connection and to poll your mailbox for headers.


Related links

SonyEricsson P900

  • Sony Ericsson Update Service: download the latest firmware for your P900 and flash it. (Requires Windows as far as I'm aware of, and has to be done on-line -- check their FAQ).

Other SE P900 + Linux pages

IrDA (infrared)

Bluetooth

USB

  • Device categories: before buying any new USB device, check this site for linux compatibility.

OBEX

SyncML

Integrated Frameworks

Various Utilities

  • ussp-push and obextool: to command-line utilities to push files from the PC to the phone over BT.
  • obex_p900: Alfonso Martone's hack of an older utility (irobex_palm3.c by Pontus Fuchs). Supports both push and receive. Works with IrDA, but couldn't get it to work with BT.
  • gnokii: a tool for Nokia phones (gorgeous interface). Not known to work with the P900 (small wonder) except possibly, partially, through the AT driver.
  • tsemgr:index: a tool for SonyEricsson phones. No official support for the P900, but would be worthwhile to investigate.

Last Modified: May 3, 2004.
philipa@tiscalinet.be