test.c: pair and connect to a BLE mouse or keyboard

When pairing, the test program checks if the target device is
a HID device. If yes, it pairs and connects to the device.

Note that some keyboards may not work correctly yet as they
suffer from some other issues.

This CL is mostly motivated by Sonny's and Dmitry's test code.

BUG=chromium:880746
TEST=Follow the steps below:
On your host:
- Build and deploy newblue ot the DUT.

On the DUT:
  $ restart bluetoothd

  # To pair and connect to a Microsoft "Designer Mouse",
  # long press the button on the bottom of the mouse until
  # the LED flashes.
  $ ./new_blue_test hidtest "Designer Mouse"

  # To pair and connect to a Logitech "Keyboard K780",
  # long press F1, F2, or F3 button on K780 until the white
  # LED on that button blinks quickly.
  $ ./new_blue_test hidtest "Keyboard K780"
  # On success, it would prompt you to enter 6-digit passkey as follows:
  # I@ test.c:494: ######## Please enter 003196 with the keyboard with
  # R-C7:B8:7B:47:7D:97
  # On the keyboard, type 003196 and press ENTER.

Change-Id: Ib0a7156fb7a8cf023fd7104c6c60e50699876e47
Reviewed-on: https://chromium-review.googlesource.com/1229538
Commit-Ready: Shyh-In Hwang <josephsih@chromium.org>
Tested-by: Sonny Sasaka <sonnysasaka@chromium.org>
Tested-by: Shyh-In Hwang <josephsih@chromium.org>
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
1 file changed