←  [EN] Enduser support

Forums

»

HowTo: connect a Bluetooth keyboard in Ope...

's foto socks 2 jul 2014

Hi,

 

yesterday I made a few tests with a Logitech Bluetooth keyboard on my ET10000 and OpenPli 4.

My Bluetooth stick is from Ultron (don't know the exact type) and I connected it to one of the rear USB ports.

I just wanted to let you know my findings here.

 

First I had to install the Bluetooth drivers and testtools from the repository:

 

root@et10000:~# opkg install packagegroup-base-bluetooth
Installing packagegroup-base-bluetooth (1.0-r83) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/et10000/packagegroup-base-bluetooth_1.0-r83_et10000.ipk.
packagegroup-base-bluetooth: unsatisfied recommendation for kernel-module-bluetooth
packagegroup-base-bluetooth: unsatisfied recommendation for kernel-module-sco
packagegroup-base-bluetooth: unsatisfied recommendation for kernel-module-hidp
packagegroup-base-bluetooth: unsatisfied recommendation for kernel-module-l2cap
Installing bluez4 (4.101-r6) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/bluez4_4.101-r6_mips32el.ipk.
Installing libusb-1.0-0 (1.0.9-r1) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/libusb-1.0-0_1.0.9-r1_mips32el.ipk.
Installing libusb-0.1-4 (1:0.1.5-r0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/libusb-0.1-4_0.1.5-r0_mips32el.ipk.
Installing libasound-module-bluez (4.101-r6) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/libasound-module-bluez_4.101-r6_mips32el.ipk.
Installing kernel-module-bnep (3.13.8-r0.0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/et10000/kernel-module-bnep_3.13.8-r0.0_et10000.ipk.
Installing kernel-module-rfcomm (3.13.8-r0.0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/et10000/kernel-module-rfcomm_3.13.8-r0.0_et10000.ipk.
Installing kernel-module-hci-uart (3.13.8-r0.0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/et10000/kernel-module-hci-uart_3.13.8-r0.0_et10000.ipk.
Installing kernel-module-hci-vhci (3.13.8-r0.0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/et10000/kernel-module-hci-vhci_3.13.8-r0.0_et10000.ipk.
Configuring kernel-module-rfcomm.
Configuring libusb-1.0-0.
Configuring libusb-0.1-4.
Configuring libasound-module-bluez.
Configuring kernel-module-hci-uart.
Configuring kernel-module-hci-vhci.
Configuring kernel-module-bnep.
Configuring bluez4.
Configuring packagegroup-base-bluetooth.
depmod: ERROR: Module 'hci_vhci' has devname (vhci) but lacks major and minor information. Ignoring.

 

root@et10000:~# opkg install bluez4-testtools
Installing bluez4-testtools (4.101-r6) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/bluez4-testtools_4.101-r6_mips32el.ipk.
Installing python-dbus (1.2.0-r0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/python-dbus_1.2.0-r0_mips32el.ipk.
Installing libdbus-glib-1-2 (0.100.2-r0) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/libdbus-glib-1-2_0.100.2-r0_mips32el.ipk.
Installing python-pygobject (2.27.91-r6) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/python-pygobject_2.27.91-r6_mips32el.ipk.
Installing libpyglib-2.0-python0 (2.27.91-r6) to root...
Downloading http://downloads.pli-images.org/feeds/openpli-4/mips32el/libpyglib-2.0-python0_2.27.91-r6_mips32el.ipk.
Configuring libdbus-glib-1-2.
Configuring python-dbus.
Configuring libpyglib-2.0-python0.
Configuring python-pygobject.
Configuring bluez4-testtools.

root@et10000:~# opkg files bluez4-testtools
Package bluez4-testtools (4.101-r6) is installed on root and has the following files:
/usr/lib/bluez4/test/hsplay
/usr/lib/bluez4/test/test-serial-proxy
/usr/lib/bluez4/test/simple-agent
/usr/lib/bluez4/test/test-oob
/usr/lib/bluez4/test/
/usr/lib/bluez4/test/test-proximity
/usr/lib/bluez4/test/test-network
/usr/lib/bluez4/test/test-serial
/usr/lib/bluez4/test/test-input
/usr/lib/bluez4/test/test-attrib
/usr/lib/bluez4/test/test-device
/usr/lib/bluez4/test/test-telephony
/usr/lib/bluez4/test/sap-client
/usr/lib/bluez4/test/test-adapter
/usr/lib/bluez4/test/test-thermometer
/usr/lib/bluez4/test/list-devices
/usr/lib/bluez4/test/test-nap
/usr/lib/bluez4/test/hsmicro
/usr/lib/bluez4/test/test-sap-server
/usr/lib/bluez4/test/test-manager
/usr/lib/bluez4/
/usr/lib/bluez4/test/test-health-sink
/usr/lib/bluez4/test/monitor-bluetooth
/usr/lib/bluez4/test/test-health
/usr/lib/bluez4/test/test-audio
/usr/lib/bluez4/test/test-discovery
/usr/lib/bluez4/test/test-service
/usr/lib/bluez4/test/simple-player
/usr/lib/bluez4/test/simple-endpoint
/usr/lib/bluez4/test/simple-service

 

After a reboot start the Bluetooth daemon:

 

root@et10000:~# bluetoothd

 

Make the keyboard discoverable by pressing the reset button and scan for it:

 

root@et10000:~# hcitool scan
Scanning ...
        00:07:61:9C:E2:27       Logitech Cordless MediaBoard Pro(TM)

 

Then pair the device:

 

root@et10000:~# /usr/lib/bluez4/test/simple-agent hci0 00:07:61:9C:E2:27
RequestPinCode (/org/bluez/603/hci0/dev_00_07_61_9C_E2_27)
Enter PIN Code: 0000
< also enter 0000 on the keyboard and press Return >
Release
New device (/org/bluez/603/hci0/dev_00_07_61_9C_E2_27)

 

Some of the testtools are not working out of the box so i had to modify them.

In the files test-device, test-discovery and test-manager

replace

 

from gi.repository import GObject

with

 

import gobject as GObject

 

Now we are able to mark the device as "trusted" so it could connect automatically next time:

 

/usr/lib/bluez4/test/test-device trusted 00:07:61:9C:E2:27 yes

 

Use the monitor tool to see if the device connects properly:

 

root@et10000:~# /usr/lib/bluez4/test/monitor-bluetooth
{Device.PropertyChanged} [/org/bluez/578/hci0/dev_00_07_61_9C_E2_27] Connected = 1
{Input.PropertyChanged} [/org/bluez/578/hci0/dev_00_07_61_9C_E2_27] Connected = 1

 

View summary:

 

root@et10000:~# /usr/lib/bluez4/test/list-devices
[ /org/bluez/578/hci0 ]
    Name = et10000
    Powered = 1
    Devices = dev_00_07_61_9C_E2_27
    DiscoverableTimeout = 0
    PairableTimeout = 0
    Discoverable = 0
    Address = 00:02:72:DC:49:B4
    Discovering = 0
    Pairable = 1
    Class = 0
    UUIDs = 0x1000 0x1001 0x1112 0x111f 0x110c 0x110e
    [ /org/bluez/578/hci0/dev_00_07_61_9C_E2_27 ]
        Product = 0xb30a
        Vendor = 0x046d
        Name = Logitech Cordless MediaBoard Pro(TM)
        Paired = 1
        Adapter = /org/bluez/578/hci0
        Alias = Logitech Cordless MediaBoard Pro(TM)
        Version = 0x011b
        Connected = 1
        UUIDs = 0x1124 0x1200
        Address = 00:07:61:9C:E2:27
        Services = dbus.Array([], signature=dbus.Signature('o'), variant_level=1)
        Blocked = 0
        Class = 0x002540
        Trusted = 1
        Icon = input-keyboard

 

Here is the output of /var/log/messages while doing this:

 

Jul  1 22:48:19 et10000 daemon.notice dbus[457]: [system] Activating service name='org.bluez' (using servicehelper)
Jul  1 22:48:19 et10000 daemon.notice dbus[457]: [system] Activated service 'org.bluez' failed: Launch helper exited with unknown return code 1
Jul  1 22:48:29 et10000 daemon.info bluetoothd[578]: Bluetooth daemon 4.101
Jul  1 22:48:29 et10000 daemon.info bluetoothd[578]: Starting SDP server
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: BNEP filters: protocol
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: BNEP socket layer initialized
Jul  1 22:48:30 et10000 daemon.info bluetoothd[578]: Bluetooth Management interface initialized
Jul  1 22:48:30 et10000 daemon.err bluetoothd[578]: Parsing /etc/bluetooth/serial.conf failed: No such file or directory
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: RFCOMM TTY layer initialized
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: RFCOMM socket layer initialized
Jul  1 22:48:30 et10000 user.info kernel: Bluetooth: RFCOMM ver 1.11
Jul  1 22:48:30 et10000 daemon.err bluetoothd[578]: Could not get the contents of DMI chassis type
Jul  1 22:48:30 et10000 daemon.err bluetoothd[578]: Unknown command complete for opcode 19
Jul  1 22:48:30 et10000 daemon.info bluetoothd[578]: Adapter /org/bluez/578/hci0 has been enabled
Jul  1 23:12:12 et10000 user.err kernel: hid-generic 0005:046D:B30A.0001: unknown main item tag 0x0
Jul  1 23:12:12 et10000 user.info kernel: input: Logitech Cordless MediaBoard Pro(TM) as /devices/platform/ehci-brcm.2/usb3/3-1/3-1.4/3-1.4:1.0/bluetooth/hci0/hci0:12/input3
Jul  1 23:12:12 et10000 user.info kernel: hid-generic 0005:046D:B30A.0001: input,hidraw0: BLUETOOTH HID v1.1b Mouse [Logitech Cordless MediaBoard Pro(TM)] on 00:02:72:dc:49:b4

 

I could use the keyboard without problems. Even after switching off and on it connected automatically.

Controlling the box only with the keyboard doesn't make very much sense because of the missing color buttons (red, green, blue, yellow) but i helps a lot when you have to enter much text.

One problem is that there is no start script in /etc/init.d for the bluetoothd. After a reboot you have to start it manually again.

If someone has a startup script or is able to write one, please let me know.

 

The integrated touchpad mouse did not work. I don't know what the problem is exactly:

 

Jul  1 23:12:12 et10000 user.err kernel: hid-generic 0005:046D:B30A.0001: unknown main item tag 0x0

I will try to connect a separate Bluetooth mouse next weekend. Looks like a mouse is only useful with the browser/HbbTV anyway, correct?

 

Regards,

 

socks


Veranderd door socks, 2 juli 2014 - 12:24
Citeren

's foto MiLo 2 jul 2014

Nice effort, and thanks for posting this.

A bluetooth-agent plugin in Enigma2 (so you can type digits on the GUI using the remote or so) would help with pairing.

Since E2 "knows" when you plugin a BT dongle, it could automatically activate the required components (e.g. kernel modules and bluez4), scan the area, and attempt to pair with whatever is near.

Not much has been done with BT so far. In theory it should be possible to have the box report itself to be able to play audio over BT, but I don't think a generic USB dongle forwards the audio channel (BT chips usually have separate I2S connectors for that, the audio seems to travel outside the data channel or so) properly.

Other stuff (rfcomm and bnep) should also be possible.
Citeren

's foto socks 5 jul 2014

I made a start script to run bluetoothd automatically. Name the file "bluetoothd", put it in "etc/init.d/" and make it executable:

#!/bin/sh
case "$1" in
start)
        exec start-stop-daemon -S -x /usr/sbin/bluetoothd
        ;;
stop)
        exec start-stop-daemon -K -x /usr/sbin/bluetoothd
        ;;
restart|reload)
        $0 stop
        sleep 1
        $0 start
        ;;
*)
        echo "Usage: $0 start|stop|restart"
        exit 1
        ;;
esac
exit 0

 

 

Install the script with

 

root@et10000:~# update-rc.d bluetoothd defaults 30
Citeren

's foto Kermit00 23 aug 2014

Hm, this doesn't work on my vu+solo

 

If I try simple-agent, I just get:

 

 

usr/lib/bluez4/test/simple-agent hci0 54:46:6B:00:10:F4
Traceback (most recent call last):
  File "/usr/lib/bluez4/test/simple-agent", line 102, in <module>
    manager = dbus.Interface(bus.get_object("org.bluez", "/"),
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

 

Maybe something is missing?

 

'hcitool scan' works, but I don't know how to pair with hcitool?

 

I tried:

 

root@vusolo2:~# hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:15:83:16:BE:9A  ACL MTU: 672:4  SCO MTU: 48:1
        UP RUNNING PSCAN ISCAN
        RX bytes:5667 acl:0 sco:0 events:157 errors:0
        TX bytes:743 acl:0 sco:0 commands:101 errors:0

root@vusolo2:~# hcitool scan
Scanning ...
        54:46:6B:00:10:F4       Bluetooth FAVI
root@vusolo2:~# hcitool cc 54:46:6B:00:10:F4
root@vusolo2:~# hcitool con
Connections:
        < ACL 54:46:6B:00:10:F4 handle 17 state 1 lm MASTER
root@vusolo2:~# hcitool auth 54:46:6B:00:10:F4
*** nothing happens for minutes ***
HCI authentication request failed: Connection timed out




 


Veranderd door Kermit00, 23 augustus 2014 - 17:43
Citeren

's foto Kermit00 25 aug 2014

tried again: Forgot to start bluetoothd :(

 

Now it works! Unfortunately I cannot use my keyboard with mediaportal (virtual keyboard) :(

My touchpad works with opera!

 

Is there no way to map the color buttons (and more like EPG, Channel Up/Down) to keyboard-keys? Just a few keys work: Ok = Enter, Exit = Escape, Menu = Space, Arrow-Keys = Arrow-Keys

Citeren

's foto Meega 6 feb 2015

How can i manualy connect because it's not working?

It's paired but not conected.

 

root@et10000:~# /usr/lib/bluez4/test/list-devices
[ /org/bluez/6529/hci0 ]
    Name = et10000-0
    Powered = 1
    Devices = dev_16_01_02_00_00_79 dev_00_09_DD_50_47_9A
    DiscoverableTimeout = 0
    PairableTimeout = 0
    Discoverable = 0
    Address = 00:09:DD:50:2B:40
    Discovering = 0
    Pairable = 1
    Class = 0
    UUIDs = 0x1000 0x1001 0x1112 0x111f 0x110c 0x110e
    [ /org/bluez/6529/hci0/dev_16_01_02_00_00_79 ]
        Product = 0x0239
        Vendor = 0x05ac
        Name = Bluetooth 3.0 Keyboard
        Paired = 1
        Adapter = /org/bluez/6529/hci0
        Alias = Bluetooth 3.0 Keyboard
        Version = 0x011b
        Connected = 0
        UUIDs = 0x1000 0x1124 0x1200
        Address = 16:01:02:00:00:79
        Services = dbus.Array([], signature=dbus.Signature('o'), variant_level=1)
        Blocked = 0
        Class = 0x002540
        Trusted = 1
        Icon = input-keyboard
Citeren

's foto socks 6 feb 2015

Maybe this works:

/usr/lib/bluez4/test/test-input connect 16:01:02:00:00:79

Veranderd door socks, 6 februari 2015 - 19:50
Citeren

's foto Meega 6 feb 2015

Thanks but

 

root@et10000:~# /usr/lib/bluez4/test/test-input connect 16:01:02:00:00:79
Traceback (most recent call last):
  File "/usr/lib/bluez4/test/test-input", line 11, in <module>
    manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
 
Is there a way to remove the pairing and try again?
 
Oh ,it's not a logitech but a cheap keyboard from a cheap store :D and i think that it goes wrong at pairing because the keyboard keeps flashing (it's in pairing mode)
Citeren

's foto Meega 7 feb 2015

It's connected now but the keyboard is not working.(yet)

Citeren

's foto socks 7 feb 2015

You can remove the pairing manually by editing the config files in /var/lib/bluetooth.

If the pairing with the keyboard does not succeed I'm afraid it will not work. The keyboard has to know which mac address to connect to when you switch it on.

Citeren

's foto Meega 7 feb 2015

Well at the moment it connects.

Only the keyboard doesn't type anything.

 

I will try to delete everything and start over.

 

thanks so far

Citeren

's foto Meega 8 feb 2015

This is the log after bluetoothd and  /usr/lib/bluez4/test/test-input connect 16:01:02:00:00:79

 

Feb  8 12:00:56 et10000 daemon.info bluetoothd[9930]: Bluetooth daemon 4.101
Feb  8 12:00:56 et10000 daemon.info bluetoothd[9930]: Starting SDP server
Feb  8 12:00:56 et10000 daemon.info bluetoothd[9930]: Bluetooth Management interface initialized
Feb  8 12:00:56 et10000 daemon.err bluetoothd[9930]: Could not get the contents of DMI chassis type
Feb  8 12:00:56 et10000 daemon.info bluetoothd[9930]: Adapter /org/bluez/9930/hci0 has been enabled
Feb  8 12:00:56 et10000 daemon.err bluetoothd[9930]: hci0: Load Long Term Keys (0x0013) failed: Not Supported (0x0c)
Feb  8 12:01:25 et10000 daemon.err bluetoothd[9930]: No agent available for request type 0
Feb  8 12:01:25 et10000 daemon.err bluetoothd[9930]: btd_event_request_pin: Operation not permitted
 
 
somebody an idear
Citeren

's foto socks 8 feb 2015

Did the pairing with the keyboard succeed? You said, that the keyboard keeps flashing in post #8.

Citeren

's foto Meega 8 feb 2015

Yes but succeededafter post 8 :)

But it's not working on the box.

Does i have to do something on the box?

 

root@et10000:~#  /usr/lib/bluez4/test/list-devices
[ /org/bluez/14141/hci0 ]
    Name = et10000-0
    Powered = 1
    Devices = dev_16_01_02_00_00_79
    DiscoverableTimeout = 0
    PairableTimeout = 0
    Discoverable = 0
    Address = 00:09:DD:50:2B:40
    Discovering = 0
    Pairable = 1
    Class = 0
    UUIDs = 0x1000 0x1001 0x1112 0x111f 0x110c 0x110e
    [ /org/bluez/14141/hci0/dev_16_01_02_00_00_79 ]
        Product = 0x0239
        Vendor = 0x05ac
        Name = Bluetooth 3.0 Keyboard
        Paired = 1
        Adapter = /org/bluez/14141/hci0
        Alias = Bluetooth 3.0 Keyboard
        Version = 0x011b
        Connected = 1
        UUIDs = 0x1000 0x1124 0x1200
        Address = 16:01:02:00:00:79
        Services = dbus.Array([], signature=dbus.Signature('o'), variant_level=1)
        Blocked = 0
        Class = 0x002540
        Trusted = 0
        Icon = input-keyboard

Veranderd door Meega, 8 februari 2015 - 20:52
Citeren

's foto wortellica 8 feb 2015

my logitech k400 work,s perfect with the 10k  :)

Citeren