PersistentBluetooth

  1. Keeping Bluetooth live all the time
    1. One thing I did notice is that bluetooth keyboards cease working when you close the lid. They'll stay connected, but the system locks the input devices since, well, you closed the lid. It's probably not a problem for most people.

Keeping Bluetooth live all the time

Cellular carriers generally round your GPRS usage up when you disconnect. Sometimes it's up to a kilobyte, other times it's 10kb, 25kb, or maybe even more when you're roaming. Also, it can be nice to keep things like instant messaging and ssh sessions open all the time.

The Nokia 770 has a magnetic switch in its metal cover which is used to trigger dbus events when you put the lid on. The service "btcond" listens for these dbus events, and shuts down Bluetooth when you put the lid on, of course terminating any GPRS link.

If you look inside the btcond binary, you will find the string:

/sys/devices/platform/gpio-switch/prot_shell/cover_switch

I replaced cover_switch with cover_svitch. Then, I executed /etc/init.d/btcond stop, and then started up my new btcond-hack binary in an xterm.

Since there are never any cover_svitch messages, BT is always on - or, at least, always in the "cover off" state. GPRS links can stay live for many, many hours without a problem.

The next thing to do, I think, would be to create a mini daemon, which would listen for cover_switch messages, and would then, if appropriate, fire off a cover_svitch message for bluetooth and a cover_stitch message (to chose a random example) for wifi. Thus, at run time, you could decide on your preferred behaviour.

(Comment by JariKirma: I think modifying btcond (found also in source code form, included in osso-gwconnect, interface documentation can be found here: http://www.maemo.org/platform/docs/osso-gwconnect.html) to support a "mode" change through D-BUS and/or command line argument would be most reasonable. Something like "always-on" and "normal", but btcond already exports mode as either "normal" or "flight", and flight should always override other functionality, and "always-on" and "flight" are not exactly mutually exclusive, so the feature should be provided through other com.nokia.btcond.request name.)

(Response from GopiFlaherty: Wow. I was under the mistaken impression that the wireless stuff was all closed. I definitely agree that your suggestions are the right thing to do - I think providing a control panel UI of some kind to adjust the lid closed behaviour would be the best way. I'm too busy to really work on this right now, and I also know zero about D-BUS, so I won't be working on this for a few weeks. If anybody else wants to take up the task, feel free. I'll update the wiki if I start working on the task again. Here's the direct URL to the download: http://stage.maemo.org/pool/maemo1.1rc5/free/source/o/osso-gwconnect/osso-gwconnect_0.81.1.tar.gz )

One thing I did notice is that bluetooth keyboards cease working when you close the lid. They'll stay connected, but the system locks the input devices since, well, you closed the lid. It's probably not a problem for most people.

CategoryBluetooth