Re: [RFC 07/11] android/tester: Execute hh connection state cbacks in main loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Anderson,

On 02/19/2014 12:25 PM, Anderson Lizardo wrote:
Hi Jakub,

On Wed, Feb 19, 2014 at 6:25 AM, Jakub Tyszkowski
<jakub.tyszkowski@xxxxxxxxx> wrote:
Execute generic HIDHost connection_state_cb in tester's main loop.
---
  android/android-tester.c | 23 +++++++++++++++++++----
  1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/android/android-tester.c b/android/android-tester.c
index 0115943..664f381 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -3212,19 +3212,34 @@ clean:
                 close(sock_fd);
  }

-static void hidhost_connection_state_cb(bt_bdaddr_t *bd_addr,
-                                               bthh_connection_state_t state)
+static gboolean hidhost_connection_state(gpointer user_data)
  {
         struct test_data *data = tester_get_data();
         const struct hidhost_generic_data *test = data->test_data;
+       struct generic_cb_data *cb_data = user_data;

         data->cb_count++;

-       if (state == BTHH_CONN_STATE_CONNECTED)
+       if ((int) cb_data->state == BTHH_CONN_STATE_CONNECTED)

You are reusing a variable of different type (bt_state_t vs.
bthh_connection_state_t), so I believe it's why you are casting above.

My suggestion (if that works) is to declare the state field in
generic_cb_data as int, so it should work without any casting.

Best Regards,

Yeap, we could probably use int or add more fields to this struct. But it would probably be better to replace single generic_cb_data with per HAL struct like bt_cb_data and hh_cb_data. It would be more elegant.

Best regards,
Jakub Tyszkowski
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux