This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK7.1 keypad connect ubunt14.4 success!

I try to use SDK8.1.1 example connect ubuntu14.4 with CSR dongle. Seems it create connection fail. I downgrade to SDK7.1, it connection pair correctly. But it'll terminate connection once finish pair.

Here is hcidump

HCI Event: Number of Completed Packets (0x13) plen 5 handle 63 packets 1 ACL data: handle 63 flags 0x02 dlen 10 ATT: Read By Type resp (0x09) length: 4 handle 0x0005, value 0xc1 0x03 < HCI Command: Disconnect (0x01|0x0006) plen 3 handle 63 reason 0x13 Reason: Remote User Terminated Connection HCI Event: Command Status (0x0f) plen 4 Disconnect (0x01|0x0006) status 0x00 ncmd 1 HCI Event: Disconn Complete (0x05) plen 4 status 0x00 handle 63 reason 0x16 Reason: Connection Terminated by Local Host

WireShark have same result. It also indicate Host terminate connect reason 0x13.

  • I tried now with SDK 8.1, ubuntu 14.04, bluez 4.101-0ubuntu13.1 and the CSR dongle, and I didn't have any problems connecting. Which tools and commands do you use to connect?

    Make sure you delete any bond info. In the terminal write:

    bluez-test-device remove xx:xx:xx:xx:xx:xx
    

    Then I did the following to connect and enable notifications:

    gatttool -b xx:xx:xx:xx:xx:xx -t random -I
    
    > connect
    > sec-level high
    > char-write-req 0x0017 01
    

    EDIT:

    The reason why it disconnects while holding down button 0 is because connection_buttons_configure() in bsp_btn_ble.c configure a long push on button 0 to disconnect.

    #define BTN_ID_DISCONNECT  0;  
    #define BTN_ACTION_DISCONNECT  BSP_BUTTON_ACTION_LONG_PUSH
    

    connection_buttons_configure() is called in the function bsp_btn_ble_on_ble_evt() whenever the BLE event says BLE_GAP_EVT_CONNECTED. This is a part of the bsp library, but I agree that it doesn't go along well with the hids demos since you push the buttons a lot in the demos. You can simply set the BTN_ID_DISCONNECT define to something else than the 4 buttons, and it will not bother you anymore.

    When it comes to Linux not being able to reconnect, I'm not sure what the problem is. I am not able to reproduce the error here. I've tried with Bluez 4 and 5, Ubuntu and Debian, as well as Android. What I noticed was that in Bluez 5, if I wrote the connect command before the pair command, I had troubles getting Linux to recognize it as a HID device. So, in bluetoothctl I just wrote pair XX:XX:XX:XX:XX:XX without connecting first.

  • Here is clean 14.04 default bluez info. Seems which based on ver 4.101. Do I need to upgrade to latest 5.32?

    apt-cache show bluez
    Package: bluez
    Priority: optional
    Section: admin
    Installed-Size: 2544
    Maintainer: Ubuntu Developers <[email protected]>
    Original-Maintainer: Debian Bluetooth Maintainers <[email protected]>
    Architecture: amd64
    Version: 4.101-0ubuntu13.1
    Replaces: bluez-audio (<= 3.36-3), bluez-input, bluez-network, bluez-serial, bluez-utils (<= 3.36-3), udev (<< 170-1)
    Depends: libc6 (>= 2.15), libdbus-1-3 (>= 1.1.1), libglib2.0-0 (>= 2.28.0), libreadline6 (>= 6.0), libudev1 (>= 183), libusb-0.1-4 (>= 2:0.1.12), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), module-init-tools, udev (>= 170-1), lsb-base, dbus, python3-dbus
    Suggests: bluez-hcidump
    Conflicts: bluez-audio (<= 3.36-3), bluez-utils (<= 3.36-3)
    Breaks: udev (<< 170-1)
    Filename: pool/main/b/bluez/bluez_4.101-0ubuntu13.1_amd64.deb
    Size: 589688
    MD5sum: ee38cc86673b88e99743f0ac1a5415e0
    SHA1: d79cdb2eb482e7293c0903e813ff6cbd2b814048
    SHA256: 11f07796d9ef15aeddae7aa5f2f79ecb3c043a959d0b3986dc4deac1f548acf4
    Description-en: Bluetooth tools and daemons
     This package contains tools and system daemons for using Bluetooth devices.
     .
     BlueZ is the official Linux Bluetooth protocol stack. It is an Open Source
     project distributed under GNU General Public License (GPL).
    Description-md5: ef25d6a9f4a57e78f32faa7b58ef4e59
    Multi-Arch: foreign
    Homepage: http://www.bluez.org
    
  • I'm using the same version of bluez. It is the ble_app_hids_keyboard example you are using right? Can you please post the hex-file so I can try it here?

  • nrf51422_xxac_s110.hex Attach ble_mouse SDK9.0 s110 8.02 hex file as request, board compatible BOARD_PCA10001 with MCU 51822xxAC. nrf51422_xxac_s110.hex Attach ble_keypad SDK9.0 s110 8.02 hex file as request, board compatible BOARD_PCA10001 with MCU 51822xxAC.

    I try latest bluez 5.32 on ubuntu 64bit 14.04. Remove default bluez4.101. Then use cmdline tool manually connect nordics 9.0 SDK ble_mouse. Here is report. Detail steps reference bluez5 part in wiki.gentoo.org/.../Bluetooth I can pair connect mouse at first time PC power on.

    			[bluetooth]# connect EE:30:98:D1:71:21
    			Attempting to connect to EE:30:98:D1:71:21
    			[CHG] Device EE:30:98:D1:71:21 Connected: yes
    			Connection successful
    			[Nordic_Mouse]# info EE:30:98:D1:71:21
    			Device EE:30:98:D1:71:21
    				Name: Nordic_Mouse
    				Alias: Nordic_Mouse
    				Appearance: 0x03c2
    				Icon: input-mouse
    				Paired: yes
    				Trusted: no
    				Blocked: no
    				Connected: yes
    				LegacyPairing: no
    				UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    				UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    				UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    				UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
    				UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
    				Modalias: usb:v1915pEEEEd0001
    				RSSI: -69
    			[CHG] Controller 00:1A:7D:DA:71:02 Discoverable: no
    

    Then I short press button0 , I can see cursor move at expected. Till now everything looks well.

    ACL data: handle 71 flags 0x02 dlen 10 ATT: Handle notify (0x1b) handle 0x001a value 0xfb 0x0f 0x00

      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
    
      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
    
      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
    
      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
    
      		> ACL data: handle 71 flags 0x02 dlen 10
      			ATT: Handle notify (0x1b)
      			  handle 0x001a
      			  value 0xfb 0x0f 0x00 
    
      		> HCI Event: Disconn Complete (0x05) plen 4
      			status 0x00 handle 71 reason 0x13
      			Reason: Remote User Terminated Connection
    

    But at last, after long press button0, mouse disconnect gracefully. Then even after reconnect successful, press button0 have no effect.Till reboot PC.

    Keypad have same issue with mouse. If long press button0 or press button0 very fast(it'll treat as long press), will disconnect. Even after reconnect ok, keyboard button0 can't say hello again. I can't see problem on host side, but problem really happen at someplace.

  • attach hex in following answers. Can you download it ? @Stian.

Related