< Ubuntu Hardy -> Intrepid upgrade : screen saver
archive
Wii remote in ubuntu intrepid 8.10>
(blog entry)
Monday 24 November 2008
Ubuntu Hardy -> Intrepid upgrade : bluetooth
It seems that the hidd binary has disappeared after the upgrade. hidd is a server that allows bluetooth keyboards, mice, mobile phones etc. to be connected.
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/281580
apt-get install bluez-compat
On closer inspection, many things have changed!!
- daemons hcid and sdpd have been replaced with the new super daemon bluetoothd
- New config file /etc/bluetooth/main.conf added
- hcid.conf has also been removed.
- pin number cannot be specified in a config file anymore, instead dbus is used.
I can't discover my linux box from my phone (Sony Ericsson K800), i tracked this down to PSCAN and ISCAN not being enabled on the bluetooth adapter. This can be fixed with the following:
# enable PSCAN and ISCAN
hciconfig hci0 piscan
# check it worked
hciconfig
hci0: Type: USB
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:20425 acl:115 sco:0 events:526 errors:0
TX bytes:5543 acl:84 sco:0 commands:340 errors:0
Now I can see my the bluetooth adapter, although I still can't pair
I found an application bluez-pin, supplied by a package of the same name (search with dpkg -S bluez-pin, but this seems to be obsoleted now.
I use bluetooth on a mythtv box with mythtv running fullscreen, therefore I cannot be doing with popup messages asking pin numbers etc. Instead I prefer to use a static code, not 1234, or 0000 though. This allows friends etc. to use their phones to control the tv.
I found a useful python script in the source code for bluez-utils
# get source apt-get source bluez-utils # look in source code cd bluez-4.12/test ./simple-agent # you may need to remove bluez-gnome, because it tries # to use same ID on the dbus (error message dbus.exceptions.DBusException: # org.bluez.Error.AlreadyExists: Agent already exists) apt-get remove bluez-gnome killall bluetooth-applet
Note, if you get this error then it is because bluetoothd is not running
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files
If you want to use a fixed pin code change the code in test/simple-agent. An exercise for the reader could be to read the value from /etc/bluetooth/pin
def RequestPinCode(self, device):
print "RequestPinCode (%s)" % (device)
return "1234"; #raw_input("Enter PIN Code: ")
Now onto hidd, the mobile phone doesn't seem to be able to connect. Errors such as the following are seen
hidd --connect 00:12:34:56:78:9A HID create error 77 (File descriptor in bad state)
I tracked the problems to hciconfig parameters do not match previous settings in the now defunct hcid.conf. Setup is now:
hciconfig hci0 piscan
hciconfig hci0 lm master
hciconfig hci0 auth
hciconfig hci0 encrypt
# Check the settings
hciconfig -a
hci0: Type: USB
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN AUTH ENCRYPT
RX bytes:64712 acl:1063 sco:0 events:2090 errors:0
TX bytes:29613 acl:1028 sco:0 commands:645 errors:0
Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy:
Link mode: MASTER
Back to the problems with HID. My phone simply won't connect, I just get messages (on the phone saying) Bluetooth connection failed. Check Bluetooth settings on other decice. Bluetooth on. Device visible. Device in range.
It seems the new bluetooth system has a HID daemon built-in. This is in the form of an 'input' plugin. I have found by deleting this file, and running the legacy hidd program supplied in bluez-compat that I'm able to use my phone
# remove input plugin (it won't work with my phone) rm /usr/lib/bluetooth/plugins/input.so # Restart the bluetooth daemon /etc/init.d/bluetooth stop /etc/init.d/bluetooth start # Load the legacy HID daemon (hidd) hidd --server # Now I can connect my mobile phone !! echo "Happy days"