Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH v2 BlueZ] build: Add coverage support
From: Marcel Holtmann @ 2013-12-23 13:57 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CABBYNZ+zw_yuUbp1GvMVkOVDQUr_4Xup+SUy4nhj=kb_QaKXUg@mail.gmail.com>

Hi Luiz,

>> Coverage is enabled with --enable-maintainer-mode, 2 new targets are
>> added 'coverage' and 'clean-coverage', the first generate the reports
>> using lcov and depend on the second to cleanup previous generated
>> reports and .gcda files.
>> ---
>> .gitignore   |  4 ++++
>> Makefile.am  | 18 ++++++++++++++++++
>> acinclude.m4 |  4 ++++
>> configure.ac |  4 ++++
>> 4 files changed, 30 insertions(+)
>> 
>> diff --git a/.gitignore b/.gitignore
>> index c570728..21dbe26 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -3,6 +3,8 @@
>> *.lo
>> *.la
>> *.so
>> +*.gcno
>> +*.gcda
>> .deps
>> .libs
>> .dirstamp
>> @@ -27,7 +29,9 @@ stamp-h1
>> autom4te.cache
>> test-driver
>> test-suite.log
>> +coverage.info
>> 
>> +coverage
>> lib/bluez.pc
>> lib/bluetooth
>> src/builtin.h
>> diff --git a/Makefile.am b/Makefile.am
>> index 15cc149..7380e61 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -331,5 +331,23 @@ lib/bluetooth/%.h: lib/%.h
>>        $(AM_V_at)$(MKDIR_P) lib/bluetooth
>>        $(AM_V_GEN)$(LN_S) -f "$(abs_top_builddir)"/$< $@
>> 
>> +if MAINTAINER_MODE
>> +clean-coverage:
>> +       -find $(top_builddir) -name "*.gcda" -delete
>> +       @lcov --directory $(top_builddir) --zerocounters
>> +       $(RM) -r coverage $(top_builddir)/coverage.info
>> +
>> +coverage: clean-coverage check
>> +       @lcov --compat-libtool --directory $(top_builddir) --capture \
>> +                               --output-file $(top_builddir)/coverage.info
>> +       $(AM_V_at)$(MKDIR_P) coverage
>> +       @genhtml -o coverage/ $(top_builddir)/coverage.info
>> +
>> +clean-local: clean-coverage
>> +       -find $(top_builddir) -name "*.gcno" -delete
>> +       $(RM) -r lib/bluetooth
>> +
>> +else
>> clean-local:
>>        $(RM) -r lib/bluetooth
>> +endif
>> diff --git a/acinclude.m4 b/acinclude.m4
>> index 2065852..afc7c6d 100644
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -51,6 +51,10 @@ AC_DEFUN([MISC_FLAGS], [
>>                        misc_ldflags="$misc_ldflags -pie"
>>                fi
>>        ])
>> +       if (test "$USE_MAINTAINER_MODE" = "yes"); then
>> +               misc_cflags="$misc_cflags --coverage"
>> +               misc_ldflags="$misc_ldflags --coverage"
>> +       fi
>>        AC_SUBST([MISC_CFLAGS], $misc_cflags)
>>        AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
>> ])
>> diff --git a/configure.ac b/configure.ac
>> index 18d0b55..4f36355 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -252,4 +252,8 @@ AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
>>                                        [enable_android=${enableval}])
>> AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
>> 
>> +if (test "$USE_MAINTAINER_MODE" = "yes"); then
>> +       AC_CHECK_PROG([LCOV], [lcov], [yes], AC_MSG_ERROR(lcov is required))
>> +fi
>> +
>> AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
>> --
>> 1.8.3.1
> 
> Any feedback regarding this patch? It is now using maintainer mode as
> you suggested.

I have not tested it yet. In general this looks just fine. However the if else with clean-local in each branches is still something that I think could be done a bit cleaner.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH 2/4] android/bluetooth: Add support for DUT mode configure command
From: Marcel Holtmann @ 2013-12-23 13:55 UTC (permalink / raw)
  To: Andrei Emeltchenko
  Cc: Szymon Janc, linux-bluetooth@vger.kernel.org development
In-Reply-To: <20131223084607.GA19604@aemeltch-MOBL1>

Hi Andrei,

>> This allows to enable and disable DUT mode.
> 
> Hi Szymon, could you add some more info about the mode?

please refer to the Bluetooth Core specification that explain Device Under Test (DUT) mode. It is a commonly used term. There is really no need to go all out and explain it here.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH v2 2/2] android/bluetooth: Print error on unimplemented functions
From: Marcel Holtmann @ 2013-12-23 13:53 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org development
In-Reply-To: <1387796839-8164-2-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

> Functions, callbacks or properties that are not implemented due to
> being bogus or not feasible now prints error messages.
> ---
> android/bluetooth.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 59f0810..0700972 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -2146,6 +2146,10 @@ static void handle_get_adapter_prop_cmd(const void *buf, uint16_t len)
> 		break;
> 	}
> 
> +	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
> +		error("Failed to get adapter property (type %u status %u)",
> +							cmd->type, status);
> +
> 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_ADAPTER_PROP, status);
> }
> 
> @@ -2293,6 +2297,10 @@ static void handle_set_adapter_prop_cmd(const void *buf, uint16_t len)
> 		break;
> 	}
> 
> +	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
> +		error("Failed to set adapter property (type %u status %u)",
> +							cmd->type, status);
> +
> 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_ADAPTER_PROP, status);
> }
> 
> @@ -2745,6 +2753,10 @@ static void handle_get_remote_device_prop_cmd(const void *buf, uint16_t len)
> 		break;
> 	}
> 
> +	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
> +		error("Failed to get device property (type %u status %u)",
> +							cmd->type, status);
> +
> failed:
> 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_REMOTE_DEVICE_PROP,
> 								status);
> @@ -2809,6 +2821,10 @@ static void handle_set_remote_device_prop_cmd(const void *buf, uint16_t len)
> 		break;
> 	}
> 
> +	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
> +		error("Failed to set device property (type %u status %u)",
> +							cmd->type, status);
> +
> failed:
> 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_REMOTE_DEVICE_PROP,
> 									status);
> @@ -2818,6 +2834,8 @@ static void handle_get_remote_service_rec_cmd(const void *buf, uint16_t len)
> {
> 	/* TODO */
> 
> +	error("get_remote_service_record not supported");
> +
> 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_REMOTE_SERVICE_REC,
> 							HAL_STATUS_FAILED);
> }
> @@ -2914,7 +2932,7 @@ static void handle_dut_mode_send_cmd(const void *buf, uint16_t len)
> 		return;
> 	}
> 
> -	DBG("opcode %u", cmd->opcode);
> +	error("dut_mode_send not supported”);
> 
> 	/* TODO */
> 
> @@ -2932,7 +2950,7 @@ static void handle_le_test_mode_cmd(const void *buf, uint16_t len)
> 		return;
> 	}
> 
> -	DBG("opcode %u", cmd->opcode);
> +	error("le_test_mode not supported”);

please keep the cmd->opcode in the error message here in both cases. This is valuable information on what kind of HCI command the Java layer tries to send.

Regards

Marcel


^ permalink raw reply

* [PATCH] btdev: Return Command Status for Authentication Requested
From: Andrei Emeltchenko @ 2013-12-23 13:43 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

---
 emulator/btdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index d0dff74..9338260 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -1191,6 +1191,12 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
 		cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode);
 		break;
 
+	case BT_HCI_CMD_AUTH_REQUESTED:
+		if (btdev->type == BTDEV_TYPE_LE)
+			return;
+		cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode);
+		break;
+
 	case BT_HCI_CMD_REMOTE_NAME_REQUEST:
 		if (btdev->type == BTDEV_TYPE_LE)
 			goto unsupported;
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH v2 1/2] android/bluetooth: Add support for DUT mode configure command
From: Luiz Augusto von Dentz @ 2013-12-23 12:48 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1387796839-8164-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Mon, Dec 23, 2013 at 1:07 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> This allows to enable and disable DUT mode. This is special mode so
> adding more info from related kernel commit:
>
> "The Device Under Test (DUT) mode is useful for doing certification
> testing and so expose this as debugfs option.
>
> This mode is actually special since you can only enter it. Restoring
> normal operation means that a HCI Reset is required. The current mode
> value gets tracked as a new device flag and when disabling it, the
> correct command to reset the controller is sent."
> ---
>  android/bluetooth.c | 29 ++++++++++++++++++++++++++---
>  1 file changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 2e75864..59f0810 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -50,6 +50,8 @@
>  #include "utils.h"
>  #include "bluetooth.h"
>
> +#define DUT_MODE_FILE "/sys/kernel/debug/bluetooth/hci%u/dut_mode"
> +
>  #define DEVICE_ID_SOURCE       0x0002  /* USB */
>  #define DEVICE_ID_VENDOR       0x1d6b  /* Linux Foundation */
>  #define DEVICE_ID_PRODUCT      0x0247  /* BlueZ for Android */
> @@ -2872,13 +2874,34 @@ failed:
>  static void handle_dut_mode_conf_cmd(const void *buf, uint16_t len)
>  {
>         const struct hal_cmd_dut_mode_conf *cmd = buf;
> +       char path[FILENAME_MAX];
> +       uint8_t status;
> +       int fd, ret;
>
>         DBG("enable %u", cmd->enable);
>
> -       /* TODO */
> +       snprintf(path, sizeof(path), DUT_MODE_FILE, adapter.index);
>
> -       ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF,
> -                                                       HAL_STATUS_FAILED);
> +       fd = open(path, O_WRONLY);
> +       if (fd < 0) {
> +               status = HAL_STATUS_FAILED;
> +               goto failed;
> +       }
> +
> +       if (cmd->enable)
> +               ret = write(fd, "1", sizeof("1"));
> +       else
> +               ret = write(fd, "0", sizeof("0"));
> +
> +       if (ret < 0)
> +               status = HAL_STATUS_FAILED;
> +       else
> +               status = HAL_STATUS_SUCCESS;
> +
> +       close(fd);
> +
> +failed:
> +       ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF, status);
>  }
>
>  static void handle_dut_mode_send_cmd(const void *buf, uint16_t len)
> --
> 1.8.3.2

Pushed, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH 6/6] android/tester: Refactor HAL callback check
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1387799429-6674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

This patch removes ID enum in favour of test cases having their own as
implementation of callbacks checking test conditions.
Now each test case uses it own callback function and within it
test conditions are checked, e.g. with property get test case, property
and if it's properly cb is checked.
Count of expected callback is defined as a number and after calling
proper cb, value is decremented.
This also changes to generic - property check used within HAL cb.
---
 android/android-tester.c | 403 ++++++++++++++++++++++-------------------------
 1 file changed, 185 insertions(+), 218 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 77dfa89..8c12b70 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -42,39 +42,13 @@
 
 #include "utils.h"
 
