* Re: Controlling LEDs and rumble on sixaxis
From: Antonio Ospite @ 2014-03-04 22:11 UTC (permalink / raw)
To: Andrea; +Cc: linux-bluetooth
In-Reply-To: <53164362.4060102@gmail.com>
Hi Andrea,
On Tue, 04 Mar 2014 21:19:30 +0000
Andrea <mariofutire@gmail.com> wrote:
> Hi,
>
> I would like to be able to control from a client app the LEDs and
> rumble of the sixaxis PS3 controller.
>
> As far as I understand the kernel 3.15 will allow LEDs to be set by
> bluez when the controller is connected. If I wanted to change the
> LEDs in my app, would this something that needs to be done by bluez?
> Can I write to some device and bypass bluez?
With older kernels you can already set LEDs and rumble by sending the
HID output report 01 via hidraw (actually there is a regression
preventing that via BT in some versions). See the code in the BlueZ
sixaxis plugin or in the newer linux kernel for the report format.
With recent/newer kernels you can use the sysfs leds class under
/sys/class/leds/ to control the LEDs and the force feedback api[1] to
control the rumble.
No need to "bypass" BlueZ, the BlueZ sixaxis plugin sets the LEDs when
it detects the controller in order to tell the user the controller
number, but after that you are free to change the LEDs as you want.
[1] https://www.kernel.org/doc/Documentation/input/ff.txt
> Would this be a job for dbus?
>
dbus is not necessary, but depending on your application you may want to
use libudev to add the hotplug detection of the controller.
> I use the sixaxis to control an app on the Pi, and given the lack of
> feedbacks from the Pi, the LEDs and rumble could help me on that
> front.
>
> Does it make sense to do it?
>
Why not?
Ciao,
Antonio
--
Antonio Ospite
http://ao2.it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
^ permalink raw reply
* Re: [PATCH BlueZ v0 1/9] gdbus: Add g_dbus_client_set_proxies_ready_watch()
From: Marcel Holtmann @ 2014-03-05 6:37 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1393607136-16908-2-git-send-email-claudio.takahasi@openbossa.org>
Hi Claudio,
> This patch adds a new gdbus helper to notify the clients that
> GetManagedObjects reply was received and the last proxy has been
> informed previously by the proxy_added callback.
> ---
> gdbus/client.c | 18 ++++++++++++++++++
> gdbus/gdbus.h | 4 ++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/gdbus/client.c b/gdbus/client.c
> index be8cc29..f479742 100644
> --- a/gdbus/client.c
> +++ b/gdbus/client.c
> @@ -56,6 +56,8 @@ struct GDBusClient {
> void *signal_data;
> GDBusProxyFunction proxy_added;
> GDBusProxyFunction proxy_removed;
> + GDBusClientReadyFunction ready;
> + void *ready_data;
> GDBusPropertyFunction property_changed;
> void *user_data;
> GList *proxy_list;
> @@ -982,6 +984,9 @@ static void parse_managed_objects(GDBusClient *client, DBusMessage *msg)
>
> dbus_message_iter_next(&dict);
> }
> +
> + if (client->ready)
> + client->ready(client->ready_data);
> }
>
> static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
> @@ -1261,3 +1266,16 @@ gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
>
> return TRUE;
> }
> +
> +gboolean g_dbus_client_set_proxies_ready_watch(GDBusClient *client,
> + GDBusClientReadyFunction ready,
> + void *user_data)
> +{
> + if (client == NULL)
> + return FALSE;
> +
> + client->ready = ready;
> + client->ready_data = user_data;
> +
> + return TRUE;
> +}
> diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
> index 9542109..aa407aa 100644
> --- a/gdbus/gdbus.h
> +++ b/gdbus/gdbus.h
> @@ -337,6 +337,7 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
> GDBusReturnFunction function, void *user_data,
> GDBusDestroyFunction destroy);
>
> +typedef void (* GDBusClientReadyFunction) (void *user_data);
> typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
> typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
> DBusMessageIter *iter, void *user_data);
> @@ -365,6 +366,9 @@ gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
> GDBusProxyFunction proxy_removed,
> GDBusPropertyFunction property_changed,
> void *user_data);
> +gboolean g_dbus_client_set_proxies_ready_watch(GDBusClient *client,
> + GDBusClientReadyFunction ready,
> + void *user_data);
this names is a bit confusing. On one hand it is proxies ready on the other it is client ready. We need to be a bit specific here.
My initial thinking is this should be
g_dbus_client_set_ready_watch()
and then use GDBusClientFunction(GDBusClient, user_data) as callback function.
Regards
Marcel
^ permalink raw reply
* [PATCH] tools/sco-tester: Remove not used function argument
From: Marcin Kraglak @ 2014-03-05 7:15 UTC (permalink / raw)
To: linux-bluetooth
---
tools/sco-tester.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/sco-tester.c b/tools/sco-tester.c
index 25e4af6..db45ef0 100644
--- a/tools/sco-tester.c
+++ b/tools/sco-tester.c
@@ -415,7 +415,7 @@ end:
close(sk);
}
-static int create_sco_sock(struct test_data *data, uint16_t psm)
+static int create_sco_sock(struct test_data *data)
{
const uint8_t *master_bdaddr;
struct sockaddr_sco addr;
@@ -514,7 +514,7 @@ static void test_connect(const void *test_data)
GIOChannel *io;
int sk;
- sk = create_sco_sock(data, 0);
+ sk = create_sco_sock(data);
if (sk < 0) {
tester_test_failed();
return;
@@ -543,7 +543,7 @@ static void test_connect_transp(const void *test_data)
int sk, err;
struct bt_voice voice;
- sk = create_sco_sock(data, 0);
+ sk = create_sco_sock(data);
if (sk < 0) {
tester_test_failed();
return;
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCHv2 00/10] AVRCP test patches rebased
From: Luiz Augusto von Dentz @ 2014-03-05 8:24 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1393941735-12187-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Tue, Mar 4, 2014 at 4:02 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> This is rebased version of my previous patch set rebased after
> latest modifications of avrcp-lib.
>
> Andrei Emeltchenko (10):
> avrcp: Fix possible buffer overflow
> unit/avrcp: Add /TP/PAS/BV-06-C test
> unit/avrcp: Add /TP/PAS/BV-08-C test
> android/avrcp: Add avrcp_get_current_player_value() function
> unit/avrcp: Add /TP/PAS/BV-09-C test
> unit/avrcp: Add /TP/PAS/BV-10-C test
> android/avrcp: Add avrcp_set_player_value() function
> unit/avrcp: Add /TP/PAS/BV-11-C test
> unit/avrcp: Add /TP/PAS/BI-01-C test
> doc: Update test coverage document
>
> android/avrcp-lib.c | 39 +++++++++++++
> android/avrcp-lib.h | 14 +++++
> doc/test-coverage.txt | 2 +-
> profiles/audio/avrcp.c | 3 +
> unit/test-avrcp.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 213 insertions(+), 1 deletion(-)
>
> --
> 1.8.3.2
Pushed, not that the first I did not apply since there already a check
if attributes are within the valid range before calling that function,
also change some parameter and code placement to be more consistent
and don't use VLA for buffers.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 1/4] android/avrcp: Fix response for RegisterNotification
From: Luiz Augusto von Dentz @ 2014-03-05 8:42 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1393965804-13866-1-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
On Tue, Mar 4, 2014 at 10:43 PM, Andrzej Kaczmarek
<andrzej.kaczmarek@tieto.com> wrote:
> ---
> android/avrcp.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/android/avrcp.c b/android/avrcp.c
> index 8eac4cd..f3427a3 100644
> --- a/android/avrcp.c
> +++ b/android/avrcp.c
> @@ -255,6 +255,7 @@ static void handle_register_notification(const void *buf, uint16_t len)
> struct avrcp_request *req;
> uint8_t pdu[IPC_MTU];
> size_t pdu_len;
> + uint8_t code;
> int ret;
>
> DBG("");
> @@ -280,8 +281,20 @@ static void handle_register_notification(const void *buf, uint16_t len)
> goto done;
> }
>
> + switch (cmd->type) {
> + case HAL_AVRCP_EVENT_TYPE_INTERIM:
> + code = AVC_CTYPE_INTERIM;
> + break;
> + case HAL_AVRCP_EVENT_TYPE_CHANGED:
> + code = AVC_CTYPE_CHANGED;
> + break;
> + default:
> + status = HAL_STATUS_FAILED;
> + goto done;
> + }
> +
> ret = avrcp_register_notification_rsp(req->dev->session,
> - req->transaction, cmd->type,
> + req->transaction, code,
> pdu, pdu_len);
> if (ret < 0) {
> status = HAL_STATUS_FAILED;
> --
> 1.9.0
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH 1/5] android/hal-gatt-api: Simplify GATT Test cmd struct
From: Jakub Tyszkowski @ 2014-03-05 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
Make nested struct open coded for simplicity.
---
android/hal-ipc-api.txt | 15 +++++++--------
android/hal-msg.h | 8 ++------
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 6bf9af3..6fa0d3b 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1657,14 +1657,13 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
Opcode 0x16 - Test Command command/response
Command parameters: Command (4 octets)
- Test Parameters (32 octets)
- Valid Test Parameter: Address (6 octets)
- UUID (16 octets)
- U1 (2 octets)
- U2 (2 octets)
- U3 (2 octets)
- U4 (2 octets)
- U5 (2 octets)
+ Address (6 octets)
+ UUID (16 octets)
+ U1 (2 octets)
+ U2 (2 octets)
+ U3 (2 octets)
+ U4 (2 octets)
+ U5 (2 octets)
Response parameters: <none>
In case of an error, the error response will be returned.
diff --git a/android/hal-msg.h b/android/hal-msg.h
index dd25f6e..c3b1bc3 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -680,7 +680,8 @@ struct hal_cmd_gatt_client_set_adv_data {
} __attribute__((packed));
#define HAL_OP_GATT_CLIENT_TEST_COMMAND 0x16
-struct hal_gatt_test_params {
+struct hal_cmd_gatt_client_test_command {
+ int32_t command;
uint8_t bda1[6];
uint8_t uuid1[16];
uint16_t u1;
@@ -690,11 +691,6 @@ struct hal_gatt_test_params {
uint16_t u5;
} __attribute__((packed));
-struct hal_cmd_gatt_client_test_command {
- int32_t command;
- struct hal_gatt_test_params params;
-} __attribute__((packed));
-
#define HAL_OP_GATT_SERVER_REGISTER 0x17
struct hal_cmd_gatt_server_register {
uint8_t uuid[16];
--
1.9.0
^ permalink raw reply related
* [PATCH 2/5] android/hal-gatt-api: Simplify GATT Notify ev struct
From: Jakub Tyszkowski @ 2014-03-05 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
In-Reply-To: <1394009990-5795-1-git-send-email-jakub.tyszkowski@tieto.com>
Make nested struct open coded for simplicity.
---
android/hal-ipc-api.txt | 3 +--
android/hal-msg.h | 8 ++------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 6fa0d3b..e88a85d 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1885,8 +1885,7 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
Opcode 0x8b - Notify notification
Notification parameters: Connection ID (4 octets)
- Notify Parameters (variable)
- Valid Notify Parameters: Address (6 octets)
+ Address (6 octets)
GATT Service ID (18 octets)
GATT Char. ID (17 octets)
Is Notify (1 octet)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index c3b1bc3..5511297 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1305,7 +1305,8 @@ struct hal_ev_gatt_client_reg_for_notif {
} __attribute__((packed));
#define HAL_EV_GATT_CLIENT_NOTIFY 0x8b
-struct hal_gatt_notify_params {
+struct hal_ev_gatt_client_notify {
+ int32_t conn_id;
uint8_t bda[6];
struct hal_gatt_srvc_id srvc_id;
struct hal_gatt_gatt_id char_id;
@@ -1314,11 +1315,6 @@ struct hal_gatt_notify_params {
uint8_t value[0];
} __attribute__((packed));
-struct hal_ev_gatt_client_notify {
- int32_t conn_id;
- struct hal_gatt_notify_params data;
-} __attribute__((packed));
-
#define HAL_EV_GATT_CLIENT_READ_CHARACTERISTIC 0x8c
struct hal_gatt_unformated_value {
uint16_t len;
--
1.9.0
^ permalink raw reply related
* [PATCH 3/5] android/hal-gatt-api: Simplify GATT Read Char. event
From: Jakub Tyszkowski @ 2014-03-05 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
In-Reply-To: <1394009990-5795-1-git-send-email-jakub.tyszkowski@tieto.com>
Make nested struct open coded for simplicity.
---
android/hal-ipc-api.txt | 5 ++---
android/hal-msg.h | 8 ++------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index e88a85d..8d512dd 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1904,11 +1904,10 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
GATT Descr. ID (17 octets)
Value Type (4 octets)
Status (1 octet)
- Unformatted Value (variable)
+ Length (2 octets)
+ Value (variable)
Valid GATT Service ID: As described in Get Characteristic
Valid GATT Char. & Decr. ID: As described in Get Descriptor
- Valid Unformatted Value: Length (2 octets)
- Value (variable)
Opcode 0x8d - Write Characteristic notification
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5511297..546172b 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1316,18 +1316,14 @@ struct hal_ev_gatt_client_notify {
} __attribute__((packed));
#define HAL_EV_GATT_CLIENT_READ_CHARACTERISTIC 0x8c
-struct hal_gatt_unformated_value {
- uint16_t len;
- uint8_t value[0];
-} __attribute__((packed));
-
struct hal_gatt_read_params {
struct hal_gatt_srvc_id srvc_id;
struct hal_gatt_gatt_id char_id;
struct hal_gatt_gatt_id descr_id;
uint8_t status;
uint16_t value_type;
- struct hal_gatt_unformated_value value;
+ uint16_t len;
+ uint8_t value[0];
} __attribute__((packed));
struct hal_ev_gatt_client_read_characteristic {
--
1.9.0
^ permalink raw reply related
* [PATCH 4/5] android/hal-gatt-api: Simplify GATT Service ID struct
From: Jakub Tyszkowski @ 2014-03-05 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
In-Reply-To: <1394009990-5795-1-git-send-email-jakub.tyszkowski@tieto.com>
Make nested struct open coded for simplicity.
---
android/hal-ipc-api.txt | 19 +++++++++----------
android/hal-msg.h | 11 ++++++-----
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 8d512dd..43b79ec 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1500,7 +1500,8 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
Service ID Elements (variable)
Valid Number of Service ID Elements: 0x01
0x02
- Valid Service ID Element: GATT ID (17 octets)
+ Valid Service ID Element: UUID (16 octets)
+ Instance ID (1 octet)
Is Primary (1 octet)
Valid GATT ID: UUID (16 octets)
Instance ID (1 octet)
@@ -1706,7 +1707,8 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
GATT Service ID (18 octets)
Number of Handles (4 octet)
- Valid GATT Service ID: GATT ID (17 octets)
+ Valid GATT Service ID: UUID (16 octets)
+ Instance ID (1 octets)
Is Primary (1 octet)
Valid GATT ID: UUID (16 octets)
@@ -1837,10 +1839,9 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
Notification parameters: Connection ID (4 octets)
GATT Service ID (18 octets)
- Valid GATT Service ID: GATT ID (17 octets)
+ Valid GATT Service ID: UUID (16 octets)
+ Instance ID (1 octets)
Is Primary (1 octet)
- Valid GATT ID: UUID (16 octets)
- Instance ID (1 octet)
Opcode 0x87 - Get Characteristic notification
@@ -1969,15 +1970,13 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
Notification parameters: Status (4 octets)
Server (4 octets)
- Service ID (18 octets)
+ GATT Service ID (18 octets)
Service Handle (4 octets)
- Valid Service ID: ID (17 octets)
+ Valid Service ID: UUID (16 octets)
+ Instance ID (1 octet)
Is Primary (1 octet)
- Valid ID: UUID (16 octets)
- Instance ID (1 octet)
-
Opcode 0x96 - Included Service Added notification
Notification patemeters: Status (4 octets)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 546172b..677f450 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -561,13 +561,9 @@ struct hal_cmd_gatt_client_search_service {
} __attribute__((packed));
#define HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE 0x09
-struct hal_gatt_gatt_id {
+struct hal_gatt_srvc_id {
uint8_t uuid[16];
uint8_t inst_id;
-} __attribute__((packed));
-
-struct hal_gatt_srvc_id {
- struct hal_gatt_gatt_id gatt_id;
uint8_t is_primary;
} __attribute__((packed));
@@ -578,6 +574,11 @@ struct hal_cmd_gatt_client_get_included_service {
} __attribute__((packed));
#define HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC 0x0a
+struct hal_gatt_gatt_id {
+ uint8_t uuid[16];
+ uint8_t inst_id;
+} __attribute__((packed));
+
struct hal_cmd_gatt_client_get_characteristic {
int32_t conn_id;
struct hal_gatt_srvc_id srvc_id;
--
1.9.0
^ permalink raw reply related
* [PATCH 5/5] android/hal-gatt-api: Use proper type for length
From: Jakub Tyszkowski @ 2014-03-05 8:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
In-Reply-To: <1394009990-5795-1-git-send-email-jakub.tyszkowski@tieto.com>
Length can be up to 600 thus 16bit value should be used.
---
android/hal-msg.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 677f450..8ac26ab 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -781,7 +781,7 @@ struct hal_cmd_gatt_server_send_response {
int32_t conn_id;
int32_t trans_id;
int32_t status;
- uint8_t len;
+ uint16_t len;
uint8_t data[0];
} __attribute__((packed));
--
1.9.0
^ permalink raw reply related
* [PATCH v2 1/5] monitor: Allow to modify epoll even events are the same
From: Lukasz Rymanowski @ 2014-03-05 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
This is epsecially needed when we want to modify timer.
---
monitor/mainloop.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/monitor/mainloop.c b/monitor/mainloop.c
index 8c94bfe..7f97e65 100644
--- a/monitor/mainloop.c
+++ b/monitor/mainloop.c
@@ -222,9 +222,6 @@ int mainloop_modify_fd(int fd, uint32_t events)
if (!data)
return -ENXIO;
- if (data->events == events)
- return 0;
-
memset(&ev, 0, sizeof(ev));
ev.events = events;
ev.data.ptr = data;
--
1.8.4
^ permalink raw reply related
* [PATCH v2 2/5] monitor: Use miliseconds instead of seconds in the timeout
From: Lukasz Rymanowski @ 2014-03-05 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394011361-9469-1-git-send-email-lukasz.rymanowski@tieto.com>
---
monitor/mainloop.c | 19 ++++++++++---------
monitor/mainloop.h | 4 ++--
tools/3dsp.c | 2 +-
tools/btinfo.c | 2 +-
tools/ibeacon.c | 2 +-
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/monitor/mainloop.c b/monitor/mainloop.c
index 7f97e65..8d4b391 100644
--- a/monitor/mainloop.c
+++ b/monitor/mainloop.c
@@ -287,20 +287,21 @@ static void timeout_callback(int fd, uint32_t events, void *user_data)
data->callback(data->fd, data->user_data);
}
-static inline int timeout_set(int fd, unsigned int seconds)
+static inline int timeout_set(int fd, unsigned int msec)
{
struct itimerspec itimer;
+ unsigned int sec = msec / 1000;
memset(&itimer, 0, sizeof(itimer));
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_nsec = 0;
- itimer.it_value.tv_sec = seconds;
- itimer.it_value.tv_nsec = 0;
+ itimer.it_value.tv_sec = sec;
+ itimer.it_value.tv_nsec = (msec - (sec * 1000)) * 1000;
return timerfd_settime(fd, 0, &itimer, NULL);
}
-int mainloop_add_timeout(unsigned int seconds, mainloop_timeout_func callback,
+int mainloop_add_timeout(unsigned int msec, mainloop_timeout_func callback,
void *user_data, mainloop_destroy_func destroy)
{
struct timeout_data *data;
@@ -323,8 +324,8 @@ int mainloop_add_timeout(unsigned int seconds, mainloop_timeout_func callback,
return -EIO;
}
- if (seconds > 0) {
- if (timeout_set(data->fd, seconds) < 0) {
+ if (msec > 0) {
+ if (timeout_set(data->fd, msec) < 0) {
close(data->fd);
free(data);
return -EIO;
@@ -341,10 +342,10 @@ int mainloop_add_timeout(unsigned int seconds, mainloop_timeout_func callback,
return data->fd;
}
-int mainloop_modify_timeout(int id, unsigned int seconds)
+int mainloop_modify_timeout(int id, unsigned int msec)
{
- if (seconds > 0) {
- if (timeout_set(id, seconds) < 0)
+ if (msec > 0) {
+ if (timeout_set(id, msec) < 0)
return -EIO;
}
diff --git a/monitor/mainloop.h b/monitor/mainloop.h
index d36f5aa..dafec8b 100644
--- a/monitor/mainloop.h
+++ b/monitor/mainloop.h
@@ -40,9 +40,9 @@ int mainloop_add_fd(int fd, uint32_t events, mainloop_event_func callback,
int mainloop_modify_fd(int fd, uint32_t events);
int mainloop_remove_fd(int fd);
-int mainloop_add_timeout(unsigned int seconds, mainloop_timeout_func callback,
+int mainloop_add_timeout(unsigned int msec, mainloop_timeout_func callback,
void *user_data, mainloop_destroy_func destroy);
-int mainloop_modify_timeout(int fd, unsigned int seconds);
+int mainloop_modify_timeout(int fd, unsigned int msec);
int mainloop_remove_timeout(int id);
int mainloop_set_signal(sigset_t *mask, mainloop_signal_func callback,
diff --git a/tools/3dsp.c b/tools/3dsp.c
index d1b17f2..fc5c8e6 100644
--- a/tools/3dsp.c
+++ b/tools/3dsp.c
@@ -66,7 +66,7 @@ static void shutdown_device(void)
bt_hci_flush(hci_dev);
if (reset_on_shutdown) {
- id = mainloop_add_timeout(5, shutdown_timeout, NULL, NULL);
+ id = mainloop_add_timeout(5000, shutdown_timeout, NULL, NULL);
bt_hci_send(hci_dev, BT_HCI_CMD_RESET, NULL, 0,
shutdown_complete, UINT_TO_PTR(id), NULL);
diff --git a/tools/btinfo.c b/tools/btinfo.c
index 7951808..6693132 100644
--- a/tools/btinfo.c
+++ b/tools/btinfo.c
@@ -109,7 +109,7 @@ static void shutdown_device(void)
bt_hci_flush(hci_dev);
if (reset_on_shutdown) {
- id = mainloop_add_timeout(5, shutdown_timeout, NULL, NULL);
+ id = mainloop_add_timeout(5000, shutdown_timeout, NULL, NULL);
bt_hci_send(hci_dev, BT_HCI_CMD_RESET, NULL, 0,
shutdown_complete, UINT_TO_PTR(id), NULL);
diff --git a/tools/ibeacon.c b/tools/ibeacon.c
index 2071c6b..093fba1 100644
--- a/tools/ibeacon.c
+++ b/tools/ibeacon.c
@@ -65,7 +65,7 @@ static void shutdown_device(void)
bt_hci_flush(hci_dev);
- id = mainloop_add_timeout(5, shutdown_timeout, NULL, NULL);
+ id = mainloop_add_timeout(5000, shutdown_timeout, NULL, NULL);
bt_hci_send(hci_dev, BT_HCI_CMD_LE_SET_ADV_ENABLE,
&enable, 1, NULL, NULL, NULL);
--
1.8.4
^ permalink raw reply related
* [PATCH v2 3/5] shared: Add header for timeout abstraction
From: Lukasz Rymanowski @ 2014-03-05 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394011361-9469-1-git-send-email-lukasz.rymanowski@tieto.com>
---
src/shared/timeout.h | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 src/shared/timeout.h
diff --git a/src/shared/timeout.h b/src/shared/timeout.h
new file mode 100644
index 0000000..c13616f
--- /dev/null
+++ b/src/shared/timeout.h
@@ -0,0 +1,27 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#include <stdbool.h>
+
+typedef bool (*timeout_func_t)(void *user_data);
+typedef void (*timeout_destroy_func_t)(void *user_data);
+
+int timeout_add(unsigned int msec, timeout_func_t func, void *user_data,
+ timeout_destroy_func_t destroy);
+void timeout_remove(unsigned int id);
--
1.8.4
^ permalink raw reply related
* [PATCH v2 4/5] shared: Add timeout handling with Glib support
From: Lukasz Rymanowski @ 2014-03-05 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394011361-9469-1-git-send-email-lukasz.rymanowski@tieto.com>
---
src/shared/timeout-glib.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 src/shared/timeout-glib.c
diff --git a/src/shared/timeout-glib.c b/src/shared/timeout-glib.c
new file mode 100644
index 0000000..c045efc
--- /dev/null
+++ b/src/shared/timeout-glib.c
@@ -0,0 +1,73 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#include "timeout.h"
+
+#include <glib.h>
+
+struct timeout_data {
+ timeout_func_t func;
+ timeout_destroy_func_t destroy;
+ void *user_data;
+};
+
+static gboolean timeout_callback(gpointer user_data)
+{
+ struct timeout_data *data = user_data;
+
+ if (data->func(data->user_data))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void timeout_destroy(gpointer user_data)
+{
+ struct timeout_data *data = user_data;
+
+ if (data->destroy)
+ data->destroy(data->user_data);
+
+ g_free(data);
+}
+
+int timeout_add(unsigned int ms, timeout_func_t func, void *user_data,
+ timeout_destroy_func_t destroy)
+{
+ guint id;
+ struct timeout_data *data = g_malloc0(sizeof(*data));
+
+ data->func = func;
+ data->destroy = destroy;
+ data->user_data = user_data;
+
+ id = g_timeout_add_full(G_PRIORITY_DEFAULT, ms, timeout_callback, data,
+ timeout_destroy);
+ if (!id)
+ g_free(data);
+
+ return id;
+}
+
+void timeout_remove(unsigned int id)
+{
+ GSource *source = g_main_context_find_source_by_id(NULL, id);
+ if (source)
+ g_source_destroy(source);
+}
--
1.8.4
^ permalink raw reply related
* [PATCH v2 5/5] shared: Add timeout handling with mainloop support
From: Lukasz Rymanowski @ 2014-03-05 9:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394011361-9469-1-git-send-email-lukasz.rymanowski@tieto.com>
---
src/shared/timeout-mainloop.c | 78 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 src/shared/timeout-mainloop.c
diff --git a/src/shared/timeout-mainloop.c b/src/shared/timeout-mainloop.c
new file mode 100644
index 0000000..bdc527a
--- /dev/null
+++ b/src/shared/timeout-mainloop.c
@@ -0,0 +1,78 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+
+#include "timeout.h"
+
+#include "monitor/mainloop.h"
+
+struct timeout_data {
+ int id;
+ timeout_func_t func;
+ timeout_destroy_func_t destroy;
+ unsigned int timeout;
+ void *user_data;
+};
+
+static void timeout_callback(int id, void *user_data)
+{
+ struct timeout_data *data = user_data;
+
+ if (data->func(data->user_data) &&
+ !mainloop_modify_timeout(data->id, data->timeout))
+ return;
+
+ mainloop_remove_timeout(data->id);
+}
+
+static void timeout_destroy(void *user_data)
+{
+ struct timeout_data *data = user_data;
+
+ if (data->destroy)
+ data->destroy(data->user_data);
+
+ free(data);
+}
+
+int timeout_add(unsigned int t, timeout_func_t func, void *user_data,
+ timeout_destroy_func_t destroy)
+{
+ struct timeout_data *data = malloc(sizeof(*data));
+
+ data->func = func;
+ data->user_data = user_data;
+ data->timeout = t;
+
+ data->id = mainloop_add_timeout(t, timeout_callback, data,
+ timeout_destroy);
+ if (!data->id) {
+ free(data);
+ return 0;
+ }
+
+ return data->id;
+}
+
+void timeout_remove(unsigned int id)
+{
+ if (id)
+ mainloop_remove_timeout(id);
+}
--
1.8.4
^ permalink raw reply related
* [PATCH] Revert "Bluetooth: Use devname:vhci module alias for virtual HCI driver"
From: Thomas Bächler @ 2014-03-05 11:59 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Gustavo Padovan, Johan Hedberg, linux-bluetooth, linux-kernel,
Thomas Bächler
Adding the devname:vhci alias and thus adding a static /dev/vhci device node
only works when assigning a fixed major/minor number. However, the code
currently uses a dynamically assigned minor number. It is therefore impossible
to create a static device and to autoload the module when accessing it.
Reverting this fixes the kmod error message
depmod: ERROR: Module 'hci_vhci' has devname (vhci) but lacks major and minor information. Ignoring.
This reverts commit bfacbb9aec029b3200053d84c8cd5d7575f2d4a5.
---
drivers/bluetooth/hci_vhci.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 1ef6990..cf05d70 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -384,4 +384,3 @@ MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
-MODULE_ALIAS("devname:vhci");
--
1.9.0
^ permalink raw reply related
* Re: [PATCH] tools/sco-tester: Remove not used function argument
From: Johan Hedberg @ 2014-03-05 12:03 UTC (permalink / raw)
To: Marcin Kraglak; +Cc: linux-bluetooth
In-Reply-To: <1394003747-23412-1-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Wed, Mar 05, 2014, Marcin Kraglak wrote:
> ---
> tools/sco-tester.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* [RFC 0/2] android: Enable debugs bluetoothd
From: Lukasz Rymanowski @ 2014-03-05 12:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
For user variant build of Android we should not print too much logs.
Therefore we should have possibility to turn on/off logs.
First patch adds simple on/off mechanism using android properties and
bluetoothd-wrapper.
Bluetoothd-wrapper is used because:
1. we can read android properties there
2. We can get early logs from daemon startup
3. bluetoothd-wrapper is not used in user variant build so debug logs
should be off on that variant by default.
Second patch gives us possibility to enable verbose logs and for now it
is mgmt interface logs which also might be useful in some cases.
For now, when verbose debugs are ON then also debug is ON.
Lukasz Rymanowski (2):
android: Add possible to enable BlueZ debug logs
android: Add verbose debugs to BlueZ
android/README | 16 ++++++++++++++++
android/bluetooth.c | 11 ++++++++++-
android/bluetooth.h | 2 +-
android/bluetoothd-wrapper.c | 27 ++++++++++++++++++++++-----
android/main.c | 14 ++++++++++++--
5 files changed, 61 insertions(+), 9 deletions(-)
--
1.8.4
^ permalink raw reply
* [RFC 1/2] android: Add possible to enable BlueZ debug logs
From: Lukasz Rymanowski @ 2014-03-05 12:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394024166-14102-1-git-send-email-lukasz.rymanowski@tieto.com>
With this patch it is possible to enable BlueZ logs which. In order
to enable it is required to set property:
persist.sys.bluetooth.debug to 1 or literaly "true".
More info in README
---
android/README | 11 +++++++++++
android/bluetoothd-wrapper.c | 17 ++++++++++++-----
android/main.c | 8 +++++++-
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/android/README b/android/README
index 3095383..b7ecf5f 100644
--- a/android/README
+++ b/android/README
@@ -130,6 +130,17 @@ will break at e.g. g_free() function without prior callers. It's possible to
have proper library installed automatically by appropriate entry in Android.mk,
see https://code.google.com/p/aosp-bluez.glib/ for an example.
+Enabling BlueZ debugs
+==============================
+
+BlueZ debug logs can be enabled in runtime by setting "persist.sys.bluetooth.debug"
+property to either literal "true" or any numeric value >0. For example:
+adb root
+adb shell setprop persist.sys.bluetooth.debug 1
+
+After changing property value Bluetooth needs to be restarted to apply changes.
+
+Note: Debugs are only available on NON USER build variants
=============================
Building and running on Linux
=============================
diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 122e6b0..2c7d087 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
@@ -24,6 +24,8 @@
#define PROPERTY_NAME "persist.sys.bluetooth.valgrind"
+#define PROPERTY_DEBUG_NAME "persist.sys.bluetooth.debug"
+
#define VALGRIND_BIN "/system/bin/valgrind"
#define BLUETOOTHD_BIN "/system/bin/bluetoothd-main"
@@ -45,13 +47,14 @@ static void run_valgrind(void)
execve(prg_argv[0], prg_argv, prg_envp);
}
-static void run_bluetoothd(void)
+static void run_bluetoothd(int debug)
{
- char *prg_argv[2];
+ char *prg_argv[3];
char *prg_envp[1];
prg_argv[0] = BLUETOOTHD_BIN;
- prg_argv[1] = NULL;
+ prg_argv[1] = debug ? "-d" : NULL;
+ prg_argv[2] = NULL;
prg_envp[0] = NULL;
@@ -61,16 +64,20 @@ static void run_bluetoothd(void)
int main(int argc, char *argv[])
{
char value[PROPERTY_VALUE_MAX];
+ int debug = 0;
if (property_get(PROPERTY_NAME, value, "") > 0 &&
(!strcasecmp(value, "true") || atoi(value) > 0))
run_valgrind();
+ if (property_get(PROPERTY_DEBUG_NAME, value, "") > 0 &&
+ (!strcasecmp(value, "true") || atoi(value) > 0))
+ debug = 1;
+
/* In case we failed to execute Valgrind, try to run bluetoothd
* without it
*/
-
- run_bluetoothd();
+ run_bluetoothd(debug);
return 0;
}
diff --git a/android/main.c b/android/main.c
index 42bc982..edec7dc 100644
--- a/android/main.c
+++ b/android/main.c
@@ -344,12 +344,15 @@ static guint setup_signalfd(void)
static gboolean option_version = FALSE;
static gint option_index = -1;
+static gboolean option_dbg = FALSE;
static GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
"Show version information and exit", NULL },
{ "index", 'i', 0, G_OPTION_ARG_INT, &option_index,
"Use specified controller", "INDEX"},
+ { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_dbg,
+ "Enable debug logs", NULL},
{ NULL }
};
@@ -473,7 +476,10 @@ int main(int argc, char *argv[])
if (!signal)
return EXIT_FAILURE;
- __btd_log_init("*", 0);
+ if (option_dbg)
+ __btd_log_init("*", 0);
+ else
+ __btd_log_init(NULL, 0);
if (!set_capabilities()) {
__btd_log_cleanup();
--
1.8.4
^ permalink raw reply related
* [RFC 2/2] android: Add verbose debugs to BlueZ
From: Lukasz Rymanowski @ 2014-03-05 12:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1394024166-14102-1-git-send-email-lukasz.rymanowski@tieto.com>
It is usefull in some cases to enable more logs for BlueZ debugging.
This patch introduce possibility to enable verbose debugs.
For now it will enable mgmt interface debug logs
More info in README
---
android/README | 5 +++++
android/bluetooth.c | 11 ++++++++++-
android/bluetooth.h | 2 +-
android/bluetoothd-wrapper.c | 18 ++++++++++++++----
android/main.c | 8 ++++++--
5 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/android/README b/android/README
index b7ecf5f..cf114a4 100644
--- a/android/README
+++ b/android/README
@@ -140,6 +140,11 @@ adb shell setprop persist.sys.bluetooth.debug 1
After changing property value Bluetooth needs to be restarted to apply changes.
+There is also a possibility to enable verbose debug (e.g mgmt interface logs)
+which also enables debugs as above.
+To enable it procced in the same way as described above but use system
+properties called: persist.sys.bluetooth.vdebug
+
Note: Debugs are only available on NON USER build variants
=============================
Building and running on Linux
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 6d94904..cfced4f 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -148,6 +148,12 @@ static GSList *browse_reqs;
static struct ipc *hal_ipc = NULL;
+static void mgmt_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+ info("%s%s", prefix, str);
+}
+
static void store_adapter_config(void)
{
GKeyFile *key_file;
@@ -2154,7 +2160,7 @@ failed:
cb(-EIO, NULL);
}
-bool bt_bluetooth_start(int index, bt_bluetooth_ready cb)
+bool bt_bluetooth_start(int index, bool vdebug, bt_bluetooth_ready cb)
{
DBG("index %d", index);
@@ -2164,6 +2170,9 @@ bool bt_bluetooth_start(int index, bt_bluetooth_ready cb)
return false;
}
+ if (vdebug)
+ mgmt_set_debug(mgmt_if, mgmt_debug, "mgmt_if: ", NULL);
+
if (mgmt_send(mgmt_if, MGMT_OP_READ_VERSION, MGMT_INDEX_NONE, 0, NULL,
read_version_complete, cb, NULL) == 0) {
error("Error sending READ_VERSION mgmt command");
diff --git a/android/bluetooth.h b/android/bluetooth.h
index 4731e2b..fe3b2b5 100644
--- a/android/bluetooth.h
+++ b/android/bluetooth.h
@@ -22,7 +22,7 @@
*/
typedef void (*bt_bluetooth_ready)(int err, const bdaddr_t *addr);
-bool bt_bluetooth_start(int index, bt_bluetooth_ready cb);
+bool bt_bluetooth_start(int index, bool vdebug, bt_bluetooth_ready cb);
typedef void (*bt_bluetooth_stopped)(void);
bool bt_bluetooth_stop(bt_bluetooth_stopped cb);
diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 2c7d087..59a1e91 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
@@ -26,6 +26,8 @@
#define PROPERTY_DEBUG_NAME "persist.sys.bluetooth.debug"
+#define PROPERTY_VERBOSE_DEBUG_NAME "persist.sys.bluetooth.vdebug"
+
#define VALGRIND_BIN "/system/bin/valgrind"
#define BLUETOOTHD_BIN "/system/bin/bluetoothd-main"
@@ -47,14 +49,15 @@ static void run_valgrind(void)
execve(prg_argv[0], prg_argv, prg_envp);
}
-static void run_bluetoothd(int debug)
+static void run_bluetoothd(int debug, int vdebug)
{
- char *prg_argv[3];
+ char *prg_argv[4];
char *prg_envp[1];
prg_argv[0] = BLUETOOTHD_BIN;
prg_argv[1] = debug ? "-d" : NULL;
- prg_argv[2] = NULL;
+ prg_argv[2] = vdebug ? "-D" : NULL;
+ prg_argv[3] = NULL;
prg_envp[0] = NULL;
@@ -65,6 +68,7 @@ int main(int argc, char *argv[])
{
char value[PROPERTY_VALUE_MAX];
int debug = 0;
+ int vdebug = 0;
if (property_get(PROPERTY_NAME, value, "") > 0 &&
(!strcasecmp(value, "true") || atoi(value) > 0))
@@ -74,10 +78,16 @@ int main(int argc, char *argv[])
(!strcasecmp(value, "true") || atoi(value) > 0))
debug = 1;
+ if (property_get(PROPERTY_VERBOSE_DEBUG_NAME, value, "") > 0 &&
+ (!strcasecmp(value, "true") || atoi(value) > 0)) {
+ debug = 1;
+ vdebug = 1;
+ }
+
/* In case we failed to execute Valgrind, try to run bluetoothd
* without it
*/
- run_bluetoothd(debug);
+ run_bluetoothd(debug, vdebug);
return 0;
}
diff --git a/android/main.c b/android/main.c
index edec7dc..777a1ea 100644
--- a/android/main.c
+++ b/android/main.c
@@ -345,6 +345,7 @@ static guint setup_signalfd(void)
static gboolean option_version = FALSE;
static gint option_index = -1;
static gboolean option_dbg = FALSE;
+static gboolean option_vdbg = FALSE;
static GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
@@ -353,6 +354,9 @@ static GOptionEntry options[] = {
"Use specified controller", "INDEX"},
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &option_dbg,
"Enable debug logs", NULL},
+ { "verbose debug", 'D', 0, G_OPTION_ARG_NONE, &option_vdbg,
+ "Enable verbose debug logs, e.g. mgmt", NULL},
+
{ NULL }
};
@@ -476,7 +480,7 @@ int main(int argc, char *argv[])
if (!signal)
return EXIT_FAILURE;
- if (option_dbg)
+ if (option_dbg || option_vdbg)
__btd_log_init("*", 0);
else
__btd_log_init(NULL, 0);
@@ -496,7 +500,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- if (!bt_bluetooth_start(option_index, adapter_ready)) {
+ if (!bt_bluetooth_start(option_index, option_vdbg, adapter_ready)) {
__btd_log_cleanup();
g_source_remove(bluetooth_start_timeout);
g_source_remove(signal);
--
1.8.4
^ permalink raw reply related
* [PATCH BlueZ 1/2] android/avrcp: Add remote features notification
From: Luiz Augusto von Dentz @ 2014-03-05 13:03 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/avrcp.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/android/avrcp.c b/android/avrcp.c
index cb46dcc..8795951 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -43,6 +43,7 @@
#include "ipc.h"
#include "bluetooth.h"
#include "avrcp.h"
+#include "utils.h"
#define L2CAP_PSM_AVCTP 0x17
@@ -699,6 +700,7 @@ static const struct avrcp_control_handler control_handlers[] = {
static int avrcp_device_add_session(struct avrcp_device *dev, int fd,
uint16_t imtu, uint16_t omtu)
{
+ struct hal_ev_avrcp_remote_features ev;
char address[18];
dev->session = avrcp_new(fd, imtu, omtu, dev->version);
@@ -717,6 +719,18 @@ static int avrcp_device_add_session(struct avrcp_device *dev, int fd,
/* FIXME: get the real name of the device */
avrcp_init_uinput(dev->session, "bluetooth", address);
+ bdaddr2android(&dev->dst, ev.bdaddr);
+
+ if (dev->version < 0x0103)
+ goto done;
+
+ ev.features = HAL_AVRCP_FEATURE_METADATA;
+
+done:
+ ipc_send_notif(hal_ipc, HAL_SERVICE_ID_AVRCP,
+ HAL_EV_AVRCP_REMOTE_FEATURES,
+ sizeof(ev), &ev);
+
return 0;
}
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 2/2] android/client: Add AVRCP remote_features_cb support
From: Luiz Augusto von Dentz @ 2014-03-05 13:03 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1394024636-20620-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/client/if-rc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/android/client/if-rc.c b/android/client/if-rc.c
index 55fdf1d..cd4c142 100644
--- a/android/client/if-rc.c
+++ b/android/client/if-rc.c
@@ -46,6 +46,15 @@ SINTMAP(btrc_media_attr_t, -1, "(unknown)")
DELEMENT(BTRC_MEDIA_ATTR_PLAYING_TIME),
ENDMAP
+static char last_addr[MAX_ADDR_STR_LEN];
+
+static void remote_features_cb(bt_bdaddr_t *bd_addr,
+ btrc_remote_features_t features)
+{
+ haltest_info("%s: remote_bd_addr=%S features=%u\n", __func__,
+ bt_bdaddr_t2str(bd_addr, last_addr), features);
+}
+
static void get_play_status_cb(void)
{
haltest_info("%s\n", __func__);
@@ -73,6 +82,7 @@ static void volume_change_cb(uint8_t volume, uint8_t ctype)
static btrc_callbacks_t rc_cbacks = {
.size = sizeof(rc_cbacks),
+ .remote_features_cb = remote_features_cb,
.get_play_status_cb = get_play_status_cb,
.get_element_attr_cb = get_element_attr_cb,
.register_notification_cb = register_notification_cb,
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCH v2 1/5] monitor: Allow to modify epoll even events are the same
From: Szymon Janc @ 2014-03-05 13:24 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth
In-Reply-To: <1394011361-9469-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Łukasz,
On Wednesday 05 of March 2014 10:22:37 Lukasz Rymanowski wrote:
> This is epsecially needed when we want to modify timer.
> ---
> monitor/mainloop.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/monitor/mainloop.c b/monitor/mainloop.c
> index 8c94bfe..7f97e65 100644
> --- a/monitor/mainloop.c
> +++ b/monitor/mainloop.c
> @@ -222,9 +222,6 @@ int mainloop_modify_fd(int fd, uint32_t events)
> if (!data)
> return -ENXIO;
>
> - if (data->events == events)
> - return 0;
> -
> memset(&ev, 0, sizeof(ev));
> ev.events = events;
> ev.data.ptr = data;
>
All patches applied. Thanks.
--
Best regards,
Szymon Janc
^ permalink raw reply
* Re: [PATCH 1/5] android/hal-gatt-api: Simplify GATT Test cmd struct
From: Szymon Janc @ 2014-03-05 13:24 UTC (permalink / raw)
To: Jakub Tyszkowski; +Cc: linux-bluetooth
In-Reply-To: <1394009990-5795-1-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Wednesday 05 of March 2014 09:59:46 Jakub Tyszkowski wrote:
> Make nested struct open coded for simplicity.
> ---
> android/hal-ipc-api.txt | 15 +++++++--------
> android/hal-msg.h | 8 ++------
> 2 files changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index 6bf9af3..6fa0d3b 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -1657,14 +1657,13 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
> Opcode 0x16 - Test Command command/response
>
> Command parameters: Command (4 octets)
> - Test Parameters (32 octets)
> - Valid Test Parameter: Address (6 octets)
> - UUID (16 octets)
> - U1 (2 octets)
> - U2 (2 octets)
> - U3 (2 octets)
> - U4 (2 octets)
> - U5 (2 octets)
> + Address (6 octets)
> + UUID (16 octets)
> + U1 (2 octets)
> + U2 (2 octets)
> + U3 (2 octets)
> + U4 (2 octets)
> + U5 (2 octets)
> Response parameters: <none>
>
> In case of an error, the error response will be returned.
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index dd25f6e..c3b1bc3 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -680,7 +680,8 @@ struct hal_cmd_gatt_client_set_adv_data {
> } __attribute__((packed));
>
> #define HAL_OP_GATT_CLIENT_TEST_COMMAND 0x16
> -struct hal_gatt_test_params {
> +struct hal_cmd_gatt_client_test_command {
> + int32_t command;
> uint8_t bda1[6];
> uint8_t uuid1[16];
> uint16_t u1;
> @@ -690,11 +691,6 @@ struct hal_gatt_test_params {
> uint16_t u5;
> } __attribute__((packed));
>
> -struct hal_cmd_gatt_client_test_command {
> - int32_t command;
> - struct hal_gatt_test_params params;
> -} __attribute__((packed));
> -
> #define HAL_OP_GATT_SERVER_REGISTER 0x17
> struct hal_cmd_gatt_server_register {
> uint8_t uuid[16];
>
All patches applied, thanks.
--
Best regards,
Szymon Janc
^ permalink raw reply
* [PATCH net-next 0/2] 6lowpan: header cleanup
From: Alexander Aring @ 2014-03-05 13:29 UTC (permalink / raw)
To: marcel
Cc: gustavo, johan.hedberg, davem, alex.bluesman.smirnov, dbaryshkov,
linux-bluetooth, netdev, Alexander Aring
Hi,
this patch series fix a missing include of 6LoWPAN header and move it
into the include/net directory. Since we did some code sharing with
bluetooth 6LoWPAN the header turns into a generic header for 6LoWPAN.
Instead to use a relative path in bluetooth 6LoWPAN we can now use
include <net/6lowpan.h>.
- Alex
Alexander Aring (2):
6lowpan: add missing include of net/ipv6.h
6lowpan: move 6lowpan header to include/net
{net/ieee802154 => include/net}/6lowpan.h | 2 ++
net/bluetooth/6lowpan.c | 2 +-
net/ieee802154/6lowpan_iphc.c | 3 +--
net/ieee802154/6lowpan_rtnl.c | 2 +-
net/ieee802154/reassembly.c | 2 +-
5 files changed, 6 insertions(+), 5 deletions(-)
rename {net/ieee802154 => include/net}/6lowpan.h (99%)
--
1.9.0
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox