* [PATCH 1/3] android/client: Add properly print prefix for hex values
@ 2014-06-05 11:08 Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 2/3] android/client: Add additional support for handling " Grzegorz Kolodziejczyk
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-06-05 11:08 UTC (permalink / raw)
To: linux-bluetooth
This patch fix print hex values by adding "0x" prefix.
---
android/client/if-gatt.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 0375126..f6e6327 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -454,7 +454,7 @@ static void gattc_get_characteristic_cb(int conn_id, int status,
char srvc_id_buf[MAX_SRVC_ID_STR_LEN];
char char_id_buf[MAX_CHAR_ID_STR_LEN];
- haltest_info("%s: conn_id=%d status=%d srvc_id=%s char_id=%s, char_prop=%x\n",
+ haltest_info("%s: conn_id=%d status=%d srvc_id=%s char_id=%s, char_prop=0x%x\n",
__func__, conn_id, status,
btgatt_srvc_id_t2str(srvc_id, srvc_id_buf),
btgatt_gatt_id_t2str(char_id, char_id_buf), char_prop);
@@ -644,7 +644,7 @@ static void gatts_service_added_cb(int status, int server_if,
snprintf(server_if_str, sizeof(server_if_str), "%d", server_if);
- haltest_info("%s: status=%d server_if=%d srvc_id=%s handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d srvc_id=%s handle=0x%x\n",
__func__, status, server_if,
btgatt_srvc_id_t2str(srvc_id, buf), srvc_handle);
}
@@ -654,7 +654,7 @@ static void gatts_included_service_added_cb(int status, int server_if,
int srvc_handle,
int incl_srvc_handle)
{
- haltest_info("%s: status=%d server_if=%d srvc_handle=%x inc_srvc_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x inc_srvc_handle=0x%x\n",
__func__, status, server_if,
srvc_handle, incl_srvc_handle);
}
@@ -667,7 +667,7 @@ static void gatts_characteristic_added_cb(int status, int server_if,
{
char buf[MAX_SRVC_ID_STR_LEN];
- haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=%x char_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=0x%x char_handle=0x%x\n",
__func__, status, server_if, gatt_uuid_t2str(uuid, buf),
srvc_handle, char_handle);
}
@@ -679,7 +679,7 @@ static void gatts_descriptor_added_cb(int status, int server_if,
{
char buf[MAX_SRVC_ID_STR_LEN];
- haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=%x descr_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=0x%x descr_handle=0x%x\n",
__func__, status, server_if, gatt_uuid_t2str(uuid, buf),
srvc_handle, descr_handle);
}
@@ -687,21 +687,21 @@ static void gatts_descriptor_added_cb(int status, int server_if,
/* Callback invoked in response to start_service */
static void gatts_service_started_cb(int status, int server_if, int srvc_handle)
{
- haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
__func__, status, server_if, srvc_handle);
}
/* Callback invoked in response to stop_service */
static void gatts_service_stopped_cb(int status, int server_if, int srvc_handle)
{
- haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
__func__, status, server_if, srvc_handle);
}
/* Callback triggered when a service has been deleted */
static void gatts_service_deleted_cb(int status, int server_if, int srvc_handle)
{
- haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
+ haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
__func__, status, server_if, srvc_handle);
}
@@ -715,7 +715,7 @@ static void gatts_request_read_cb(int conn_id, int trans_id, bt_bdaddr_t *bda,
{
char buf[MAX_ADDR_STR_LEN];
- haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=%x offset=%d is_long=%d\n",
+ haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=0x%x offset=%d is_long=%d\n",
__func__, conn_id, trans_id, bt_bdaddr_t2str(bda, buf),
attr_handle, offset, is_long);
}
@@ -732,7 +732,7 @@ static void gatts_request_write_cb(int conn_id, int trans_id, bt_bdaddr_t *bda,
char buf[MAX_ADDR_STR_LEN];
char valbuf[100];
- haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=%x offset=%d length=%d need_rsp=%d is_prep=%d value=%s\n",
+ haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=0x%x offset=%d length=%d need_rsp=%d is_prep=%d value=%s\n",
__func__, conn_id, trans_id, bt_bdaddr_t2str(bda, buf),
attr_handle, offset, length, need_rsp, is_prep,
array2str(value, length, valbuf, sizeof(valbuf)));
@@ -755,7 +755,7 @@ static void gatts_request_exec_write_cb(int conn_id, int trans_id,
*/
static void gatts_response_confirmation_cb(int status, int handle)
{
- haltest_info("%s: status=%d handle=%x\n", __func__, status, handle);
+ haltest_info("%s: status=%d handle=0x%x\n", __func__, status, handle);
}
static const btgatt_server_callbacks_t btgatt_server_callbacks = {
--
1.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] android/client: Add additional support for handling hex values
2014-06-05 11:08 [PATCH 1/3] android/client: Add properly print prefix for hex values Grzegorz Kolodziejczyk
@ 2014-06-05 11:08 ` Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 3/3] android/client: Fix handling hex test arguments Grzegorz Kolodziejczyk
2014-06-06 4:07 ` [PATCH 1/3] android/client: Add properly print prefix for hex values Szymon Janc
2 siblings, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-06-05 11:08 UTC (permalink / raw)
To: linux-bluetooth
This patch allows to handle properly hex values prefixed by "0x" or
"0X" as function parameter.
---
android/client/if-gatt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index f6e6327..652c0f8 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -40,10 +40,11 @@ const btgatt_interface_t *if_gatt = NULL;
#define MAX_READ_PARAMS_STR_LEN (MAX_SRVC_ID_STR_LEN + MAX_CHAR_ID_STR_LEN \
+ MAX_UUID_STR_LEN + MAX_HEX_VAL_STR_LEN + 80)
+/* Hex arguments must have "0x" or "0X" prefix */
#define VERIFY_INT_ARG(n, v, err) \
do { \
if (n < argc) \
- v = atoi(argv[n]); \
+ v = strtol(argv[n], NULL, 0); \
else { \
haltest_error(err); \
return;\
--
1.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] android/client: Fix handling hex test arguments
2014-06-05 11:08 [PATCH 1/3] android/client: Add properly print prefix for hex values Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 2/3] android/client: Add additional support for handling " Grzegorz Kolodziejczyk
@ 2014-06-05 11:08 ` Grzegorz Kolodziejczyk
2014-06-06 4:07 ` [PATCH 1/3] android/client: Add properly print prefix for hex values Szymon Janc
2 siblings, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-06-05 11:08 UTC (permalink / raw)
To: linux-bluetooth
This patch allows to pass as argument hex and int values as test command
argument. Hex values must be prefixed by '0x' or '0X'.
---
android/client/if-gatt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 652c0f8..178770d 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -68,6 +68,7 @@ const btgatt_interface_t *if_gatt = NULL;
#define VERIFY_TRANS_ID(n, v) VERIFY_INT_ARG(n, v, "No trans_id specified\n")
#define VERIFY_STATUS(n, v) VERIFY_INT_ARG(n, v, "No status specified\n")
#define VERIFY_OFFSET(n, v) VERIFY_INT_ARG(n, v, "No offset specified\n")
+#define VERIFY_TEST_ARG(n, v) VERIFY_INT_ARG(n, v, "No test arg specified\n")
#define VERIFY_HANDLE(n, v) VERIFY_HEX_ARG(n, v, "No "#v" specified\n")
#define VERIFY_SERVICE_HANDLE(n, v) VERIFY_HANDLE(n, v)
@@ -1406,7 +1407,7 @@ static void test_command_p(int argc, const char **argv)
VERIFY_UUID(4, &uuid);
for (i = 5; i < argc; i++)
- *u++ = atoi(argv[i]);
+ VERIFY_TEST_ARG(i, *u++);
EXEC(if_gatt->client->test_command, command, ¶ms);
}
--
1.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] android/client: Add properly print prefix for hex values
2014-06-05 11:08 [PATCH 1/3] android/client: Add properly print prefix for hex values Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 2/3] android/client: Add additional support for handling " Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 3/3] android/client: Fix handling hex test arguments Grzegorz Kolodziejczyk
@ 2014-06-06 4:07 ` Szymon Janc
2 siblings, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-06-06 4:07 UTC (permalink / raw)
To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth
Hi Grzegorz,
On Thursday 05 of June 2014 13:08:39 Grzegorz Kolodziejczyk wrote:
> This patch fix print hex values by adding "0x" prefix.
> ---
> android/client/if-gatt.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index 0375126..f6e6327 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -454,7 +454,7 @@ static void gattc_get_characteristic_cb(int conn_id, int
> status, char srvc_id_buf[MAX_SRVC_ID_STR_LEN];
> char char_id_buf[MAX_CHAR_ID_STR_LEN];
>
> - haltest_info("%s: conn_id=%d status=%d srvc_id=%s char_id=%s,
> char_prop=%x\n", + haltest_info("%s: conn_id=%d status=%d srvc_id=%s
> char_id=%s, char_prop=0x%x\n", __func__, conn_id, status,
> btgatt_srvc_id_t2str(srvc_id, srvc_id_buf),
> btgatt_gatt_id_t2str(char_id, char_id_buf), char_prop);
> @@ -644,7 +644,7 @@ static void gatts_service_added_cb(int status, int
> server_if,
>
> snprintf(server_if_str, sizeof(server_if_str), "%d", server_if);
>
> - haltest_info("%s: status=%d server_if=%d srvc_id=%s handle=%x\n",
> + haltest_info("%s: status=%d server_if=%d srvc_id=%s handle=0x%x\n",
> __func__, status, server_if,
> btgatt_srvc_id_t2str(srvc_id, buf), srvc_handle);
> }
> @@ -654,7 +654,7 @@ static void gatts_included_service_added_cb(int status,
> int server_if, int srvc_handle,
> int incl_srvc_handle)
> {
> - haltest_info("%s: status=%d server_if=%d srvc_handle=%x
> inc_srvc_handle=%x\n", + haltest_info("%s: status=%d server_if=%d
> srvc_handle=0x%x inc_srvc_handle=0x%x\n", __func__, status, server_if,
> srvc_handle, incl_srvc_handle);
> }
> @@ -667,7 +667,7 @@ static void gatts_characteristic_added_cb(int status,
> int server_if, {
> char buf[MAX_SRVC_ID_STR_LEN];
>
> - haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=%x
> char_handle=%x\n", + haltest_info("%s: status=%d server_if=%d uuid=%s
> srvc_handle=0x%x char_handle=0x%x\n", __func__, status, server_if,
> gatt_uuid_t2str(uuid, buf),
> srvc_handle, char_handle);
> }
> @@ -679,7 +679,7 @@ static void gatts_descriptor_added_cb(int status, int
> server_if, {
> char buf[MAX_SRVC_ID_STR_LEN];
>
> - haltest_info("%s: status=%d server_if=%d uuid=%s srvc_handle=%x
> descr_handle=%x\n", + haltest_info("%s: status=%d server_if=%d uuid=%s
> srvc_handle=0x%x descr_handle=0x%x\n", __func__, status, server_if,
> gatt_uuid_t2str(uuid, buf),
> srvc_handle, descr_handle);
> }
> @@ -687,21 +687,21 @@ static void gatts_descriptor_added_cb(int status, int
> server_if, /* Callback invoked in response to start_service */
> static void gatts_service_started_cb(int status, int server_if, int
> srvc_handle) {
> - haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
> + haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
> __func__, status, server_if, srvc_handle);
> }
>
> /* Callback invoked in response to stop_service */
> static void gatts_service_stopped_cb(int status, int server_if, int
> srvc_handle) {
> - haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
> + haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
> __func__, status, server_if, srvc_handle);
> }
>
> /* Callback triggered when a service has been deleted */
> static void gatts_service_deleted_cb(int status, int server_if, int
> srvc_handle) {
> - haltest_info("%s: status=%d server_if=%d srvc_handle=%x\n",
> + haltest_info("%s: status=%d server_if=%d srvc_handle=0x%x\n",
> __func__, status, server_if, srvc_handle);
> }
>
> @@ -715,7 +715,7 @@ static void gatts_request_read_cb(int conn_id, int
> trans_id, bt_bdaddr_t *bda, {
> char buf[MAX_ADDR_STR_LEN];
>
> - haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=%x offset=%d
> is_long=%d\n", + haltest_info("%s: conn_id=%d trans_id=%d bda=%s
> attr_handle=0x%x offset=%d is_long=%d\n", __func__, conn_id, trans_id,
> bt_bdaddr_t2str(bda, buf),
> attr_handle, offset, is_long);
> }
> @@ -732,7 +732,7 @@ static void gatts_request_write_cb(int conn_id, int
> trans_id, bt_bdaddr_t *bda, char buf[MAX_ADDR_STR_LEN];
> char valbuf[100];
>
> - haltest_info("%s: conn_id=%d trans_id=%d bda=%s attr_handle=%x offset=%d
> length=%d need_rsp=%d is_prep=%d value=%s\n", + haltest_info("%s:
> conn_id=%d trans_id=%d bda=%s attr_handle=0x%x offset=%d length=%d
> need_rsp=%d is_prep=%d value=%s\n", __func__, conn_id, trans_id,
> bt_bdaddr_t2str(bda, buf),
> attr_handle, offset, length, need_rsp, is_prep,
> array2str(value, length, valbuf, sizeof(valbuf)));
> @@ -755,7 +755,7 @@ static void gatts_request_exec_write_cb(int conn_id, int
> trans_id, */
> static void gatts_response_confirmation_cb(int status, int handle)
> {
> - haltest_info("%s: status=%d handle=%x\n", __func__, status, handle);
> + haltest_info("%s: status=%d handle=0x%x\n", __func__, status, handle);
> }
>
> static const btgatt_server_callbacks_t btgatt_server_callbacks = {
All patches applied, thanks.
--
BR
Szymon Janc
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-06 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05 11:08 [PATCH 1/3] android/client: Add properly print prefix for hex values Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 2/3] android/client: Add additional support for handling " Grzegorz Kolodziejczyk
2014-06-05 11:08 ` [PATCH 3/3] android/client: Fix handling hex test arguments Grzegorz Kolodziejczyk
2014-06-06 4:07 ` [PATCH 1/3] android/client: Add properly print prefix for hex values Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).