-#define ADAPTER_PROPS ADAPTER_PROP_BDADDR, ADAPTER_PROP_BDNAME, \
-			ADAPTER_PROP_UUIDS, ADAPTER_PROP_COD, \
-			ADAPTER_PROP_TYPE, ADAPTER_PROP_SCAN_MODE, \
-			ADAPTER_PROP_BONDED_DEVICES, ADAPTER_PROP_DISC_TIMEOUT
-
-/*
- * those are assigned to HAL methods and callbacks, we use ID later
- * on mapped in switch-case due to different functions prototypes.
- */
-
-enum hal_bluetooth_callbacks_id {
-	ADAPTER_TEST_END,
-	ADAPTER_STATE_CHANGED_ON,
-	ADAPTER_STATE_CHANGED_OFF,
-	ADAPTER_PROP_BDADDR,
-	ADAPTER_PROP_BDNAME,
-	ADAPTER_PROP_UUIDS,
-	ADAPTER_PROP_COD,
-	ADAPTER_PROP_TYPE,
-	ADAPTER_PROP_SCAN_MODE,
-	ADAPTER_PROP_DISC_TIMEOUT,
-	ADAPTER_PROP_SERVICE_RECORD,
-	ADAPTER_PROP_BONDED_DEVICES,
-	ADAPTER_DISCOVERY_STATE_ON,
-	ADAPTER_DISCOVERY_STATE_OFF,
-	REMOTE_DEVICE_FOUND,
-};
-
 struct generic_data {
 	int expected_adapter_status;
 	uint32_t expect_settings_set;
+	int expected_cb_count;
+	bt_property_t set_property;
 	bt_property_t expected_property;
-	uint8_t expected_hal_callbacks[];
+	bt_callbacks_t expected_hal_cb;
 };
 
 struct socket_data {
@@ -93,10 +67,6 @@ struct socket_data {
 
 #define BT_STATUS_NOT_EXPECTED	-1
 
-/* User flags for Device Discovery */
-#define DEVICE_DISCOVERY_CANCEL_ON_START	0x01
-#define DEVICE_DISCOVERY_START_ON_START		0x02
-
 struct test_data {
 	struct mgmt *mgmt;
 	uint16_t mgmt_index;
@@ -111,14 +81,14 @@ struct test_data {
 	const btsock_interface_t *if_sock;
 
 	bool mgmt_settings_set;
-	bool hal_cb_called;
+	bool cb_count_checked;
 	bool status_checked;
 	bool property_checked;
 
-	bt_property_t test_property;
-	GSList *expected_callbacks;
+	/* Set to true if test conditions are initialized */
+	bool test_init_done;
 
-	uint32_t userflag;
+	int cb_count;
 };
 
 static char exec_dir[PATH_MAX + 1];
@@ -127,9 +97,9 @@ static void test_update_state(void)
 {
 	struct test_data *data = tester_get_data();
 
-	if (!(data->mgmt_settings_set))
+	if (!(data->cb_count_checked))
 		return;
-	if (!(data->hal_cb_called))
+	if (!(data->mgmt_settings_set))
 		return;
 	if (!(data->status_checked))
 		return;
@@ -194,27 +164,27 @@ static void command_generic_new_settings(uint16_t index, uint16_t length,
 	mgmt_unregister(data->mgmt, data->mgmt_settings_id);
 }
 
-static bool is_empty_halcb_list(void)
+static void check_cb_count(void)
 {
 	struct test_data *data = tester_get_data();
 
-	return !(g_slist_length(data->expected_callbacks));
+	if (!data->test_init_done)
+		return;
+
+	if (data->cb_count == 0)
+		data->cb_count_checked = true;
+
+	test_update_state();
 }
 
-static void hal_cb_init(struct test_data *data)
+static void expected_cb_count_init(struct test_data *data)
 {
 	const struct generic_data *test_data = data->test_data;
-	unsigned int i = 0;
 
-	while (test_data->expected_hal_callbacks[i]) {
-		data->expected_callbacks =
-			g_slist_append(data->expected_callbacks,
-		GINT_TO_POINTER(test_data->expected_hal_callbacks[i]));
-		i++;
-	}
+	data->cb_count = test_data->expected_cb_count;
+
+	check_cb_count();
 
-	if (is_empty_halcb_list())
-		data->hal_cb_called = true;
 }
 
 static void mgmt_cb_init(struct test_data *data)
@@ -241,13 +211,15 @@ static void test_property_init(struct test_data *data)
 {
 	const struct generic_data *test_data = data->test_data;
 
-	if (is_empty_halcb_list() || !(test_data->expected_property.type))
+	if (!test_data->expected_property.type)
 		data->property_checked = true;
 }
 
 static void init_test_conditions(struct test_data *data)
 {
-	hal_cb_init(data);
+	data->test_init_done = true;
+
+	expected_cb_count_init(data);
 	mgmt_cb_init(data);
 	expected_status_init(data);
 	test_property_init(data);
@@ -266,48 +238,20 @@ static void check_expected_status(uint8_t status)
 	test_update_state();
 }
 
-static void check_test_property(void)
-{
-	struct test_data *data = tester_get_data();
-	bt_property_t expected_prop = data->test_property;
-	const struct generic_data *test_data = data->test_data;
-	bt_property_t test_prop = test_data->expected_property;
-
-	if (test_prop.type && (expected_prop.type != test_prop.type)) {
-		tester_test_failed();
-		return;
-	}
-
-	if (test_prop.len && (expected_prop.len != test_prop.len)) {
-		tester_test_failed();
-		return;
-	}
-
-	if (test_prop.val && memcmp(expected_prop.val, test_prop.val,
-							expected_prop.len)) {
-		tester_test_failed();
-		return;
-	}
-
-	data->property_checked = true;
-	test_update_state();
-}
-
-static void update_hal_cb_list(enum hal_bluetooth_callbacks_id
-							expected_callback)
+static bool check_test_property(bt_property_t received_prop,
+						bt_property_t expected_prop)
 {
 	struct test_data *data = tester_get_data();
 
-	if (is_empty_halcb_list())
-		return;
-
-	data->expected_callbacks = g_slist_remove(data->expected_callbacks,
-					GINT_TO_POINTER(expected_callback));
-
-	if (!data->expected_callbacks)
-		data->hal_cb_called = true;
+	if (expected_prop.type && (expected_prop.type != received_prop.type))
+		return false;
+	if (expected_prop.len && (expected_prop.len != received_prop.len))
+		return false;
+	if (expected_prop.val && memcmp(expected_prop.val, received_prop.val,
+							expected_prop.len))
+		return false;
 
-	test_update_state();
+	return data->property_checked = true;
 }
 
 static void read_info_callback(uint8_t status, uint16_t length,
@@ -541,56 +485,98 @@ static void setup_powered_emulated_remote(void)
 		bthost_write_scan_enable(bthost, 0x03);
 }
 
+static void enable_success_cb(bt_state_t state)
+{
+	struct test_data *data = tester_get_data();
+
+	if (state == BT_STATE_ON) {
+		setup_powered_emulated_remote();
+		data->cb_count--;
+	}
+}
+
+static void disable_success_cb(bt_state_t state)
+{
+	struct test_data *data = tester_get_data();
+
+	if (state == BT_STATE_OFF)
+		data->cb_count--;
+}
+
 static void adapter_state_changed_cb(bt_state_t state)
 {
-	switch (state) {
-	case BT_STATE_ON:
-		if (is_empty_halcb_list())
-			setup_powered_emulated_remote();
-		update_hal_cb_list(ADAPTER_STATE_CHANGED_ON);
-		break;
-	case BT_STATE_OFF:
-		if (is_empty_halcb_list())
-			tester_setup_failed();
-		update_hal_cb_list(ADAPTER_STATE_CHANGED_OFF);
-		break;
-	default:
-		break;
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
+
+	if (data->test_init_done &&
+			test->expected_hal_cb.adapter_state_changed_cb) {
+		test->expected_hal_cb.adapter_state_changed_cb(state);
+		check_cb_count();
+		return;
 	}
+
+	if (!data->test_init_done && state == BT_STATE_ON)
+		setup_powered_emulated_remote();
+}
+
+static void discovery_start_success_cb(bt_discovery_state_t state)
+{
+	struct test_data *data = tester_get_data();
+
+	if (state == BT_DISCOVERY_STARTED)
+		data->cb_count--;
 }
 
-static void post_discovery_started_cb(bt_discovery_state_t state)
+static void discovery_start_done_cb(bt_discovery_state_t state)
 {
 	struct test_data *data = tester_get_data();
 	bt_status_t status;
 
-	if (data->userflag & DEVICE_DISCOVERY_CANCEL_ON_START) {
+	status = data->if_bluetooth->start_discovery();
+	data->cb_count--;
+	check_expected_status(status);
+}
+
+static void discovery_stop_success_cb(bt_discovery_state_t state)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+
+	if (state == BT_DISCOVERY_STARTED && data->cb_count == 2) {
 		status = data->if_bluetooth->cancel_discovery();
 		check_expected_status(status);
+		data->cb_count--;
+		return;
 	}
+	if (state == BT_DISCOVERY_STOPPED && data->cb_count == 1)
+		data->cb_count--;
+}
 
-	if (data->userflag & DEVICE_DISCOVERY_START_ON_START) {
-		status = data->if_bluetooth->start_discovery();
-		check_expected_status(status);
+static void discovery_device_found_state_changed_cb(bt_discovery_state_t state)
+{
+	struct test_data *data = tester_get_data();
+
+	if (state == BT_DISCOVERY_STARTED && data->cb_count == 3) {
+		data->cb_count--;
+		return;
 	}
+	if (state == BT_DISCOVERY_STOPPED && data->cb_count == 1)
+		data->cb_count--;
 }
 
 static void discovery_state_changed_cb(bt_discovery_state_t state)
 {
-	switch (state) {
-	case BT_DISCOVERY_STARTED:
-		update_hal_cb_list(ADAPTER_DISCOVERY_STATE_ON);
-		post_discovery_started_cb(state);
-		break;
-	case BT_DISCOVERY_STOPPED:
-		update_hal_cb_list(ADAPTER_DISCOVERY_STATE_OFF);
-		break;
-	default:
-		break;
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
+
+	if (test && test->expected_hal_cb.discovery_state_changed_cb) {
+		test->expected_hal_cb.discovery_state_changed_cb(state);
+		check_cb_count();
 	}
 }
 
-static void device_found_cb(int num_properties, bt_property_t *properties)
+static void discovery_device_found_cb(int num_properties,
+						bt_property_t *properties)
 {
 	struct test_data *data = tester_get_data();
 	const uint8_t *remote_bdaddr =
@@ -600,7 +586,7 @@ static void device_found_cb(int num_properties, bt_property_t *properties)
 	bt_bdaddr_t emu_remote_bdaddr;
 	int i;
 
-	update_hal_cb_list(REMOTE_DEVICE_FOUND);
+	data->cb_count--;
 
 	if (num_properties < 1)
 		tester_test_failed();
@@ -639,83 +625,75 @@ static void device_found_cb(int num_properties, bt_property_t *properties)
 	}
 }
 
-static void adapter_properties_cb(bt_status_t status, int num_properties,
+static void device_found_cb(int num_properties, bt_property_t *properties)
+{
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
+
+	if (data->test_init_done && test->expected_hal_cb.device_found_cb) {
+		test->expected_hal_cb.device_found_cb(num_properties,
+								properties);
+		check_cb_count();
+	}
+}
+
+static void check_count_properties_cb(bt_status_t status, int num_properties,
 						bt_property_t *properties)
 {
 	struct test_data *data = tester_get_data();
-	int i;
 
-	if (is_empty_halcb_list())
-		return;
+	data->cb_count--;
+}
 
-	for (i = 0; i < num_properties; i++) {
+static void getprop_success_cb(bt_status_t status, int num_properties,
+						bt_property_t *properties)
+{
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
 
-		data->test_property = properties[i];
+	if (check_test_property(properties[0], test->expected_property))
+		data->cb_count--;
+}
 
-		if (g_slist_length(data->expected_callbacks) == 1)
-			check_test_property();
+static void adapter_properties_cb(bt_status_t status, int num_properties,
+						bt_property_t *properties)
+{
+	struct test_data *data = tester_get_data();
+	const struct generic_data *test = data->test_data;
 
-		switch (properties[i].type) {
-		case BT_PROPERTY_BDADDR:
-			update_hal_cb_list(ADAPTER_PROP_BDADDR);
-			break;
-		case BT_PROPERTY_BDNAME:
-			update_hal_cb_list(ADAPTER_PROP_BDNAME);
-			break;
-		case BT_PROPERTY_UUIDS:
-			update_hal_cb_list(ADAPTER_PROP_UUIDS);
-			break;
-		case BT_PROPERTY_CLASS_OF_DEVICE:
-			update_hal_cb_list(ADAPTER_PROP_COD);
-			break;
-		case BT_PROPERTY_TYPE_OF_DEVICE:
-			update_hal_cb_list(ADAPTER_PROP_TYPE);
-			break;
-		case BT_PROPERTY_SERVICE_RECORD:
-			update_hal_cb_list(ADAPTER_PROP_SERVICE_RECORD);
-			break;
-		case BT_PROPERTY_ADAPTER_SCAN_MODE:
-			update_hal_cb_list(ADAPTER_PROP_SCAN_MODE);
-			break;
-		case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
-			update_hal_cb_list(ADAPTER_PROP_BONDED_DEVICES);
-			break;
-		case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
-			update_hal_cb_list(ADAPTER_PROP_DISC_TIMEOUT);
-			break;
-		default:
-			goto fail;
-		}
+	if (data->test_init_done &&
+				test->expected_hal_cb.adapter_properties_cb) {
+		test->expected_hal_cb.adapter_properties_cb(
+							status, num_properties,
+							properties);
+		check_cb_count();
 	}
-	return;
-
-fail:
-	tester_print("Unexpected property: %u", properties[i].type);
-	tester_test_failed();
-	return;
 }
 
 static const struct generic_data bluetooth_enable_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROPS, ADAPTER_STATE_CHANGED_ON,
-							ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_state_changed_cb = enable_success_cb,
+	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
+	.expected_cb_count = 9,
 	.expected_adapter_status = BT_STATUS_SUCCESS
 };
 
 static const struct generic_data bluetooth_enable_done_test = {
-	.expected_hal_callbacks = { ADAPTER_PROPS, ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
+	.expected_cb_count = 8,
 	.expected_adapter_status = BT_STATUS_DONE
 };
 
 static const struct generic_data bluetooth_disable_success_test = {
-	.expected_hal_callbacks = { ADAPTER_STATE_CHANGED_OFF,
-							ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_state_changed_cb = disable_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS
 };
 
 static char test_set_bdname[] = "test_bdname_set";
 
 static const struct generic_data bluetooth_setprop_bdname_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROP_BDNAME, ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = getprop_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_BDNAME,
 	.expected_property.val = test_set_bdname,
@@ -726,9 +704,8 @@ static bt_scan_mode_t test_setprop_scanmode_val =
 					BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
 
 static const struct generic_data bluetooth_setprop_scanmode_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROP_SCAN_MODE,
-						ADAPTER_PROP_SCAN_MODE,
-						ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = getprop_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_ADAPTER_SCAN_MODE,
 	.expected_property.val = &test_setprop_scanmode_val,
@@ -738,7 +715,8 @@ static const struct generic_data bluetooth_setprop_scanmode_success_test = {
 static uint32_t test_setprop_disctimeout_val = 120;
 
 static const struct generic_data bluetooth_setprop_disctimeout_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROP_DISC_TIMEOUT, ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = getprop_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
 	.expected_property.val = &test_setprop_disctimeout_val,
@@ -746,7 +724,8 @@ static const struct generic_data bluetooth_setprop_disctimeout_success_test = {
 };
 
 static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROP_BDADDR, ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = getprop_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_BDADDR,
 	.expected_property.val = NULL,
@@ -756,8 +735,8 @@ static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
 static char test_bdname[] = "test_bdname_setget";
 
 static const struct generic_data bluetooth_getprop_bdname_success_test = {
-	.expected_hal_callbacks = { ADAPTER_PROP_BDNAME, ADAPTER_PROP_BDNAME,
-							ADAPTER_TEST_END },
+	.expected_hal_cb.adapter_properties_cb = getprop_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_BDNAME,
 	.expected_property.val = test_bdname,
@@ -769,41 +748,37 @@ static unsigned char setprop_uuids[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
 			0x00, 0x00 };
 
 static const struct generic_data bluetooth_setprop_uuid_invalid_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_FAIL,
-	.expected_property.type = BT_PROPERTY_UUIDS,
-	.expected_property.val = &setprop_uuids,
-	.expected_property.len = sizeof(setprop_uuids)
+	.set_property.type = BT_PROPERTY_UUIDS,
+	.set_property.val = &setprop_uuids,
+	.set_property.len = sizeof(setprop_uuids)
 };
 
 static uint32_t setprop_class_of_device = 0;
 
 static const struct generic_data bluetooth_setprop_cod_invalid_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_FAIL,
-	.expected_property.type = BT_PROPERTY_CLASS_OF_DEVICE,
-	.expected_property.val = &setprop_class_of_device,
-	.expected_property.len = sizeof(setprop_class_of_device)
+	.set_property.type = BT_PROPERTY_CLASS_OF_DEVICE,
+	.set_property.val = &setprop_class_of_device,
+	.set_property.len = sizeof(setprop_class_of_device)
 };
 
 static bt_device_type_t setprop_type_of_device = BT_DEVICE_DEVTYPE_BREDR;
 
 static const struct generic_data bluetooth_setprop_tod_invalid_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_FAIL,
-	.expected_property.type = BT_PROPERTY_TYPE_OF_DEVICE,
-	.expected_property.val = &setprop_type_of_device,
-	.expected_property.len = sizeof(setprop_type_of_device)
+	.set_property.type = BT_PROPERTY_TYPE_OF_DEVICE,
+	.set_property.val = &setprop_type_of_device,
+	.set_property.len = sizeof(setprop_type_of_device)
 };
 
 static int32_t setprop_remote_rssi = 0;
 
 static const struct generic_data bluetooth_setprop_remote_rssi_invalid_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_FAIL,
-	.expected_property.type = BT_PROPERTY_REMOTE_RSSI,
-	.expected_property.val = &setprop_remote_rssi,
-	.expected_property.len = sizeof(setprop_remote_rssi)
+	.set_property.type = BT_PROPERTY_REMOTE_RSSI,
+	.set_property.val = &setprop_remote_rssi,
+	.set_property.len = sizeof(setprop_remote_rssi)
 };
 
 static bt_service_record_t setprop_remote_service = {
@@ -814,41 +789,40 @@ static bt_service_record_t setprop_remote_service = {
 
 static const struct generic_data
 			bluetooth_setprop_service_record_invalid_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_FAIL,
-	.expected_property.type = BT_PROPERTY_SERVICE_RECORD,
-	.expected_property.val = &setprop_remote_service,
-	.expected_property.len = sizeof(setprop_remote_service)
+	.set_property.type = BT_PROPERTY_SERVICE_RECORD,
+	.set_property.val = &setprop_remote_service,
+	.set_property.len = sizeof(setprop_remote_service)
 };
 
 static const struct generic_data bluetooth_discovery_start_success_test = {
-	.expected_hal_callbacks = { ADAPTER_DISCOVERY_STATE_ON,
-							ADAPTER_TEST_END },
+	.expected_hal_cb.discovery_state_changed_cb =
+						discovery_start_success_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_SUCCESS
 };
 
 static const struct generic_data bluetooth_discovery_start_done_test = {
-	.expected_hal_callbacks = { ADAPTER_DISCOVERY_STATE_ON,
-							ADAPTER_TEST_END },
+	.expected_hal_cb.discovery_state_changed_cb = discovery_start_done_cb,
+	.expected_cb_count = 1,
 	.expected_adapter_status = BT_STATUS_DONE
 };
 
 static const struct generic_data bluetooth_discovery_stop_done_test = {
-	.expected_hal_callbacks = { ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_DONE
 };
 
 static const struct generic_data bluetooth_discovery_stop_success_test = {
-	.expected_hal_callbacks = { ADAPTER_DISCOVERY_STATE_ON,
-				ADAPTER_DISCOVERY_STATE_OFF, ADAPTER_TEST_END },
+	.expected_hal_cb.discovery_state_changed_cb = discovery_stop_success_cb,
+	.expected_cb_count = 2,
 	.expected_adapter_status = BT_STATUS_SUCCESS
 };
 
 static const struct generic_data bluetooth_discovery_device_found_test = {
-	.expected_hal_callbacks = { ADAPTER_DISCOVERY_STATE_ON,
-						REMOTE_DEVICE_FOUND,
-						ADAPTER_DISCOVERY_STATE_OFF,
-						ADAPTER_TEST_END },
+	.expected_hal_cb.discovery_state_changed_cb =
+					discovery_device_found_state_changed_cb,
+	.expected_hal_cb.device_found_cb = discovery_device_found_cb,
+	.expected_cb_count = 3,
 	.expected_adapter_status = BT_STATUS_NOT_EXPECTED
 };
 
@@ -982,9 +956,6 @@ static void teardown(const void *test_data)
 	if (data->bluetoothd_pid)
 		waitpid(data->bluetoothd_pid, NULL, 0);
 
-	if (data->expected_callbacks)
-		g_slist_free(data->expected_callbacks);
-
 	tester_teardown_complete();
 }
 
@@ -1125,7 +1096,7 @@ static void test_setprop_tod_invalid(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
 	const struct generic_data *test = data->test_data;
-	const bt_property_t *prop = &test->expected_property;
+	const bt_property_t *prop = &test->set_property;
 	bt_status_t adapter_status;
 
 	init_test_conditions(data);
@@ -1198,8 +1169,6 @@ static void test_discovery_stop_success(const void *test_data)
 	struct test_data *data = tester_get_data();
 	bt_status_t status;
 
-	data->userflag = DEVICE_DISCOVERY_CANCEL_ON_START;
-
 	init_test_conditions(data);
 
 	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
@@ -1213,8 +1182,6 @@ static void test_discovery_start_done(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
 
-	data->userflag = DEVICE_DISCOVERY_START_ON_START;
-
 	init_test_conditions(data);
 
 	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 5/6] android/tester: Correct bdname set test case struc conditions
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1387799429-6674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

This patch correct struct elements initialization. Now test name is
declared as variable before test case struct and its size is calculated
using sizeof(), not by hard coded number.
---
 android/android-tester.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 547488e..77dfa89 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -712,12 +712,14 @@ static const struct generic_data bluetooth_disable_success_test = {
 	.expected_adapter_status = BT_STATUS_SUCCESS
 };
 
+static char test_set_bdname[] = "test_bdname_set";
+
 static const struct generic_data bluetooth_setprop_bdname_success_test = {
 	.expected_hal_callbacks = { ADAPTER_PROP_BDNAME, ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_BDNAME,
-	.expected_property.val = "test_bdname",
-	.expected_property.len = 11
+	.expected_property.val = test_set_bdname,
+	.expected_property.len = sizeof(test_set_bdname) - 1
 };
 
 static bt_scan_mode_t test_setprop_scanmode_val =
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 4/6] android/tester: Whitespace and semicolon style correction
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1387799429-6674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

This patch correct redundant semicolon (in other test cases there were
no semicolon at last struct element). Additional whitespace was removed
from function.
---
 android/android-tester.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 2a9323f..547488e 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -759,7 +759,7 @@ static const struct generic_data bluetooth_getprop_bdname_success_test = {
 	.expected_adapter_status = BT_STATUS_SUCCESS,
 	.expected_property.type = BT_PROPERTY_BDNAME,
 	.expected_property.val = test_bdname,
-	.expected_property.len = sizeof(test_bdname) - 1,
+	.expected_property.len = sizeof(test_bdname) - 1
 };
 
 static unsigned char setprop_uuids[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
@@ -1483,7 +1483,6 @@ static void test_listen_close(const void *test_data)
 clean:
 	if (sock_fd >= 0)
 		close(sock_fd);
-
 }
 
 static void test_listen_listen(const void *test_data)
@@ -1551,7 +1550,6 @@ clean:
 		close(sock_fd);
 }
 
-
 static gboolean socket_chan_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 3/6] android/tester: Change test data variables placement
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1387799429-6674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

This patch moves two test variables to proper place in code - before
test case init structs.
---
 android/android-tester.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 0fe341b..2a9323f 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -47,10 +47,6 @@
 			ADAPTER_PROP_TYPE, ADAPTER_PROP_SCAN_MODE, \
 			ADAPTER_PROP_BONDED_DEVICES, ADAPTER_PROP_DISC_TIMEOUT
 
-static bt_scan_mode_t test_setprop_scanmode_val =
-					BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
-static uint32_t test_setprop_disctimeout_val = 120;
-
 /*
  * those are assigned to HAL methods and callbacks, we use ID later
  * on mapped in switch-case due to different functions prototypes.
@@ -724,6 +720,9 @@ static const struct generic_data bluetooth_setprop_bdname_success_test = {
 	.expected_property.len = 11
 };
 
+static bt_scan_mode_t test_setprop_scanmode_val =
+					BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
+
 static const struct generic_data bluetooth_setprop_scanmode_success_test = {
 	.expected_hal_callbacks = { ADAPTER_PROP_SCAN_MODE,
 						ADAPTER_PROP_SCAN_MODE,
@@ -734,6 +733,8 @@ static const struct generic_data bluetooth_setprop_scanmode_success_test = {
 	.expected_property.len = sizeof(bt_scan_mode_t)
 };
 
+static uint32_t test_setprop_disctimeout_val = 120;
+
 static const struct generic_data bluetooth_setprop_disctimeout_success_test = {
 	.expected_hal_callbacks = { ADAPTER_PROP_DISC_TIMEOUT, ADAPTER_TEST_END },
 	.expected_adapter_status = BT_STATUS_SUCCESS,
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 2/6] android/tester: Move BT discovery test cases before Socket Hal
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1387799429-6674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

This moves and organize test case data. BT discovery test cases to right
place in code.
---
 android/android-tester.c | 160 +++++++++++++++++++++++------------------------
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 701ffd2..0fe341b 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -930,7 +930,6 @@ static void setup(struct test_data *data)
 		tester_setup_failed();
 		return;
 	}
-
 }
 
 static void setup_base(const void *test_data)
@@ -1158,6 +1157,78 @@ static void test_setprop_service_record_invalid(const void *test_data)
 	check_expected_status(adapter_status);
 }
 
+static void test_discovery_start_success(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+
+	init_test_conditions(data);
+
+	status = data->if_bluetooth->start_discovery();
+	check_expected_status(status);
+}
+
+static void test_discovery_stop_done(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+
+	init_test_conditions(data);
+
+	status = data->if_bluetooth->cancel_discovery();
+	check_expected_status(status);
+}
+
+static bool pre_inq_compl_hook(const void *dummy, uint16_t len, void *user_data)
+{
+	struct test_data *data = tester_get_data();
+
+	/* Make sure Inquiry Command Complete is not called */
+
+	hciemu_del_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY);
+
+	return false;
+}
+
+static void test_discovery_stop_success(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+
+	data->userflag = DEVICE_DISCOVERY_CANCEL_ON_START;
+
+	init_test_conditions(data);
+
+	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
+					pre_inq_compl_hook, data);
+
+	status = data->if_bluetooth->start_discovery();
+	check_expected_status(status);
+}
+
+static void test_discovery_start_done(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	data->userflag = DEVICE_DISCOVERY_START_ON_START;
+
+	init_test_conditions(data);
+
+	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
+					pre_inq_compl_hook, data);
+
+	data->if_bluetooth->start_discovery();
+}
+
+static void test_discovery_device_found(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	init_test_conditions(data);
+
+	data->if_bluetooth->start_discovery();
+}
+
 /* Test Socket HAL */
 
 static void adapter_socket_state_changed_cb(bt_state_t state)
@@ -1479,77 +1550,6 @@ clean:
 		close(sock_fd);
 }
 
-static void test_discovery_start_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	bt_status_t status;
-
-	init_test_conditions(data);
-
-	status = data->if_bluetooth->start_discovery();
-	check_expected_status(status);
-}
-
-static void test_discovery_stop_done(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	bt_status_t status;
-
-	init_test_conditions(data);
-
-	status = data->if_bluetooth->cancel_discovery();
-	check_expected_status(status);
-}
-
-static bool pre_inq_compl_hook(const void *dummy, uint16_t len, void *user_data)
-{
-	struct test_data *data = tester_get_data();
-
-	/* Make sure Inquiry Command Complete is not called */
-
-	hciemu_del_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY);
-
-	return false;
-}
-
-static void test_discovery_stop_success(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-	bt_status_t status;
-
-	data->userflag = DEVICE_DISCOVERY_CANCEL_ON_START;
-
-	init_test_conditions(data);
-
-	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
-					pre_inq_compl_hook, data);
-
-	status = data->if_bluetooth->start_discovery();
-	check_expected_status(status);
-}
-
-static void test_discovery_start_done(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-
-	data->userflag = DEVICE_DISCOVERY_START_ON_START;
-
-	init_test_conditions(data);
-
-	hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_EVT, BT_HCI_CMD_INQUIRY,
-					pre_inq_compl_hook, data);
-
-	data->if_bluetooth->start_discovery();
-}
-
-static void test_discovery_device_found(const void *test_data)
-{
-	struct test_data *data = tester_get_data();
-
-	init_test_conditions(data);
-
-	data->if_bluetooth->start_discovery();
-}
 
 static gboolean socket_chan_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
@@ -1722,26 +1722,26 @@ int main(int argc, char *argv[])
 				setup_enabled_adapter,
 				test_setprop_service_record_invalid, teardown);
 
-	test_bredrle("Bluetooth BREDR Discovery Start - Done",
-				&bluetooth_discovery_start_done_test,
-				setup_enabled_adapter,
-				test_discovery_start_done, teardown);
-
 	test_bredrle("Bluetooth BREDR Discovery Start - Success",
 				&bluetooth_discovery_start_success_test,
 				setup_enabled_adapter,
 				test_discovery_start_success, teardown);
 
-	test_bredrle("Bluetooth BREDR Discovery Stop - Done",
-				&bluetooth_discovery_stop_done_test,
+	test_bredrle("Bluetooth BREDR Discovery Start - Done",
+				&bluetooth_discovery_start_done_test,
 				setup_enabled_adapter,
-				test_discovery_stop_done, teardown);
+				test_discovery_start_done, teardown);
 
 	test_bredrle("Bluetooth BREDR Discovery Stop - Success",
 				&bluetooth_discovery_stop_success_test,
 				setup_enabled_adapter,
 				test_discovery_stop_success, teardown);
 
+	test_bredrle("Bluetooth BREDR Discovery Stop - Done",
+				&bluetooth_discovery_stop_done_test,
+				setup_enabled_adapter,
+				test_discovery_stop_done, teardown);
+
 	test_bredrle("Bluetooth BREDR Discovery Device Found",
 				&bluetooth_discovery_device_found_test,
 				setup_enabled_adapter,
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH 1/6] android/tester: Seperate Socket HAL cbs from Bluetooth HAL cb
From: Grzegorz Kolodziejczyk @ 2013-12-23 11:50 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds seperate callbacks structure for socket HAL test cases.
Is's needed beceause Socket HAL cb have other purpose than Bluetooth HAL
cb. Callbacks are now initialized outside test setup function and
cb struct depends on HAL type.
---
 android/android-tester.c | 63 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 56 insertions(+), 7 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 2d1ffde..701ffd2 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -869,7 +869,6 @@ static void setup(struct test_data *data)
 {
 	const hw_module_t *module;
 	hw_device_t *device;
-	bt_status_t status;
 	int signal_fd[2];
 	char buf[1024];
 	pid_t pid;
@@ -932,19 +931,21 @@ static void setup(struct test_data *data)
 		return;
 	}
 
-	status = data->if_bluetooth->init(&bt_callbacks);
-	if (status != BT_STATUS_SUCCESS) {
-		data->if_bluetooth = NULL;
-		tester_setup_failed();
-	}
 }
 
 static void setup_base(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
+	bt_status_t status;
 
 	setup(data);
 
+	status = data->if_bluetooth->init(&bt_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_bluetooth = NULL;
+		tester_setup_failed();
+	}
+
 	tester_setup_complete();
 }
 
@@ -955,6 +956,11 @@ static void setup_enabled_adapter(const void *test_data)
 
 	setup(data);
 
+	status = data->if_bluetooth->init(&bt_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_bluetooth = NULL;
+		tester_setup_failed();
+	}
 	status = data->if_bluetooth->enable();
 	if (status != BT_STATUS_SUCCESS)
 		tester_setup_failed();
@@ -1154,6 +1160,20 @@ static void test_setprop_service_record_invalid(const void *test_data)
 
 /* Test Socket HAL */
 
+static void adapter_socket_state_changed_cb(bt_state_t state)
+{
+	switch (state) {
+	case BT_STATE_ON:
+		setup_powered_emulated_remote();
+		break;
+	case BT_STATE_OFF:
+		tester_setup_failed();
+		break;
+	default:
+		break;
+	}
+}
+
 const bt_bdaddr_t bdaddr_dummy = {
 	.address = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55}
 };
@@ -1230,13 +1250,36 @@ static const struct socket_data btsock_inv_listen_listen = {
 	.test_channel = true,
 };
 
+static bt_callbacks_t bt_socket_callbacks = {
+	.size = sizeof(bt_callbacks),
+	.adapter_state_changed_cb = adapter_socket_state_changed_cb,
+	.adapter_properties_cb = NULL,
+	.remote_device_properties_cb = NULL,
+	.device_found_cb = NULL,
+	.discovery_state_changed_cb = NULL,
+	.pin_request_cb = NULL,
+	.ssp_request_cb = NULL,
+	.bond_state_changed_cb = NULL,
+	.acl_state_changed_cb = NULL,
+	.thread_evt_cb = NULL,
+	.dut_mode_recv_cb = NULL,
+	.le_test_mode_cb = NULL
+};
+
 static void setup_socket_interface(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
+	bt_status_t status;
 	const void *sock;
 
 	setup(data);
 
+	status = data->if_bluetooth->init(&bt_socket_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_bluetooth = NULL;
+		tester_setup_failed();
+	}
+
 	sock = data->if_bluetooth->get_profile_interface(BT_PROFILE_SOCKETS_ID);
 	if (!sock) {
 		tester_setup_failed();
@@ -1251,11 +1294,17 @@ static void setup_socket_interface(const void *test_data)
 static void setup_socket_interface_enabled(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
-	const void *sock;
 	bt_status_t status;
+	const void *sock;
 
 	setup(data);
 
+	status = data->if_bluetooth->init(&bt_socket_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_bluetooth = NULL;
+		tester_setup_failed();
+	}
+
 	sock = data->if_bluetooth->get_profile_interface(BT_PROFILE_SOCKETS_ID);
 	if (!sock) {
 		tester_setup_failed();
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH v2 2/2] android/bluetooth: Print error on unimplemented functions
From: Szymon Janc @ 2013-12-23 11:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1387796839-8164-1-git-send-email-szymon.janc@tieto.com>

Functions, callbacks or properties that are not implemented due to
being bogus or not feasible now prints error messages.
---
 android/bluetooth.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 59f0810..0700972 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2146,6 +2146,10 @@ static void handle_get_adapter_prop_cmd(const void *buf, uint16_t len)
 		break;
 	}
 
+	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
+		error("Failed to get adapter property (type %u status %u)",
+							cmd->type, status);
+
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_ADAPTER_PROP, status);
 }
 
@@ -2293,6 +2297,10 @@ static void handle_set_adapter_prop_cmd(const void *buf, uint16_t len)
 		break;
 	}
 
+	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
+		error("Failed to set adapter property (type %u status %u)",
+							cmd->type, status);
+
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_ADAPTER_PROP, status);
 }
 
@@ -2745,6 +2753,10 @@ static void handle_get_remote_device_prop_cmd(const void *buf, uint16_t len)
 		break;
 	}
 
+	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
+		error("Failed to get device property (type %u status %u)",
+							cmd->type, status);
+
 failed:
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_REMOTE_DEVICE_PROP,
 								status);
@@ -2809,6 +2821,10 @@ static void handle_set_remote_device_prop_cmd(const void *buf, uint16_t len)
 		break;
 	}
 
+	if (status != HAL_STATUS_SUCCESS && status != HAL_STATUS_DONE)
+		error("Failed to set device property (type %u status %u)",
+							cmd->type, status);
+
 failed:
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_REMOTE_DEVICE_PROP,
 									status);
@@ -2818,6 +2834,8 @@ static void handle_get_remote_service_rec_cmd(const void *buf, uint16_t len)
 {
 	/* TODO */
 
+	error("get_remote_service_record not supported");
+
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_REMOTE_SERVICE_REC,
 							HAL_STATUS_FAILED);
 }
@@ -2914,7 +2932,7 @@ static void handle_dut_mode_send_cmd(const void *buf, uint16_t len)
 		return;
 	}
 
-	DBG("opcode %u", cmd->opcode);
+	error("dut_mode_send not supported");
 
 	/* TODO */
 
@@ -2932,7 +2950,7 @@ static void handle_le_test_mode_cmd(const void *buf, uint16_t len)
 		return;
 	}
 
-	DBG("opcode %u", cmd->opcode);
+	error("le_test_mode not supported");
 
 	/* TODO */
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH v2 1/2] android/bluetooth: Add support for DUT mode configure command
From: Szymon Janc @ 2013-12-23 11:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This allows to enable and disable DUT mode. This is special mode so
adding more info from related kernel commit:

"The Device Under Test (DUT) mode is useful for doing certification
testing and so expose this as debugfs option.

This mode is actually special since you can only enter it. Restoring
normal operation means that a HCI Reset is required. The current mode
value gets tracked as a new device flag and when disabling it, the
correct command to reset the controller is sent."
---
 android/bluetooth.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 2e75864..59f0810 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -50,6 +50,8 @@
 #include "utils.h"
 #include "bluetooth.h"
 
+#define DUT_MODE_FILE "/sys/kernel/debug/bluetooth/hci%u/dut_mode"
+
 #define DEVICE_ID_SOURCE	0x0002	/* USB */
 #define DEVICE_ID_VENDOR	0x1d6b	/* Linux Foundation */
 #define DEVICE_ID_PRODUCT	0x0247	/* BlueZ for Android */
@@ -2872,13 +2874,34 @@ failed:
 static void handle_dut_mode_conf_cmd(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_dut_mode_conf *cmd = buf;
+	char path[FILENAME_MAX];
+	uint8_t status;
+	int fd, ret;
 
 	DBG("enable %u", cmd->enable);
 
-	/* TODO */
+	snprintf(path, sizeof(path), DUT_MODE_FILE, adapter.index);
 
-	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF,
-							HAL_STATUS_FAILED);
+	fd = open(path, O_WRONLY);
+	if (fd < 0) {
+		status = HAL_STATUS_FAILED;
+		goto failed;
+	}
+
+	if (cmd->enable)
+		ret = write(fd, "1", sizeof("1"));
+	else
+		ret = write(fd, "0", sizeof("0"));
+
+	if (ret < 0)
+		status = HAL_STATUS_FAILED;
+	else
+		status = HAL_STATUS_SUCCESS;
+
+	close(fd);
+
+failed:
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF, status);
 }
 
 static void handle_dut_mode_send_cmd(const void *buf, uint16_t len)
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 1/4] android/bluetooth: Add support for timestamp device property
From: Luiz Augusto von Dentz @ 2013-12-23  9:46 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CABBYNZJMAJbDwutWndn55nWQOdj310N2t85Qt4erMXu0sB5DKw@mail.gmail.com>

Hi Szymon,

On Mon, Dec 23, 2013 at 9:53 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Szymon,
>
> On Fri, Dec 20, 2013 at 8:30 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
>> This allows to handle timestamp property request. Also this will be
>> usefull for devices info cache (clearing old devices).
>> ---
>>  android/bluetooth.c | 17 +++++++++++++----
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/android/bluetooth.c b/android/bluetooth.c
>> index e534fc1..2e75864 100644
>> --- a/android/bluetooth.c
>> +++ b/android/bluetooth.c
>> @@ -80,6 +80,8 @@ struct device {
>>         uint32_t class;
>>         int32_t rssi;
>>
>> +       uint32_t timestamp;
>> +
>>         GSList *uuids;
>>  };
>>
>> @@ -227,6 +229,8 @@ static void store_device_info(struct device *dev)
>>         else
>>                 g_key_file_remove_key(key_file, addr, "Class", NULL);
>>
>> +       g_key_file_set_integer(key_file, addr, "Timestamp", dev->timestamp);
>> +
>>         if (dev->uuids) {
>>                 GSList *l;
>>                 int i;
>> @@ -291,6 +295,7 @@ static struct device *create_device(const bdaddr_t *bdaddr, uint8_t type)
>>         bacpy(&dev->bdaddr, bdaddr);
>>         dev->bdaddr_type = type;
>>         dev->bond_state = HAL_BOND_STATE_NONE;
>> +       dev->timestamp = time(NULL);
>>
>>         /* use address for name, will be change if one is present
>>          * eg. in EIR or set by set_property. */
>> @@ -1004,6 +1009,8 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
>>
>>                 ev->status = HAL_STATUS_SUCCESS;
>>                 bdaddr2android(bdaddr, ev->bdaddr);
>> +
>> +               dev->timestamp = time(NULL);
>>         }
>>
>>         if (eir.class) {
>> @@ -1607,6 +1614,9 @@ static void create_device_from_info(GKeyFile *key_file, const char *peer)
>>
>>         dev->class = g_key_file_get_integer(key_file, peer, "Class", NULL);
>>
>> +       dev->timestamp = g_key_file_get_integer(key_file, peer, "Timestamp",
>> +                                                                       NULL);
>> +
>>         uuids = g_key_file_get_string_list(key_file, peer, "Services", NULL,
>>                                                                         NULL);
>>         if (uuids) {
>> @@ -2647,11 +2657,10 @@ static uint8_t get_device_version_info(struct device *dev)
>>
>>  static uint8_t get_device_timestamp(struct device *dev)
>>  {
>> -       DBG("Not implemented");
>> -
>> -       /* TODO */
>> +       send_device_property(&dev->bdaddr, HAL_PROP_DEVICE_TIMESTAMP,
>> +                               sizeof(dev->timestamp), &dev->timestamp);
>>
>> -       return HAL_STATUS_FAILED;
>> +       return HAL_STATUS_SUCCESS;
>>  }
>>
>
> I guess it probably make sense to update the timestamp also whenever a
> connection completes or does bluedroid ignores it?

As discussed in irc this seems to be way HAL is defined, so Im
applying this one and patch 4, patches 2 and 3 needs some changes so
Im expecting a v2 soon.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH] android/tester: Fix possible NULL dereference
From: Johan Hedberg @ 2013-12-23  8:52 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1387787331-8405-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Mon, Dec 23, 2013, Andrei Emeltchenko wrote:
> value is checked for NULL and later is dereferenced if we do not return.
> ---
>  android/android-tester.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 2/4] android/bluetooth: Add support for DUT mode configure command
From: Andrei Emeltchenko @ 2013-12-23  8:46 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1387564210-6102-2-git-send-email-szymon.janc@tieto.com>

On Fri, Dec 20, 2013 at 07:30:08PM +0100, Szymon Janc wrote:
> This allows to enable and disable DUT mode.

Hi Szymon, could you add some more info about the mode?

Best regards 
Andrei Emeltchenko 

> ---
>  android/bluetooth.c | 29 ++++++++++++++++++++++++++---
>  1 file changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 2e75864..59f0810 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -50,6 +50,8 @@
>  #include "utils.h"
>  #include "bluetooth.h"
>  
> +#define DUT_MODE_FILE "/sys/kernel/debug/bluetooth/hci%u/dut_mode"
> +
>  #define DEVICE_ID_SOURCE	0x0002	/* USB */
>  #define DEVICE_ID_VENDOR	0x1d6b	/* Linux Foundation */
>  #define DEVICE_ID_PRODUCT	0x0247	/* BlueZ for Android */
> @@ -2872,13 +2874,34 @@ failed:
>  static void handle_dut_mode_conf_cmd(const void *buf, uint16_t len)
>  {
>  	const struct hal_cmd_dut_mode_conf *cmd = buf;
> +	char path[FILENAME_MAX];
> +	uint8_t status;
> +	int fd, ret;
>  
>  	DBG("enable %u", cmd->enable);
>  
> -	/* TODO */
> +	snprintf(path, sizeof(path), DUT_MODE_FILE, adapter.index);
>  
> -	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF,
> -							HAL_STATUS_FAILED);
> +	fd = open(path, O_WRONLY);
> +	if (fd < 0) {
> +		status = HAL_STATUS_FAILED;
> +		goto failed;
> +	}
> +
> +	if (cmd->enable)
> +		ret = write(fd, "1", sizeof("1"));
> +	else
> +		ret = write(fd, "0", sizeof("0"));
> +
> +	if (ret < 0)
> +		status = HAL_STATUS_FAILED;
> +	else
> +		status = HAL_STATUS_SUCCESS;
> +
> +	close(fd);
> +
> +failed:
> +	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DUT_MODE_CONF, status);
>  }
>  
>  static void handle_dut_mode_send_cmd(const void *buf, uint16_t len)
> -- 
> 1.8.3.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] android/tester: Fix possible NULL dereference
From: Andrei Emeltchenko @ 2013-12-23  8:28 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

value is checked for NULL and later is dereferenced if we do not return.
---
 android/android-tester.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/android/android-tester.c b/android/android-tester.c
index 2d1ffde..0383115 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -148,18 +148,21 @@ static void test_device_property(bt_property_t *property,
 	if (value == NULL) {
 		tester_warn("NULL property passed");
 		tester_test_failed();
+		return;
 	}
 
 	if (property->type != type) {
 		tester_warn("Wrong remote property type %d, expected %d",
 							type, property->type);
 		tester_test_failed();
+		return;
 	}
 
 	if (property->len != len) {
 		tester_warn("Wrong remote property len %d, expected %d",
 							len, property->len);
 		tester_test_failed();
+		return;
 	}
 
 	if (memcmp(property->val, value, len)) {
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH v2 BlueZ] build: Add coverage support
From: Luiz Augusto von Dentz @ 2013-12-23  8:05 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1387372162-7096-1-git-send-email-luiz.dentz@gmail.com>

Hi Marcel,

On Wed, Dec 18, 2013 at 3:09 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Coverage is enabled with --enable-maintainer-mode, 2 new targets are
> added 'coverage' and 'clean-coverage', the first generate the reports
> using lcov and depend on the second to cleanup previous generated
> reports and .gcda files.
> ---
>  .gitignore   |  4 ++++
>  Makefile.am  | 18 ++++++++++++++++++
>  acinclude.m4 |  4 ++++
>  configure.ac |  4 ++++
>  4 files changed, 30 insertions(+)
>
> diff --git a/.gitignore b/.gitignore
> index c570728..21dbe26 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -3,6 +3,8 @@
>  *.lo
>  *.la
>  *.so
> +*.gcno
> +*.gcda
>  .deps
>  .libs
>  .dirstamp
> @@ -27,7 +29,9 @@ stamp-h1
>  autom4te.cache
>  test-driver
>  test-suite.log
> +coverage.info
>
> +coverage
>  lib/bluez.pc
>  lib/bluetooth
>  src/builtin.h
> diff --git a/Makefile.am b/Makefile.am
> index 15cc149..7380e61 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -331,5 +331,23 @@ lib/bluetooth/%.h: lib/%.h
>         $(AM_V_at)$(MKDIR_P) lib/bluetooth
>         $(AM_V_GEN)$(LN_S) -f "$(abs_top_builddir)"/$< $@
>
> +if MAINTAINER_MODE
> +clean-coverage:
> +       -find $(top_builddir) -name "*.gcda" -delete
> +       @lcov --directory $(top_builddir) --zerocounters
> +       $(RM) -r coverage $(top_builddir)/coverage.info
> +
> +coverage: clean-coverage check
> +       @lcov --compat-libtool --directory $(top_builddir) --capture \
> +                               --output-file $(top_builddir)/coverage.info
> +       $(AM_V_at)$(MKDIR_P) coverage
> +       @genhtml -o coverage/ $(top_builddir)/coverage.info
> +
> +clean-local: clean-coverage
> +       -find $(top_builddir) -name "*.gcno" -delete
> +       $(RM) -r lib/bluetooth
> +
> +else
>  clean-local:
>         $(RM) -r lib/bluetooth
> +endif
> diff --git a/acinclude.m4 b/acinclude.m4
> index 2065852..afc7c6d 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -51,6 +51,10 @@ AC_DEFUN([MISC_FLAGS], [
>                         misc_ldflags="$misc_ldflags -pie"
>                 fi
>         ])
> +       if (test "$USE_MAINTAINER_MODE" = "yes"); then
> +               misc_cflags="$misc_cflags --coverage"
> +               misc_ldflags="$misc_ldflags --coverage"
> +       fi
>         AC_SUBST([MISC_CFLAGS], $misc_cflags)
>         AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
>  ])
> diff --git a/configure.ac b/configure.ac
> index 18d0b55..4f36355 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -252,4 +252,8 @@ AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
>                                         [enable_android=${enableval}])
>  AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
>
> +if (test "$USE_MAINTAINER_MODE" = "yes"); then
> +       AC_CHECK_PROG([LCOV], [lcov], [yes], AC_MSG_ERROR(lcov is required))
> +fi
> +
>  AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
> --
> 1.8.3.1

Any feedback regarding this patch? It is now using maintainer mode as
you suggested.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH 1/2] client: Clean up agent if bluetoothd exited without releasing it
From: Luiz Augusto von Dentz @ 2013-12-23  7:57 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1387747496-20654-1-git-send-email-szymon.janc@gmail.com>

Hi Szymon,

On Sun, Dec 22, 2013 at 11:24 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
> If bluetoothd exited without releasing agent (eg. due to crash) it was
> not possible to register client as agent after daemon was restarted.
> ---
>  client/agent.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/client/agent.c b/client/agent.c
> index 2d9dffd..b34ad77 100644
> --- a/client/agent.c
> +++ b/client/agent.c
> @@ -35,6 +35,7 @@
>
>  #define AGENT_PATH "/org/bluez/agent"
>  #define AGENT_INTERFACE "org.bluez.Agent1"
> +#define BLUEZ_NAME "org.bluez"
>
>  #define AGENT_PROMPT   COLOR_RED "[agent]" COLOR_OFF " "
>
> @@ -43,6 +44,7 @@ static const char *agent_capability = NULL;
>  static DBusMessage *pending_message = NULL;
>  static char *agent_saved_prompt = NULL;
>  static int agent_saved_point = 0;
> +static guint watch_id = 0;
>
>  static void agent_prompt(const char *msg)
>  {
> @@ -154,8 +156,7 @@ dbus_bool_t agent_input(DBusConnection *conn, const char *input)
>         return TRUE;
>  }
>
> -static DBusMessage *release_agent(DBusConnection *conn,
> -                                       DBusMessage *msg, void *user_data)
> +static void clean_agent(DBusConnection *conn, void *user_data)
>  {
>         agent_registered = FALSE;
>         agent_capability = NULL;
> @@ -171,6 +172,15 @@ static DBusMessage *release_agent(DBusConnection *conn,
>
>         g_dbus_unregister_interface(conn, AGENT_PATH, AGENT_INTERFACE);
>
> +       g_dbus_remove_watch(conn, watch_id);
> +       watch_id = 0;
> +}
> +
> +static DBusMessage *release_agent(DBusConnection *conn, DBusMessage *msg,
> +                                                               void *user_data)
> +{
> +       clean_agent(conn, NULL);
> +
>         return dbus_message_new_method_return(msg);
>  }
>
> @@ -364,6 +374,10 @@ static void register_agent_reply(DBusMessage *message, void *user_data)
>         if (dbus_set_error_from_message(&error, message) == FALSE) {
>                 agent_registered = TRUE;
>                 rl_printf("Agent registered\n");
> +
> +               watch_id = g_dbus_add_service_watch(conn, BLUEZ_NAME, NULL,
> +                                                       clean_agent, NULL,
> +                                                       NULL);
>         } else {
>                 rl_printf("Failed to register agent: %s\n", error.name);
>                 dbus_error_free(&error);
> @@ -425,6 +439,9 @@ static void unregister_agent_reply(DBusMessage *message, void *user_data)
>                 if (g_dbus_unregister_interface(conn, AGENT_PATH,
>                                                 AGENT_INTERFACE) == FALSE)
>                         rl_printf("Failed to unregister agent object\n");
> +
> +               g_dbus_remove_watch(conn, watch_id);
> +               watch_id = 0;
>         } else {
>                 rl_printf("Failed to unregister agent: %s\n", error.name);
>                 dbus_error_free(&error);
> --
> 1.8.5.2

Ive send a patch for it not long time ago, but instead of adding a new
watch I just unregister the agent whenever org.bluez.AgentManager1
proxy is removed which should treat the case where the daemon crash or
exit without sending a proper unregister.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH 1/4] android/bluetooth: Add support for timestamp device property
From: Luiz Augusto von Dentz @ 2013-12-23  7:53 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1387564210-6102-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Dec 20, 2013 at 8:30 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> This allows to handle timestamp property request. Also this will be
> usefull for devices info cache (clearing old devices).
> ---
>  android/bluetooth.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index e534fc1..2e75864 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -80,6 +80,8 @@ struct device {
>         uint32_t class;
>         int32_t rssi;
>
> +       uint32_t timestamp;
> +
>         GSList *uuids;
>  };
>
> @@ -227,6 +229,8 @@ static void store_device_info(struct device *dev)
>         else
>                 g_key_file_remove_key(key_file, addr, "Class", NULL);
>
> +       g_key_file_set_integer(key_file, addr, "Timestamp", dev->timestamp);
> +
>         if (dev->uuids) {
>                 GSList *l;
>                 int i;
> @@ -291,6 +295,7 @@ static struct device *create_device(const bdaddr_t *bdaddr, uint8_t type)
>         bacpy(&dev->bdaddr, bdaddr);
>         dev->bdaddr_type = type;
>         dev->bond_state = HAL_BOND_STATE_NONE;
> +       dev->timestamp = time(NULL);
>
>         /* use address for name, will be change if one is present
>          * eg. in EIR or set by set_property. */
> @@ -1004,6 +1009,8 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
>
>                 ev->status = HAL_STATUS_SUCCESS;
>                 bdaddr2android(bdaddr, ev->bdaddr);
> +
> +               dev->timestamp = time(NULL);
>         }
>
>         if (eir.class) {
> @@ -1607,6 +1614,9 @@ static void create_device_from_info(GKeyFile *key_file, const char *peer)
>
>         dev->class = g_key_file_get_integer(key_file, peer, "Class", NULL);
>
> +       dev->timestamp = g_key_file_get_integer(key_file, peer, "Timestamp",
> +                                                                       NULL);
> +
>         uuids = g_key_file_get_string_list(key_file, peer, "Services", NULL,
>                                                                         NULL);
>         if (uuids) {
> @@ -2647,11 +2657,10 @@ static uint8_t get_device_version_info(struct device *dev)
>
>  static uint8_t get_device_timestamp(struct device *dev)
>  {
> -       DBG("Not implemented");
> -
> -       /* TODO */
> +       send_device_property(&dev->bdaddr, HAL_PROP_DEVICE_TIMESTAMP,
> +                               sizeof(dev->timestamp), &dev->timestamp);
>
> -       return HAL_STATUS_FAILED;
> +       return HAL_STATUS_SUCCESS;
>  }
>

I guess it probably make sense to update the timestamp also whenever a
connection completes or does bluedroid ignores it?

Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH 2/2] client: Minor code style fix
From: Szymon Janc @ 2013-12-22 21:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1387747496-20654-1-git-send-email-szymon.janc@gmail.com>

---
 client/agent.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/client/agent.c b/client/agent.c
index b34ad77..20787bc 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -390,7 +390,6 @@ static void register_agent_reply(DBusMessage *message, void *user_data)
 
 void agent_register(DBusConnection *conn, GDBusProxy *manager,
 						const char *capability)
-
 {
 	if (agent_registered == TRUE) {
 		rl_printf("Agent is already registered\n");
-- 
1.8.5.2


^ permalink raw reply related

* [PATCH 1/2] client: Clean up agent if bluetoothd exited without releasing it
From: Szymon Janc @ 2013-12-22 21:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

If bluetoothd exited without releasing agent (eg. due to crash) it was
not possible to register client as agent after daemon was restarted.
---
 client/agent.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/client/agent.c b/client/agent.c
index 2d9dffd..b34ad77 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -35,6 +35,7 @@
 
 #define AGENT_PATH "/org/bluez/agent"
 #define AGENT_INTERFACE "org.bluez.Agent1"
+#define BLUEZ_NAME "org.bluez"
 
 #define AGENT_PROMPT	COLOR_RED "[agent]" COLOR_OFF " "
 
@@ -43,6 +44,7 @@ static const char *agent_capability = NULL;
 static DBusMessage *pending_message = NULL;
 static char *agent_saved_prompt = NULL;
 static int agent_saved_point = 0;
+static guint watch_id = 0;
 
 static void agent_prompt(const char *msg)
 {
@@ -154,8 +156,7 @@ dbus_bool_t agent_input(DBusConnection *conn, const char *input)
 	return TRUE;
 }
 
-static DBusMessage *release_agent(DBusConnection *conn,
-					DBusMessage *msg, void *user_data)
+static void clean_agent(DBusConnection *conn, void *user_data)
 {
 	agent_registered = FALSE;
 	agent_capability = NULL;
@@ -171,6 +172,15 @@ static DBusMessage *release_agent(DBusConnection *conn,
 
 	g_dbus_unregister_interface(conn, AGENT_PATH, AGENT_INTERFACE);
 
+	g_dbus_remove_watch(conn, watch_id);
+	watch_id = 0;
+}
+
+static DBusMessage *release_agent(DBusConnection *conn, DBusMessage *msg,
+								void *user_data)
+{
+	clean_agent(conn, NULL);
+
 	return dbus_message_new_method_return(msg);
 }
 
@@ -364,6 +374,10 @@ static void register_agent_reply(DBusMessage *message, void *user_data)
 	if (dbus_set_error_from_message(&error, message) == FALSE) {
 		agent_registered = TRUE;
 		rl_printf("Agent registered\n");
+
+		watch_id = g_dbus_add_service_watch(conn, BLUEZ_NAME, NULL,
+							clean_agent, NULL,
+							NULL);
 	} else {
 		rl_printf("Failed to register agent: %s\n", error.name);
 		dbus_error_free(&error);
@@ -425,6 +439,9 @@ static void unregister_agent_reply(DBusMessage *message, void *user_data)
 		if (g_dbus_unregister_interface(conn, AGENT_PATH,
 						AGENT_INTERFACE) == FALSE)
 			rl_printf("Failed to unregister agent object\n");
+
+		g_dbus_remove_watch(conn, watch_id);
+		watch_id = 0;
 	} else {
 		rl_printf("Failed to unregister agent: %s\n", error.name);
 		dbus_error_free(&error);
-- 
1.8.5.2


^ permalink raw reply related

* Fwd: [Lenovo ThinkPad Edge E531] Bluetooth finds no device
From: Emil Diculescu @ 2013-12-22 13:50 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <52B6ED0B.5030505@gmail.com>



[1.] One line summary of the problem:
[Lenovo ThinkPad Edge E531] Bluetooth finds no device

[2.] Full description of the problem/report:
The bluetooth application doesn't detect the bluetooth installed in the computer (all menus are disabled).

[3.] Keywords

[4.] Kernel version (from /proc/version)
Linux version 3.13.0-rc4 (root@emil-ThinkPad-Edge-E531) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9) ) #1 SMP Sun Dec 22 09:29:17 EET 2013

[5.] Output of Oops message
N/A

[6.] A small shell script or example program which triggers the problem:
N/A

[7.] Environment
Description:	Ubuntu 13.10
Release:	13.10

[7.1.] Software:
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
  
Linux emil-ThinkPad-Edge-E531 3.13.0-rc4 #1 SMP Sun Dec 22 09:29:17 EET 2013 x86_64 x86_64 x86_64 GNU/Linux
  
Gnu C                  4.8
Gnu make               3.81
binutils               2.23.52.20130913
util-linux             2.20.1
mount                  support
module-init-tools      9
e2fsprogs              1.42.8
pcmciautils            018
PPP                    2.4.5
Linux C Library        2.17
Dynamic linker (ldd)   2.17
Procps                 3.3.3
Net-tools              1.60
Kbd                    1.15.5
Sh-utils               8.20
wireless-tools         30
Modules Loaded         michael_mic arc4 bnep parport_pc rfcomm ppdev bluetooth binfmt_misc xt_hl ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ip6t_REJECT xt_LOG xt_limit xt_tcpudp xt_addrtype nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack i915 ipt_REJECT x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_hdmi ip6table_filter coretemp kvm_intel uvcvideo kvm ip6_tables snd_hda_codec_conexant nf_conntrack_netbios_ns lib80211_crypt_tkip nf_conntrack_broadcast wl nf_nat_ftp snd_hda_intel nf_nat nf_conntrack_ftp snd_hda_codec lib80211 videobuf2_vmalloc videobuf2_memops snd_hwdep videobuf2_core cfg80211 snd_pcm videodev rtsx_pci_ms thinkpad_acpi nf_conntrack snd_page_alloc nvram iptable_filter snd_seq_midi ip_tables crct10dif_pclmul crc32_pclmul ghash_clmulni_intel cryptd x_tables memstick joydev snd_seq_midi_event snd_rawmidi snd_seq drm_kms_helper drm snd_seq_device snd_timer mei_me snd wmi microcode mei soundcore lpc_ich i2c_algo_bit video psmouse mac_hid serio_raw lp parport mmc_block rtsx_p


ci_sdmmc r8169 ahci rtsx_pci libahci mii

[7.2.] Processor information (from /proc/cpuinfo):
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping	: 9
microcode	: 0x15
cpu MHz		: 2499.902
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 4988.43
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping	: 9
microcode	: 0x15
cpu MHz		: 2499.902
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 4988.43
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping	: 9
microcode	: 0x15
cpu MHz		: 2500.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 4988.43
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping	: 9
microcode	: 0x15
cpu MHz		: 2422.460
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 4988.43
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

[7.3.] Module information (from cat /proc/modules)
michael_mic 12612 4 - Live 0x0000000000000000
arc4 12608 2 - Live 0x0000000000000000
parport_pc 36797 0 - Live 0x0000000000000000
ppdev 17635 0 - Live 0x0000000000000000
bnep 19624 2 - Live 0x0000000000000000
rfcomm 69078 4 - Live 0x0000000000000000
bluetooth 387189 10 bnep,rfcomm, Live 0x0000000000000000
xt_hl 12521 6 - Live 0x0000000000000000
ip6t_rt 13537 3 - Live 0x0000000000000000
nf_conntrack_ipv6 18894 7 - Live 0x0000000000000000
nf_defrag_ipv6 34768 1 nf_conntrack_ipv6, Live 0x0000000000000000
ip6t_REJECT 12939 3 - Live 0x0000000000000000
xt_LOG 17717 10 - Live 0x0000000000000000
binfmt_misc 17431 1 - Live 0x0000000000000000
xt_limit 12711 13 - Live 0x0000000000000000
xt_tcpudp 12884 18 - Live 0x0000000000000000
xt_addrtype 12635 4 - Live 0x0000000000000000
nf_conntrack_ipv4 15012 7 - Live 0x0000000000000000
nf_defrag_ipv4 12758 1 nf_conntrack_ipv4, Live 0x0000000000000000
xt_conntrack 12760 14 - Live 0x0000000000000000
x86_pkg_temp_thermal 14162 0 - Live 0x0000000000000000
ipt_REJECT 12541 3 - Live 0x0000000000000000
intel_powerclamp 14705 0 - Live 0x0000000000000000
coretemp 13435 0 - Live 0x0000000000000000
kvm_intel 142969 0 - Live 0x0000000000000000
ip6table_filter 12815 1 - Live 0x0000000000000000
ip6_tables 27025 1 ip6table_filter, Live 0x0000000000000000
i915 782531 3 - Live 0x0000000000000000
nf_conntrack_netbios_ns 12665 0 - Live 0x0000000000000000
nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0x0000000000000000
lib80211_crypt_tkip 17619 0 - Live 0x0000000000000000
nf_nat_ftp 12770 0 - Live 0x0000000000000000
kvm 451252 1 kvm_intel, Live 0x0000000000000000
wl 4207809 0 - Live 0x0000000000000000 (POF)
nf_nat 21798 1 nf_nat_ftp, Live 0x0000000000000000
nf_conntrack_ftp 18638 1 nf_nat_ftp, Live 0x0000000000000000
snd_hda_codec_hdmi 46207 1 - Live 0x0000000000000000
snd_hda_codec_conexant 57441 1 - Live 0x0000000000000000
nf_conntrack 92803 8 nf_conntrack_ipv6,nf_conntrack_ipv4,xt_conntrack,nf_conntrack_netbios_ns,nf_conntrack_broadcast,nf_nat_ftp,nf_nat,nf_conntrack_ftp, Live 0x0000000000000000
snd_hda_intel 52355 3 - Live 0x0000000000000000
snd_hda_codec 192906 3 snd_hda_codec_hdmi,snd_hda_codec_conexant,snd_hda_intel, Live 0x0000000000000000
joydev 17381 0 - Live 0x0000000000000000
uvcvideo 80834 0 - Live 0x0000000000000000
lib80211 14381 2 lib80211_crypt_tkip,wl, Live 0x0000000000000000
thinkpad_acpi 80817 1 - Live 0x0000000000000000
iptable_filter 12810 1 - Live 0x0000000000000000
cfg80211 490302 1 wl, Live 0x0000000000000000
snd_hwdep 13602 1 snd_hda_codec, Live 0x0000000000000000
nvram 14411 1 thinkpad_acpi, Live 0x0000000000000000
snd_pcm 102099 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec, Live 0x0000000000000000
videobuf2_vmalloc 13216 1 uvcvideo, Live 0x0000000000000000
ip_tables 27239 1 iptable_filter, Live 0x0000000000000000
videobuf2_memops 13362 1 videobuf2_vmalloc, Live 0x0000000000000000
snd_page_alloc 18710 2 snd_hda_intel,snd_pcm, Live 0x0000000000000000
x_tables 34059 13 xt_hl,ip6t_rt,ip6t_REJECT,xt_LOG,xt_limit,xt_tcpudp,xt_addrtype,xt_conntrack,ipt_REJECT,ip6table_filter,ip6_tables,iptable_filter,ip_tables, Live 0x0000000000000000
videobuf2_core 40664 1 uvcvideo, Live 0x0000000000000000
snd_seq_midi 13324 0 - Live 0x0000000000000000
snd_seq_midi_event 14899 1 snd_seq_midi, Live 0x0000000000000000
videodev 134641 2 uvcvideo,videobuf2_core, Live 0x0000000000000000
psmouse 101945 0 - Live 0x0000000000000000
crct10dif_pclmul 14289 0 - Live 0x0000000000000000
snd_rawmidi 30144 1 snd_seq_midi, Live 0x0000000000000000
crc32_pclmul 13113 0 - Live 0x0000000000000000
ghash_clmulni_intel 13259 0 - Live 0x0000000000000000
cryptd 20359 1 ghash_clmulni_intel, Live 0x0000000000000000
snd_seq 61560 2 snd_seq_midi,snd_seq_midi_event, Live 0x0000000000000000
rtsx_pci_ms 18151 0 - Live 0x0000000000000000
snd_seq_device 14497 3 snd_seq_midi,snd_rawmidi,snd_seq, Live 0x0000000000000000
memstick 16966 1 rtsx_pci_ms, Live 0x0000000000000000
microcode 23656 0 - Live 0x0000000000000000
drm_kms_helper 52758 1 i915, Live 0x0000000000000000
snd_timer 29427 2 snd_pcm,snd_seq, Live 0x0000000000000000
serio_raw 13462 0 - Live 0x0000000000000000
mei_me 18581 0 - Live 0x0000000000000000
drm 298412 4 i915,drm_kms_helper, Live 0x0000000000000000
mac_hid 13205 0 - Live 0x0000000000000000
wmi 19177 0 - Live 0x0000000000000000
video 19370 1 i915, Live 0x0000000000000000
mei 77820 1 mei_me, Live 0x0000000000000000
snd 69238 18 snd_hda_codec_hdmi,snd_hda_codec_conexant,snd_hda_intel,snd_hda_codec,thinkpad_acpi,snd_hwdep,snd_pcm,snd_seq_midi,snd_rawmidi,snd_seq,snd_seq_device,snd_timer, Live 0x0000000000000000
soundcore 12680 1 snd, Live 0x0000000000000000
lpc_ich 21080 0 - Live 0x0000000000000000
i2c_algo_bit 13413 1 i915, Live 0x0000000000000000
lp 17759 0 - Live 0x0000000000000000
parport 42313 3 parport_pc,ppdev,lp, Live 0x0000000000000000
mmc_block 35929 0 - Live 0x0000000000000000
rtsx_pci_sdmmc 23229 0 - Live 0x0000000000000000
ahci 25819 6 - Live 0x0000000000000000
r8169 71677 0 - Live 0x0000000000000000
libahci 32168 1 ahci, Live 0x0000000000000000
rtsx_pci 45956 2 rtsx_pci_ms,rtsx_pci_sdmmc, Live 0x0000000000000000
mii 13934 1 r8169, Live 0x0000000000000000

[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem):
0000-0cf7 : PCI Bus 0000:00
   0000-001f : dma1
   0020-0021 : pic1
   0040-0043 : timer0
   0050-0053 : timer1
   0060-0060 : keyboard
   0062-0062 : EC data
   0064-0064 : keyboard
   0066-0066 : EC cmd
   0070-0077 : rtc0
   0080-008f : dma page reg
   00a0-00a1 : pic2
   00c0-00df : dma2
   00f0-00ff : fpu
   0400-0403 : ACPI PM1a_EVT_BLK
   0404-0405 : ACPI PM1a_CNT_BLK
   0408-040b : ACPI PM_TMR
   0410-0415 : ACPI CPU throttle
   0420-042f : ACPI GPE0_BLK
   0430-0433 : iTCO_wdt
   0450-0450 : ACPI PM2_CNT_BLK
   0454-0457 : pnp 00:06
   0458-047f : pnp 00:04
     0460-047f : iTCO_wdt
   0500-057f : pnp 00:04
   0680-069f : pnp 00:04
   06fc-06ff : pnp 00:04
   0700-0703 : pnp 00:04
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
   1000-100f : pnp 00:04
   164e-164f : pnp 00:04
   2000-2fff : PCI Bus 0000:05
     2000-20ff : 0000:05:00.0
       2000-20ff : r8169
   3000-3fff : PCI Bus 0000:04
   4000-4fff : PCI Bus 0000:03
   5000-503f : 0000:00:02.0
   5060-507f : 0000:00:1f.2
     5060-507f : ahci
   5080-5087 : 0000:00:1f.2
     5080-5087 : ahci
   5088-508f : 0000:00:1f.2
     5088-508f : ahci
   5098-509b : 0000:00:1f.2
     5098-509b : ahci
   509c-509f : 0000:00:1f.2
     509c-509f : ahci
   efa0-efbf : 0000:00:1f.3
   ffff-ffff : pnp 00:04
     ffff-ffff : pnp 00:04

00000000-00000fff : reserved
00001000-0009cfff : System RAM
0009d000-0009ffff : reserved
000a0000-000bffff : PCI Bus 0000:00
000c0000-000cedff : Video ROM
000e0000-000fffff : reserved
   000f0000-000fffff : System ROM
00100000-1fffffff : System RAM
   01000000-01736633 : Kernel code
   01736634-01d1d5bf : Kernel data
   01e75000-01fd9fff : Kernel bss
20000000-201fffff : reserved
20200000-40003fff : System RAM
40004000-40004fff : reserved
40005000-c6a13fff : System RAM
c6a14000-dae9efff : reserved
dae9f000-daf9efff : ACPI Non-volatile Storage
daf9f000-daffefff : ACPI Tables
dafff000-df9fffff : reserved
   dba00000-df9fffff : Graphics Stolen Memory
dfa00000-feafffff : PCI Bus 0000:00
   e0000000-efffffff : 0000:00:02.0
     e0000000-e0407fff : BOOTFB
   f0000000-f03fffff : 0000:00:02.0
   f0400000-f0bfffff : PCI Bus 0000:03
   f0c00000-f13fffff : PCI Bus 0000:04
   f1400000-f1cfffff : PCI Bus 0000:05
     f1400000-f1403fff : 0000:05:00.0
       f1400000-f1403fff : r8169
     f1404000-f1404fff : 0000:05:00.0
       f1404000-f1404fff : r8169
   f1d00000-f24fffff : PCI Bus 0000:05
   f2500000-f2dfffff : PCI Bus 0000:04
     f2500000-f2507fff : 0000:04:00.0
   f2e00000-f35fffff : PCI Bus 0000:03
     f2e00000-f2e00fff : 0000:03:00.0
       f2e00000-f2e00fff : rtsx_pci
   f3600000-f360ffff : 0000:00:14.0
     f3600000-f360ffff : xhci_hcd
   f3610000-f3613fff : 0000:00:1b.0
     f3610000-f3613fff : ICH HD audio
   f3614000-f36140ff : 0000:00:1f.3
   f3615000-f361500f : 0000:00:16.0
     f3615000-f361500f : mei_me
   f3618000-f36187ff : 0000:00:1f.2
     f3618000-f36187ff : ahci
   f3619000-f36193ff : 0000:00:1d.0
     f3619000-f36193ff : ehci_hcd
   f361a000-f361a3ff : 0000:00:1a.0
     f361a000-f361a3ff : ehci_hcd
   f8000000-fbffffff : PCI MMCONFIG 0000 [bus 00-3f]
     f8000000-fbffffff : reserved
       f8000000-fbffffff : pnp 00:0a
fec00000-fec00fff : reserved
   fec00000-fec003ff : IOAPIC 0
fed00000-fed003ff : HPET 0
fed08000-fed08fff : reserved
fed10000-fed19fff : reserved
   fed10000-fed17fff : pnp 00:0a
   fed18000-fed18fff : pnp 00:0a
   fed19000-fed19fff : pnp 00:0a
fed1c000-fed1ffff : reserved
   fed1c000-fed1ffff : pnp 00:0a
     fed1f410-fed1f414 : iTCO_wdt
fed20000-fed3ffff : pnp 00:0a
fed45000-fed8ffff : pnp 00:0a
fed90000-fed93fff : pnp 00:0a
fee00000-fee00fff : Local APIC
   fee00000-fee00fff : reserved
ff000000-ff000fff : reserved
ffc00000-ffffffff : reserved
   fffff000-ffffffff : pnp 00:0a
100000000-11e5fffff : System RAM
11e600000-11fffffff : RAM buffer

[7.5.] PCI information ('lspci -vvv' as root):
  00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
	Latency: 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) (prog-if 00 [VGA controller])
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 46
	Region 0: Memory at f0000000 (64-bit, non-prefetchable) [size=4M]
	Region 2: Memory at e0000000 (64-bit, prefetchable) [size=256M]
	Region 4: I/O ports at 5000 [size=64]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0f00c  Data: 4142
	Capabilities: [d0] Power Management version 2
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [a4] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: i915

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI])
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 40
	Region 0: Memory at f3600000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: [70] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0-,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 4191
	Kernel driver in use: xhci_hcd

00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 44
	Region 0: Memory at f3615000 (64-bit, non-prefetchable) [size=16]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [8c] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 41d1
	Kernel driver in use: mei_me

00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) (prog-if 20 [EHCI])
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 16
	Region 0: Memory at f361a000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: ehci-pci

00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 45
	Region 0: Memory at f3610000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 4122
	Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- RBE- FLReset+
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed unknown, Width x0, ASPM unknown, Latency L0 <64ns, L1 <1us
			ClockPM- Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; Disabled- Retrain- CommClk-
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed unknown, Width x0, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
	Capabilities: [100 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=01
			Status:	NegoPending- InProgress-
		VC1:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=1 ArbSelect=Fixed TC/VC=22
			Status:	NegoPending- InProgress-
	Capabilities: [130 v1] Root Complex Link
		Desc:	PortNumber=0f ComponentID=00 EltType=Config
		Link0:	Desc:	TargetPort=00 TargetComponent=00 AssocRCRB- LinkType=MemMapped LinkValid+
			Addr:	00000000fed1c000
	Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
	I/O behind bridge: 00004000-00004fff
	Memory behind bridge: f2e00000-f35fffff
	Prefetchable memory behind bridge: 00000000f0400000-00000000f0bfffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #1, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <16us
			ClockPM- Surprise- LLActRep+ BwNot-
		LnkCtl:	ASPM L0s L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+
			Slot #0, PowerLimit 10.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet- LinkState-
		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
		RootCap: CRSVisible-
		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+ ARIFwd-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- ARIFwd-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
		Address: 00000000  Data: 0000
	Capabilities: [90] Subsystem: Lenovo Device 5018
	Capabilities: [a0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
	I/O behind bridge: 00003000-00003fff
	Memory behind bridge: f2500000-f2dfffff
	Prefetchable memory behind bridge: 00000000f0c00000-00000000f13fffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #2, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <16us
			ClockPM- Surprise- LLActRep+ BwNot-
		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+
			Slot #1, PowerLimit 10.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet- LinkState-
		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
		RootCap: CRSVisible-
		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+ ARIFwd-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- ARIFwd-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
		Address: 00000000  Data: 0000
	Capabilities: [90] Subsystem: Lenovo Device 5018
	Capabilities: [a0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 (rev c4) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Bus: primary=00, secondary=05, subordinate=05, sec-latency=0
	I/O behind bridge: 00002000-00002fff
	Memory behind bridge: f1d00000-f24fffff
	Prefetchable memory behind bridge: 00000000f1400000-00000000f1cfffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #4, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <16us
			ClockPM- Surprise- LLActRep+ BwNot-
		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+
			Slot #3, PowerLimit 10.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet- LinkState-
		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
		RootCap: CRSVisible-
		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+ ARIFwd-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- ARIFwd-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
		Address: 00000000  Data: 0000
	Capabilities: [90] Subsystem: Lenovo Device 5018
	Capabilities: [a0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
	Subsystem: Lenovo Device 5018
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 23
	Region 0: Memory at f3619000 (32-bit, non-prefetchable) [size=1K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [58] Debug port: BAR=1 offset=00a0
	Capabilities: [98] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04)
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Capabilities: [e0] Vendor Specific Information: Len=0c <?>
	Kernel driver in use: lpc_ich

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin B routed to IRQ 43
	Region 0: I/O ports at 5088 [size=8]
	Region 1: I/O ports at 509c [size=4]
	Region 2: I/O ports at 5080 [size=8]
	Region 3: I/O ports at 5098 [size=4]
	Region 4: I/O ports at 5060 [size=32]
	Region 5: Memory at f3618000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
		Address: fee0c00c  Data: 41c1
	Capabilities: [70] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004
	Capabilities: [b0] PCI Advanced Features
		AFCap: TP+ FLR+
		AFCtrl: FLR-
		AFStatus: TP-
	Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin C routed to IRQ 7
	Region 0: Memory at f3614000 (64-bit, non-prefetchable) [size=256]
	Region 4: I/O ports at efa0 [size=32]

03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader (rev 01)
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 41
	Region 0: Memory at f2e00000 (32-bit, non-prefetchable) [size=4K]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0-,D1+,D2+,D3hot+,D3cold-)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 41a1
	Capabilities: [70] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 unlimited, L1 <64us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM L0s L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk-
			ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Not Supported, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr+ BadTLP+ BadDLLP- Rollover- Timeout- NonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [140 v1] Device Serial Number 00-00-00-01-00-4c-e0-00
	Kernel driver in use: rtsx_pci

04:00.0 Network controller: Broadcom Corporation BCM43142 802.11b/g/n (rev 01)
	Subsystem: Lenovo Device 0611
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 17
	Region 0: Memory at f2500000 (64-bit, non-prefetchable) [size=32K]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=2 PME-
	Capabilities: [58] Vendor Specific Information: Len=78 <?>
	Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [d0] Express (v1) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <4us, L1 <64us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 14, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [13c v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [160 v1] Device Serial Number 00-00-5a-ff-ff-fc-2c-d0
	Capabilities: [16c v1] Power Budgeting <?>
	Kernel driver in use: wl

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
	Subsystem: Lenovo Device 5018
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 42
	Region 0: I/O ports at 2000 [size=256]
	Region 2: Memory at f1404000 (64-bit, prefetchable) [size=4K]
	Region 4: Memory at f1400000 (64-bit, prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee0f00c  Data: 41b1
	Capabilities: [70] Express (v2) Endpoint, MSI 01
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 <64us
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
			MaxPayload 128 bytes, MaxReadReq 4096 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 unlimited, L1 <64us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM L0s L1 Enabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range ABCD, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
		Vector table: BAR=4 offset=00000000
		PBA: BAR=4 offset=00000800
	Capabilities: [d0] Vital Product Data
		Unknown small resource type 00, will not decode more.
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr+ BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [140 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [160 v1] Device Serial Number 01-00-00-00-68-4c-e0-00
	Kernel driver in use: r8169

[7.6.] SCSI information (from /proc/scsi/scsi):
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
   Vendor: ATA      Model: WDC WD5000LPVT-0 Rev: 02.0
   Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
   Vendor: HL-DT-ST Model: DVDRAM GU70N     Rev: LE20
   Type:   CD-ROM                           ANSI  SCSI revision: 05

[7.7.] Other information that might be relevant to the problem:
1
10
1001
1002
1011
1034
1066
11
1105
1112
1140
1142
1155
1167
1181
12
1222
13
14
1404
1415
1464
1466
15
150
151
152
1522
1526
153
1531
154
1547
155
1556
1558
1560
1564
1567
1574
1577
1581
1584
1587
1590
1594
16
160
1603
1604
1605
1607
1608
161
1611
1622
1625
1627
1631
166
17
1719
1721
174
175
1759
1761
18
1801
1817
1821
1826
1836
1838
1848
1850
1854
1859
1862
1865
1867
1884
1892
19
1909
1925
1933
1945
1952
2
20
2010
21
2102
2106
2107
2162
2179
22
2201
2202
2203
2210
2258
23
2333
2373
24
2489
25
26
27
28
29
3
30
302
308
31
32
33
34
348
35
353
36
37
376
38
39
40
41
42
43
437
44
45
457
46
460
47
477
48
483
484
49
496
5
50
503
51
52
53
54
55
57
573
576
577
58
584
585
59
60
61
615
616
62
63
698
7
719
75
76
783
798
8
828
835
868
876
887
888
891
893
9
911
927
928
951
967
97
98
99
acpi
asound
brcm_monitor0
buddyinfo
bus
cgroups
cmdline
consoles
cpuinfo
crypto
devices
diskstats
dma
driver
execdomains
fb
filesystems
fs
interrupts
iomem
ioports
irq
kallsyms
kcore
key-users
kmsg
kpagecount
kpageflags
latency_stats
loadavg
locks
mdstat
meminfo
misc
modules
mounts
mtrr
net
pagetypeinfo
partitions
sched_debug
schedstat
scsi
self
slabinfo
softirqs
stat
swaps
sys
sysrq-trigger
sysvipc
timer_list
timer_stats
tty
uptime
version
vmallocinfo
vmstat
zoneinfo

[8.]
https://bugs.launchpad.net/bugs/1256630



^ permalink raw reply

* Re: [PATCH] android/pan: Add pan sdp record for NAP role
From: Szymon Janc @ 2013-12-21 13:38 UTC (permalink / raw)
  To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1387547621-26455-1-git-send-email-ravikumar.veeramally@linux.intel.com>

Hi Ravi,

On Friday 20 December 2013 15:53:41 Ravi kumar Veeramally wrote:
> ---
>  android/pan.c | 91
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed,
> 91 insertions(+)
> 
> diff --git a/android/pan.c b/android/pan.c
> index 689c7ef..f322f20 100644
> --- a/android/pan.c
> +++ b/android/pan.c
> @@ -44,9 +44,12 @@
>  #include "utils.h"
>  #include "bluetooth.h"
> 
> +#define SVC_HINT_CAPTURING 0x08

Shouldn't this be SVC_HINT_NETWORKING 0x02 ?

> +
>  static bdaddr_t adapter_addr;
>  GSList *devices = NULL;
>  uint8_t local_role = HAL_PAN_ROLE_NONE;
> +static uint32_t record_id = 0;
> 
>  struct pan_device {
>  	char		iface[16];
> @@ -335,20 +338,106 @@ static const struct ipc_handler cmd_handlers[] = {
>  	{ bt_pan_disconnect, false, sizeof(struct hal_cmd_pan_disconnect) },
>  };
> 
> +static sdp_record_t *pan_record(void)
> +{
> +	sdp_list_t *svclass, *pfseq, *apseq, *root, *aproto;
> +	uuid_t root_uuid, pan, l2cap, bnep;
> +	sdp_profile_desc_t profile[1];
> +	sdp_list_t *proto[2];
> +	sdp_data_t *v, *p;
> +	uint16_t psm = BNEP_PSM, version = 0x0100;
> +	uint16_t security = 0x0001, type = 0xfffe;
> +	uint32_t rate = 0;
> +	const char *desc = "Network service", *name = "bnep";
> +	sdp_record_t *record;
> +	uint16_t ptype[] = { 0x0800, /* IPv4 */ 0x0806,  /* ARP */ };
> +	sdp_data_t *head, *pseq, *data;
> +
> +	record = sdp_record_alloc();
> +	if (!record)
> +		return NULL;
> +
> +	record->attrlist = NULL;
> +	record->pattern = NULL;
> +
> +	sdp_uuid16_create(&pan, NAP_SVCLASS_ID);
> +	svclass = sdp_list_append(NULL, &pan);
> +	sdp_set_service_classes(record, svclass);
> +	sdp_uuid16_create(&profile[0].uuid, NAP_PROFILE_ID);
> +	profile[0].version = 0x0100;
> +	pfseq = sdp_list_append(NULL, &profile[0]);
> +	sdp_set_profile_descs(record, pfseq);
> +	sdp_set_info_attr(record, name, NULL, desc);
> +	sdp_attr_add_new(record, SDP_ATTR_NET_ACCESS_TYPE, SDP_UINT16, &type);
> +	sdp_attr_add_new(record, SDP_ATTR_MAX_NET_ACCESSRATE,
> +							SDP_UINT32, &rate);
> +	sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
> +	root = sdp_list_append(NULL, &root_uuid);
> +	sdp_set_browse_groups(record, root);
> +	sdp_uuid16_create(&l2cap, L2CAP_UUID);
> +	proto[0] = sdp_list_append(NULL, &l2cap);
> +	p = sdp_data_alloc(SDP_UINT16, &psm);
> +	proto[0] = sdp_list_append(proto[0], p);
> +	apseq = sdp_list_append(NULL, proto[0]);
> +	sdp_uuid16_create(&bnep, BNEP_UUID);
> +	proto[1] = sdp_list_append(NULL, &bnep);
> +	v = sdp_data_alloc(SDP_UINT16, &version);
> +	proto[1] = sdp_list_append(proto[1], v);
> +
> +	head = sdp_data_alloc(SDP_UINT16, &ptype[0]);
> +	data = sdp_data_alloc(SDP_UINT16, &ptype[1]);
> +	sdp_seq_append(head, data);
> +
> +	pseq = sdp_data_alloc(SDP_SEQ16, head);
> +	proto[1] = sdp_list_append(proto[1], pseq);
> +	apseq = sdp_list_append(apseq, proto[1]);
> +	aproto = sdp_list_append(NULL, apseq);
> +	sdp_set_access_protos(record, aproto);
> +	sdp_add_lang_attr(record);
> +	sdp_attr_add_new(record, SDP_ATTR_SECURITY_DESC, SDP_UINT16, &security);
> +

I would group those calls in similar fashion we have in other service record 
creating functions (browse group, svc, profile id, protocols etc... see 
android/a2dp.c or android/socket.c).

> +	sdp_data_free(p);
> +	sdp_data_free(v);
> +	sdp_list_free(apseq, NULL);
> +	sdp_list_free(root, NULL);
> +	sdp_list_free(aproto, NULL);
> +	sdp_list_free(proto[0], NULL);
> +	sdp_list_free(proto[1], NULL);
> +	sdp_list_free(svclass, NULL);
> +	sdp_list_free(pfseq, NULL);
> +
> +	return record;
> +}
> +
>  bool bt_pan_register(const bdaddr_t *addr)
>  {
> +	sdp_record_t *rec;
>  	int err;
> 
>  	DBG("");
> 
>  	bacpy(&adapter_addr, addr);
> 
> +	rec = pan_record();
> +	if (!rec) {
> +		error("Failed to allocate PAN record");
> +		return false;
> +	}
> +
> +	if (bt_adapter_add_record(rec, SVC_HINT_CAPTURING) < 0) {
> +		error("Failed to register PAN record");
> +		sdp_record_free(rec);
> +		return false;
> +	}
> +
>  	err = bnep_init();
>  	if (err) {
>  		error("bnep init failed");
> +		sdp_record_free(rec);
>  		return false;
>  	}
> 
> +	record_id = rec->handle;
>  	ipc_register(HAL_SERVICE_ID_PAN, cmd_handlers,
>  						G_N_ELEMENTS(cmd_handlers));
> 
> @@ -362,4 +451,6 @@ void bt_pan_unregister(void)
>  	bnep_cleanup();
> 
>  	ipc_unregister(HAL_SERVICE_ID_PAN);
> +	bt_adapter_remove_record(record_id);
> +	record_id = 0;
>  }

-- 
BR
Szymon Janc
szymon.janc@gmail.com

^ permalink raw reply

* [PATCH 4/4] android: Add shortcommings section to README
From: Szymon Janc @ 2013-12-20 18:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1387564210-6102-1-git-send-email-szymon.janc@tieto.com>

This sections lists unimplemented methods, callbacks or properties
with few words of comments why feature is missing.
---
 android/README | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/android/README b/android/README
index 68c3e9f..6d0e242 100644
--- a/android/README
+++ b/android/README
@@ -91,3 +91,40 @@ use provided android/system-emulator, which takes care of launching daemon
 automatically on HAL library initialization. To deinitialize HAL library and
 stop daemon type 'bluetooth cleanup'. Type 'help' for more information. Tab
 completion is also supported.
+
+===========================
+Implementation shortcomings
+===========================
+
+It is possible that some of HAL functionality is missing implementation due to
+reasons like feature feasibility or necessity for latest Android Framework.
+This sections provides list of such deficiencies. Note that HAL library is
+always expected to fully implement HAL API so missing implementation might
+happen only in daemon.
+
+HAL Bluetooth
+=============
+methods:
+dut_mode_send                      never called from Android Framework
+le_test_mode                       never called from Android Framework
+get_remote_service_record          never called from Android Framework
+
+callbacks:
+dut_mode_recv_cb
+le_test_mode_cb
+
+properties:
+BT_PROPERTY_SERVICE_RECORD         not supported for adapter and device, for
+                                   device this property is to be returned as
+                                   response to get_remote_service_record,
+                                   not sure what to return on get_property
+                                   calls (records of all services?)
+
+BT_PROPERTY_REMOTE_VERSION_INFO    information required by this property (LMP
+                                   information) are not accessible from mgmt
+                                   interface, also marking this property as
+                                   settable is probably a typo in HAL header
+
+Socket HAL
+==========
+Support only for BTSOCK_RFCOMM socket type.
-- 
1.8.3.2


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox