From 7a2d60467334cd299e89a42717efc94bbbad85f9 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Tue, 29 Apr 2014 13:17:25 +0200 Subject: [PATCH] android: Make multi-line comments style consistent Use common style for multi-line comments consistent with rest of codebase. --- android/android-tester.c | 9 +++-- android/avctp.c | 15 +++++--- android/avdtp.c | 6 ++-- android/avdtp.h | 6 ++-- android/avrcp-lib.c | 3 +- android/avrcp.c | 9 +++-- android/bluetooth.c | 80 +++++++++++++++++++++++++++--------------- android/bluetoothd-snoop.c | 3 +- android/bluetoothd-wrapper.c | 3 +- android/client/history.c | 4 +-- android/client/if-bt.c | 12 ++----- android/client/if-gatt.c | 3 +- android/client/if-hh.c | 10 +++--- android/client/if-main.h | 4 +-- android/client/if-sock.c | 7 ++-- android/client/tabcompletion.c | 9 ++--- android/gatt.c | 73 +++++++++++++++++++++++--------------- android/hal-a2dp.c | 6 ++-- android/hal-audio.c | 33 +++++++++++------ android/hal-avrcp.c | 6 ++-- android/hal-bluetooth.c | 6 ++-- android/hal-gatt.c | 3 +- android/hal-handsfree.c | 6 ++-- android/hal-health.c | 6 ++-- android/hal-hidhost.c | 6 ++-- android/hal-ipc.c | 6 ++-- android/hal-pan.c | 9 +++-- android/hal-utils.h | 2 +- android/handsfree.c | 18 ++++++---- android/hidhost.c | 61 +++++++++++++++++++++----------- android/main.c | 12 ++++--- android/mcap-lib.c | 73 +++++++++++++++++++++++++------------- android/mcap-lib.h | 8 ++--- android/socket.c | 6 ++-- 34 files changed, 324 insertions(+), 199 deletions(-) diff --git a/android/android-tester.c b/android/android-tester.c index f7f3f31a7..f04f8acee 100644 --- a/android/android-tester.c +++ b/android/android-tester.c @@ -153,7 +153,8 @@ static gint scheduled_cbacks_num = 0; static gboolean check_callbacks_called(gpointer user_data) { - /* Wait for all callbacks scheduled in current test context to execute + /* + * Wait for all callbacks scheduled in current test context to execute * in main loop. This will avoid late callback calls after test case has * already failed or timed out. */ @@ -4065,8 +4066,10 @@ static void hid_ctrl_cid_hook_cb(const void *data, uint16_t len, case HID_GET_FEATURE_REPORT: hid_prepare_reply_report(data, len); break; - /* HID device doesnot reply for this commads, so reaching pdu's - * to hid device means assuming test passed */ + /* + * HID device doesnot reply for this commads, so reaching pdu's + * to hid device means assuming test passed + */ case HID_SET_INPUT_REPORT: case HID_SET_OUTPUT_REPORT: case HID_SET_FEATURE_REPORT: diff --git a/android/avctp.c b/android/avctp.c index 7098fc25e..be3fed19a 100644 --- a/android/avctp.c +++ b/android/avctp.c @@ -49,7 +49,8 @@ #include "avctp.h" -/* AV/C Panel 1.23, page 76: +/* + * AV/C Panel 1.23, page 76: * command with the pressed value is valid for two seconds */ #define AVC_PRESS_TIMEOUT 2 @@ -416,10 +417,12 @@ static ssize_t handle_unit_info(struct avctp *session, *code = AVC_CTYPE_STABLE; - /* The first operand should be 0x07 for the UNITINFO response. + /* + * The first operand should be 0x07 for the UNITINFO response. * Neither AVRCP (section 22.1, page 117) nor AVC Digital * Interface Command Set (section 9.2.1, page 45) specs - * explain this value but both use it */ + * explain this value but both use it + */ if (operand_count >= 1) operands[0] = 0x07; if (operand_count >= 2) @@ -442,10 +445,12 @@ static ssize_t handle_subunit_info(struct avctp *session, *code = AVC_CTYPE_STABLE; - /* The first operand should be 0x07 for the UNITINFO response. + /* + * The first operand should be 0x07 for the UNITINFO response. * Neither AVRCP (section 22.1, page 117) nor AVC Digital * Interface Command Set (section 9.2.1, page 45) specs - * explain this value but both use it */ + * explain this value but both use it + */ if (operand_count >= 2) operands[1] = AVC_SUBUNIT_PANEL << 3; diff --git a/android/avdtp.c b/android/avdtp.c index 2c49dcb15..3d309b924 100644 --- a/android/avdtp.c +++ b/android/avdtp.c @@ -1297,8 +1297,10 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction, &stream->codec, &stream->delay_reporting); - /* Verify that the Media Transport capability's length = 0. - * Reject otherwise */ + /* + * Verify that the Media Transport capability's length = 0. + * Reject otherwise + */ for (l = stream->caps; l != NULL; l = g_slist_next(l)) { struct avdtp_service_capability *cap = l->data; diff --git a/android/avdtp.h b/android/avdtp.h index e8d190760..7fdf597c4 100644 --- a/android/avdtp.h +++ b/android/avdtp.h @@ -156,8 +156,10 @@ struct avdtp_sep_cfm { struct avdtp_error *err, void *user_data); }; -/* Callbacks for indicating when we received a new command. The return value - * indicates whether the command should be rejected or accepted */ +/* + * Callbacks for indicating when we received a new command. The return value + * indicates whether the command should be rejected or accepted + */ struct avdtp_sep_ind { gboolean (*get_capability) (struct avdtp *session, struct avdtp_local_sep *sep, diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c index dc3852b28..8df299246 100644 --- a/android/avrcp-lib.c +++ b/android/avrcp-lib.c @@ -1619,7 +1619,8 @@ static int parse_value(struct avrcp_header *pdu, uint8_t *number, *number = pdu->params[0]; - /* Check if PDU is big enough to hold the number of (attribute, value) + /* + * Check if PDU is big enough to hold the number of (attribute, value) * tuples. */ if (*number > AVRCP_ATTRIBUTE_LAST || diff --git a/android/avrcp.c b/android/avrcp.c index 32edbd650..caf933508 100644 --- a/android/avrcp.c +++ b/android/avrcp.c @@ -346,7 +346,8 @@ static void handle_set_volume(const void *buf, uint16_t len) goto done; } - /* Peek the first device since the HAL cannot really address a specific + /* + * Peek the first device since the HAL cannot really address a specific * device it might mean there could only be one connected. */ dev = devices->data; @@ -578,9 +579,11 @@ static int handle_get_capabilities_cmd(struct avrcp *session, DBG(""); - /* Android do not provide this info via HAL so the list most + /* + * Android do not provide this info via HAL so the list most * be hardcoded according to what RegisterNotification can - * actually handle */ + * actually handle + */ avrcp_get_capabilities_rsp(session, transaction, sizeof(events), events); diff --git a/android/bluetooth.c b/android/bluetooth.c index 20455e3d4..76ce790c6 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -401,8 +401,10 @@ static struct device *create_device(const bdaddr_t *bdaddr, uint8_t bdaddr_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. */ + /* + * Use address for name, will be change if one is present + * eg. in EIR or set by set_property. + */ dev->name = g_strdup(addr); return dev; @@ -788,8 +790,10 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data) struct device *dev; uuid_t uuid; - /* If we have a valid response and req->search_uuid == 2, then L2CAP - * UUID & PNP searching was successful -- we are done */ + /* + * If we have a valid response and req->search_uuid == 2, then L2CAP + * UUID & PNP searching was successful -- we are done + */ if (err < 0 || req->search_uuid == 2) { if (err == -ECONNRESET && req->reconnect_attempt < 1) { req->search_uuid--; @@ -912,8 +916,10 @@ static void pin_code_request_callback(uint16_t index, uint16_t length, dev = get_device(&ev->addr.bdaddr, BDADDR_BREDR); - /* Workaround for Android Bluetooth.apk issue: send remote - * device property */ + /* + * Workaround for Android Bluetooth.apk issue: send remote + * device property + */ get_device_name(dev); set_device_bond_state(&ev->addr.bdaddr, HAL_STATUS_SUCCESS, @@ -935,10 +941,11 @@ static void send_ssp_request(const bdaddr_t *addr, uint8_t variant, { struct hal_ev_ssp_request ev; - /* It is ok to have empty name and CoD of remote devices here since - * those information has been already provided on device_connected event - * or during device scaning. Android will use that instead. - */ + /* + * It is ok to have empty name and CoD of remote devices here since + * those information has been already provided on device_connected event + * or during device scaning. Android will use that instead. + */ memset(&ev, 0, sizeof(ev)); bdaddr2android(addr, ev.bdaddr); ev.pairing_variant = variant; @@ -1097,7 +1104,8 @@ static void mgmt_discovering_event(uint16_t index, uint16_t length, gatt_discovery_stopped_cb = NULL; } - /* If discovery is ON or there is no expected next discovery session + /* + * If discovery is ON or there is no expected next discovery session * then just return */ if ((adapter.cur_discovery_type != SCAN_TYPE_NONE) || @@ -1106,7 +1114,8 @@ static void mgmt_discovering_event(uint16_t index, uint16_t length, start_discovery(adapter.exp_discovery_type); - /* Maintain expected discovery type if there is gatt client + /* + * Maintain expected discovery type if there is gatt client * registered */ adapter.exp_discovery_type = gatt_device_found_cb ? @@ -1364,7 +1373,8 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type, dev = get_device(bdaddr, bdaddr_type); - /* Device found event needs to be send also for known device if this is + /* + * Device found event needs to be send also for known device if this is * new discovery session. Otherwise framework will ignore it. */ if (is_new_device(dev, eir.flags)) @@ -1393,8 +1403,10 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type, ba2str(bdaddr, addr); - /* Don't need to confirm name if we have it already in cache - * Just check if device name is different than bdaddr */ + /* + * Don't need to confirm name if we have it already in cache + * Just check if device name is different than bdaddr + */ if (g_strcmp0(dev->name, addr)) { get_device_name(dev); resolve_name = false; @@ -1525,9 +1537,11 @@ static void mgmt_connect_failed_event(uint16_t index, uint16_t length, dev = find_device(&ev->addr.bdaddr); - /* In case security mode 3 pairing we will get connect failed event - * in case e.g wrong PIN code entered. Let's check if device is - * bonding, if so update bond state */ + /* + * In case security mode 3 pairing we will get connect failed event + * in case e.g wrong PIN code entered. Let's check if device is + * bonding, if so update bond state + */ if (dev && dev->bond_state == HAL_BOND_STATE_BONDING) set_device_bond_state(&ev->addr.bdaddr, @@ -1779,7 +1793,8 @@ static void load_ltks(GSList *ltks) cp = g_malloc0(cp_size); - /* Even if the list of stored keys is empty, it is important to load + /* + * Even if the list of stored keys is empty, it is important to load * an empty list into the kernel. That way it is ensured that no old * keys from a previous daemon are present. */ @@ -2045,9 +2060,11 @@ static uint8_t set_adapter_discoverable_timeout(const void *buf, uint16_t len) return HAL_STATUS_FAILED; } - /* Android handles discoverable timeout in Settings app. + /* + * Android handles discoverable timeout in Settings app. * There is no need to use kernel feature for that. - * Just need to store this value here */ + * Just need to store this value here + */ memcpy(&adapter.discoverable_timeout, timeout, sizeof(uint32_t)); @@ -3070,8 +3087,10 @@ static void pair_device_complete(uint8_t status, uint16_t length, DBG("status %u", status); - /* On success bond state change will be send when new link key or LTK - * event is received */ + /* + * On success bond state change will be send when new link key or LTK + * event is received + */ if (status == MGMT_STATUS_SUCCESS) return; @@ -3498,8 +3517,10 @@ static void handle_enable_cmd(const void *buf, uint16_t len) { uint8_t status; - /* Framework expects all properties to be emitted while - * enabling adapter */ + /* + * Framework expects all properties to be emitted while enabling + * adapter + */ get_adapter_properties(); /* Sent also properties of bonded devices */ @@ -3736,8 +3757,10 @@ static void handle_start_discovery_cmd(const void *buf, uint16_t len) goto reply; } - /* Stop discovery here. Once it is stop we will restart it - * with exp_discovery_settings */ + /* + * Stop discovery here. Once it is stop we will restart it + * with exp_discovery_settings + */ if (!stop_discovery(adapter.cur_discovery_type)) { status = HAL_STATUS_FAILED; goto reply; @@ -3927,7 +3950,8 @@ bool bt_bluetooth_register(struct ipc *ipc, uint8_t mode) set_mode(MGMT_OP_SET_BREDR, 0x00); break; case HAL_MODE_BREDR: - /* BR/EDR Should be enabled on start, if it is not that means + /* + * BR/EDR Should be enabled on start, if it is not that means * there is LE controller only and we should fail */ if (!(adapter.current_settings & MGMT_SETTING_BREDR)) { diff --git a/android/bluetoothd-snoop.c b/android/bluetoothd-snoop.c index 844de83e2..57f97f4f7 100644 --- a/android/bluetoothd-snoop.c +++ b/android/bluetoothd-snoop.c @@ -200,7 +200,8 @@ static void set_capabilities(void) header.version = _LINUX_CAPABILITY_VERSION; header.pid = 0; - /* CAP_NET_RAW: for snooping + /* + * CAP_NET_RAW: for snooping * CAP_DAC_READ_SEARCH: override path search permissions */ cap.effective = cap.permitted = diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c index cd53b98fe..90ed29222 100644 --- a/android/bluetoothd-wrapper.c +++ b/android/bluetoothd-wrapper.c @@ -87,7 +87,8 @@ int main(int argc, char *argv[]) (!strcasecmp(value, "true") || atoi(value) > 0)) run_valgrind(debug, mgmt_dbg); - /* In case we failed to execute Valgrind, try to run bluetoothd + /* + * In case we failed to execute Valgrind, try to run bluetoothd * without it */ run_bluetoothd(debug, mgmt_dbg); diff --git a/android/client/history.c b/android/client/history.c index ee285da65..3dae27a88 100644 --- a/android/client/history.c +++ b/android/client/history.c @@ -22,9 +22,7 @@ #include "history.h" -/* - * Very simple history storage for easy usage of tool - */ +/* Very simple history storage for easy usage of tool */ #define HISTORY_DEPTH 20 #define LINE_SIZE 100 diff --git a/android/client/if-bt.c b/android/client/if-bt.c index cef124f83..4d6ff836d 100644 --- a/android/client/if-bt.c +++ b/android/client/if-bt.c @@ -80,9 +80,7 @@ static void dump_properties(int num_properties, bt_property_t *properties) } } -/* - * Cache for remote devices, stored in sorted array - */ +/* Cache for remote devices, stored in sorted array */ static bt_bdaddr_t *remote_devices = NULL; static int remote_devices_cnt = 0; static int remote_devices_capacity = 0; @@ -466,9 +464,7 @@ static void set_adapter_property_p(int argc, const char **argv) EXEC(if_bluetooth->set_adapter_property, &property); } -/* - * This function is to be used for completion methods that need only address - */ +/* This function is to be used for completion methods that need only address */ static void complete_addr_c(int argc, const char **argv, enum_func *enum_func, void **user) { @@ -543,9 +539,7 @@ static void set_remote_device_property_p(int argc, const char **argv) EXEC(if_bluetooth->set_remote_device_property, &addr, &property); } -/* - * For now uuid is not autocompleted. Use routine for complete_addr_c - */ +/* For now uuid is not autocompleted. Use routine for complete_addr_c */ #define get_remote_service_record_c complete_addr_c static void get_remote_service_record_p(int argc, const char **argv) diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c index f42142179..ebf9c594e 100644 --- a/android/client/if-gatt.c +++ b/android/client/if-gatt.c @@ -22,7 +22,8 @@ const btgatt_interface_t *if_gatt = NULL; -/* In version 19 some callback were changed. +/* + * In version 19 some callback were changed. * btgatt_char_id_t -> btgatt_gatt_id_t * bt_uuid_t -> btgatt_gatt_id_t */ diff --git a/android/client/if-hh.c b/android/client/if-hh.c index 0341d25d1..df3fd3058 100644 --- a/android/client/if-hh.c +++ b/android/client/if-hh.c @@ -128,9 +128,7 @@ static void protocol_mode_cb(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t2str(mode)); } -/* - * Callback for get/set_idle_time api. - */ +/* Callback for get/set_idle_time api. */ static void idle_time_cb(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate) { @@ -242,8 +240,10 @@ static void set_info_p(int argc, const char **argv) memset(&hid_info, 0, sizeof(hid_info)); - /* This command is intentionally not supported. See comment from - * bt_hid_info() in android/hidhost.c */ + /* + * This command is intentionally not supported. See comment from + * bt_hid_info() in android/hidhost.c + */ EXEC(if_hh->set_info, &addr, hid_info); } diff --git a/android/client/if-main.h b/android/client/if-main.h index 8865ffce7..ff6006cb3 100644 --- a/android/client/if-main.h +++ b/android/client/if-main.h @@ -131,9 +131,7 @@ int haltest_error(const char *format, ...) int haltest_info(const char *format, ...)__attribute__((format(printf, 1, 2))); int haltest_warn(const char *format, ...)__attribute__((format(printf, 1, 2))); -/* - * Enumerator for discovered devices, to be used as tab completion enum_func - */ +/* Enumerator for discovered devices, to be used as tab completion enum_func */ const char *enum_devices(void *v, int i); const char *interface_name(void *v, int i); const char *command_name(void *v, int i); diff --git a/android/client/if-sock.c b/android/client/if-sock.c index 4c1af822b..20a1fc8ab 100644 --- a/android/client/if-sock.c +++ b/android/client/if-sock.c @@ -46,7 +46,8 @@ static const char * const uuids[] = { static void receive_from_client(struct pollfd *pollfd) { char buf[16]; - /* Buffer for lines: + /* + * Buffer for lines: * 41 42 43 20 20 00 31 32 00 07 04 00 00 00 00 00 ABC .12..... */ char outbuf[sizeof(buf) * 4 + 2]; @@ -187,7 +188,7 @@ static void client_connected(struct pollfd *pollfd) read_accepted(pollfd->fd); } -/** listen */ +/* listen */ static void listen_c(int argc, const char **argv, enum_func *enum_func, void **user) @@ -259,7 +260,7 @@ static void listen_p(int argc, const char **argv) } } -/** connect */ +/* connect */ static void connect_c(int argc, const char **argv, enum_func *enum_func, void **user) diff --git a/android/client/tabcompletion.c b/android/client/tabcompletion.c index aceea398e..cf3fd80e4 100644 --- a/android/client/tabcompletion.c +++ b/android/client/tabcompletion.c @@ -116,9 +116,7 @@ struct command_completion_args { const char *user_help; /* additional data (used by short_help) */ }; -/* - * complete command line - */ +/* complete command line */ static void tab_completion(struct command_completion_args *args) { const char *name = args->typed; @@ -142,10 +140,7 @@ static void tab_completion(struct command_completion_args *args) continue; } - /* - * Prefix matches next time - * reduce prefix to common part - */ + /* Prefix matches next time reduce prefix to common part */ for (j = 0; prefix[j] != 0 && prefix[j] == enum_name[j];) ++j; diff --git a/android/gatt.c b/android/gatt.c index 0e81e7d0b..78349baf0 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -232,7 +232,8 @@ static void destroy_service(void *data) queue_destroy(srvc->chars, destroy_characteristic); - /* Included services we keep on two queues. + /* + * Included services we keep on two queues. * 1. On the same queue with primary services. * 2. On the queue inside primary service. * So we need to free service memory only once but we need to destroy @@ -452,7 +453,8 @@ static void unregister_notification(void *data) struct notification_data *notification = data; struct gatt_device *dev = notification->conn->device; - /* No device means it was already disconnected and client cleanup was + /* + * No device means it was already disconnected and client cleanup was * triggered afterwards, but once client unregisters, device stays if * used by others. Then just unregister single handle. */ @@ -497,7 +499,8 @@ static void connection_cleanup(struct gatt_device *device) g_attrib_unref(attrib); } - /* If device was in connection_pending or connectable state we + /* + * If device was in connection_pending or connectable state we * search device list if we should stop the scan. */ if (!scanning && (device->state == DEVICE_CONNECT_INIT || @@ -513,7 +516,8 @@ static void destroy_gatt_app(void *data) { struct gatt_app *app = data; - /* First we want to get all notifications and unregister them. + /* + * First we want to get all notifications and unregister them. * We don't pass unregister_notification to queue_destroy, * because destroy notification performs operations on queue * too. So remove all elements and then destroy queue. @@ -845,7 +849,8 @@ static void primary_cb(uint8_t status, GSList *services, void *user_data) goto done; } - /* There might be multiply services with same uuid. Therefore make sure + /* + * There might be multiply services with same uuid. Therefore make sure * each primary service one has unique instance_id */ instance_id = 0; @@ -908,7 +913,8 @@ connect: device_set_state(dev, DEVICE_CONNECT_READY); dev->bdaddr_type = addr_type; - /* We are ok to perform connect now. Stop discovery + /* + * We are ok to perform connect now. Stop discovery * and once it is stopped continue with creating ACL */ bt_le_discovery_stop(bt_le_discovery_stop_cb); @@ -1017,7 +1023,8 @@ static int connect_le(struct gatt_device *dev) /* TODO: If we are bonded then we should use higier sec level */ sec_level = BT_IO_SEC_LOW; - /* This connection will help us catch any PDUs that comes before + /* + * This connection will help us catch any PDUs that comes before * pairing finishes */ io = bt_io_connect(connect_cb, device_ref(dev), NULL, &gerr, @@ -1149,9 +1156,7 @@ static struct app_connection *create_connection(struct gatt_device *device, if (!new_conn) return NULL; - /* Make connection id unique to connection record - * (app, device) pair. - */ + /* Make connection id unique to connection record (app, device) pair */ new_conn->app = app; new_conn->id = last_conn_id++; @@ -1230,7 +1235,8 @@ static void handle_client_unregister(const void *buf, uint16_t len) error("gatt: client_if=%d not found", cmd->client_if); status = HAL_STATUS_FAILED; } else { - /* Check if there is any connect request or connected device + /* + * Check if there is any connect request or connected device * for this client. If so, remove this client from those lists. */ app_disconnect_devices(cl); @@ -1368,7 +1374,8 @@ static void set_advertising_cb(uint8_t status, void *user_data) send_client_listen_notify(l->client_id, status); - /* Let's remove client from the list in two cases + /* + * Let's remove client from the list in two cases * 1. Start failed * 2. Stop succeed */ @@ -1416,9 +1423,7 @@ static void handle_client_listen(const void *buf, uint16_t len) goto reply; } } else { - /* Stop listening. - * Check if client was listening - */ + /* Stop listening. Check if client was listening */ if (!listening_client) { error("gatt: This client %d does not listen", cmd->client_if); @@ -1426,9 +1431,10 @@ static void handle_client_listen(const void *buf, uint16_t len) goto reply; } - /* In case there is more listening clients don't stop + /* + * In case there is more listening clients don't stop * advertising - */ + */ if (queue_length(listen_clients) > 1) { queue_remove(listen_clients, INT_TO_PTR(cmd->client_if)); @@ -1454,7 +1460,8 @@ static void handle_client_listen(const void *buf, uint16_t len) goto reply; } - /* Use this flag to keep in mind that we are waiting for callback with + /* + * Use this flag to keep in mind that we are waiting for callback with * result */ req_sent = true; @@ -1480,7 +1487,8 @@ static void handle_client_refresh(const void *buf, uint16_t len) uint8_t status; bdaddr_t bda; - /* This is Android's framework hidden API call. It seams that no + /* + * This is Android's framework hidden API call. It seams that no * notification is expected and Bluedroid silently updates device's * cache under the hood. As we use lazy caching ,we can just clear the * cache and we're done. @@ -1617,7 +1625,8 @@ static void get_included_cb(uint8_t status, GSList *included, void *user_data) /* Remember that we already search included services.*/ service->incl_search_done = true; - /* There might be multiply services with same uuid. Therefore make sure + /* + * There might be multiply services with same uuid. Therefore make sure * each service has unique instance id. Let's take the latest instance * id of primary service and start iterate included services from this * point. @@ -1635,7 +1644,8 @@ static void get_included_cb(uint8_t status, GSList *included, void *user_data) if (!incl) continue; - /* Lets keep included service on two queues. + /* + * Lets keep included service on two queues. * 1. on services queue together with primary service * 2. on special queue inside primary service */ @@ -1647,7 +1657,8 @@ static void get_included_cb(uint8_t status, GSList *included, void *user_data) } } - /* Notify upper layer about first included service. + /* + * Notify upper layer about first included service. * Android framework will iterate for next one. */ incl = queue_peek_head(service->included); @@ -1754,7 +1765,8 @@ static void handle_client_get_included_service(const void *buf, uint16_t len) INT_TO_PTR(inst_id)); } - /* Note that Android framework expects failure notification + /* + * Note that Android framework expects failure notification * which is treat as the end of included services */ if (!incl_service) @@ -1771,7 +1783,8 @@ reply: HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE, status); - /* In case of error in handling request we need to send event with + /* + * In case of error in handling request we need to send event with * Android framework is stupid and do not check status of response */ if (status) @@ -1828,7 +1841,8 @@ static void cache_all_srvc_chars(struct service *srvc, bt_string_to_uuid(&uuid, ch->ch.uuid); bt_uuid_to_uuid128(&uuid, &ch->id.uuid); - /* For now we increment inst_id and use it as characteristic + /* + * For now we increment inst_id and use it as characteristic * handle */ ch->id.instance = ++inst_id; @@ -2300,7 +2314,8 @@ failed: ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC, status); - /* We should send notification with service, characteristic id in case + /* + * We should send notification with service, characteristic id in case * of errors. */ if (status != HAL_STATUS_SUCCESS) @@ -2424,7 +2439,8 @@ failed: ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC, status); - /* We should send notification with service, characteristic id in case + /* + * We should send notification with service, characteristic id in case * of error and write with no response */ if (status != HAL_STATUS_SUCCESS || @@ -2942,7 +2958,8 @@ static void handle_client_register_for_notification(const void *buf, goto failed; } - /* Because same data - notification - is shared by two handlers, we + /* + * Because same data - notification - is shared by two handlers, we * introduce ref counter to be sure that data can be freed with no risk. * Counter is decremented in destroy_notification. */ diff --git a/android/hal-a2dp.c b/android/hal-a2dp.c index ac495a108..68888b261 100644 --- a/android/hal-a2dp.c +++ b/android/hal-a2dp.c @@ -48,8 +48,10 @@ static void handle_audio_state(void *buf, uint16_t len) cbs->audio_state_cb(ev->state, (bt_bdaddr_t *)(ev->bdaddr)); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { { /* HAL_EV_A2DP_CONN_STATE */ .handler = handle_conn_state, diff --git a/android/hal-audio.c b/android/hal-audio.c index 76d1efba6..1c889cce1 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -176,7 +176,8 @@ static uint64_t timespec_diff_us(struct timespec *a, struct timespec *b) } #if defined(ANDROID) -/* Bionic does not have clock_nanosleep() prototype in time.h even though +/* + * Bionic does not have clock_nanosleep() prototype in time.h even though * it provides its implementation. */ extern int clock_nanosleep(clockid_t clock_id, int flags, @@ -1030,7 +1031,8 @@ static bool write_to_endpoint(struct audio_endpoint *ep, size_t bytes) if (ret >= 0) break; - /* this should not happen so let's issue warning, but do not + /* + * this should not happen so let's issue warning, but do not * fail, we can try to write next packet */ if (errno == EAGAIN) { @@ -1066,7 +1068,8 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer, uint64_t audio_sent, audio_passed; bool do_write = false; - /* prepare media packet in advance so we don't waste time after + /* + * prepare media packet in advance so we don't waste time after * wakeup */ mp->hdr.sequence_number = htons(ep->seq++); @@ -1076,7 +1079,8 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer, bytes - consumed, mp, free_space, &written); - /* not much we can do here, let's just ignore remaining + /* + * not much we can do here, let's just ignore remaining * data and continue */ if (read <= 0) @@ -1089,7 +1093,8 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer, audio_sent = ep->samples * 1000000ll / out->cfg.rate; audio_passed = timespec_diff_us(¤t, &ep->start); - /* if we're ahead of stream then wait for next write point + /* + * if we're ahead of stream then wait for next write point, * if we're lagging more than 100ms then stop writing and just * skip data until we're back in sync */ @@ -1139,7 +1144,8 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer, return false; } - /* AudioFlinger provides 16bit PCM, so sample size is 2 bytes + /* + * AudioFlinger provides 16bit PCM, so sample size is 2 bytes * multiplied by number of channels. Number of channels is * simply number of bits set in channels mask. */ @@ -1182,7 +1188,8 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, return -1; } - /* currently Android audioflinger is not able to provide mono stream on + /* + * currently Android audioflinger is not able to provide mono stream on * A2DP output so down mixing needs to be done in hal-audio plugin. * * for reference see @@ -1234,7 +1241,8 @@ static size_t out_get_buffer_size(const struct audio_stream *stream) { DBG(""); - /* We should return proper buffer size calculated by codec (so each + /* + * We should return proper buffer size calculated by codec (so each * input buffer is encoded into single media packed) but this does not * work well with AudioFlinger and causes problems. For this reason we * use magic value here and out_write code takes care of splitting @@ -1247,7 +1255,8 @@ static uint32_t out_get_channels(const struct audio_stream *stream) { DBG(""); - /* AudioFlinger can only provide stereo stream, so we return it here and + /* + * AudioFlinger can only provide stereo stream, so we return it here and * later we'll downmix this to mono in case codec requires it */ @@ -1862,9 +1871,11 @@ static int audio_open(const hw_module_t *module, const char *name, a2dp_dev->dev.close_input_stream = audio_close_input_stream; a2dp_dev->dev.dump = audio_dump; - /* Note that &a2dp_dev->dev.common is the same pointer as a2dp_dev. + /* + * Note that &a2dp_dev->dev.common is the same pointer as a2dp_dev. * This results from the structure of following structs:a2dp_audio_dev, - * audio_hw_device. We will rely on this later in the code.*/ + * audio_hw_device. We will rely on this later in the code. + */ *device = &a2dp_dev->dev.common; return 0; diff --git a/android/hal-avrcp.c b/android/hal-avrcp.c index 5f98f5bb4..5e07366d7 100644 --- a/android/hal-avrcp.c +++ b/android/hal-avrcp.c @@ -165,8 +165,10 @@ static void handle_passthrough_cmd(void *buf, uint16_t len) cbs->passthrough_cmd_cb(ev->id, ev->state); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { /* HAL_EV_AVRCP_REMOTE_FEATURES */ { handle_remote_features, false, diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index 1fa10e0cf..2155978b3 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -351,8 +351,10 @@ static void handle_le_test_mode(void *buf, uint16_t len) bt_hal_cbacks->le_test_mode_cb(ev->status, ev->num_packets); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { { /* HAL_EV_ADAPTER_STATE_CHANGED */ .handler = handle_adapter_state_changed, diff --git a/android/hal-gatt.c b/android/hal-gatt.c index 3bbae2ba4..16b560799 100644 --- a/android/hal-gatt.c +++ b/android/hal-gatt.c @@ -470,7 +470,8 @@ static void handle_response_confirmation(void *buf, uint16_t len) cbs->server->response_confirmation_cb(ev->status, ev->handle); } -/* handlers will be called from notification thread context, +/* + * handlers will be called from notification thread context, * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ static const struct hal_ipc_handler ev_handlers[] = { diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c index e5b573fdc..d9925068e 100644 --- a/android/hal-handsfree.c +++ b/android/hal-handsfree.c @@ -170,8 +170,10 @@ static void handle_hsp_key_press(void *buf, uint16_t len) cbs->key_pressed_cmd_cb(); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { /* HAL_EV_HANDSFREE_CONN_STATE */ { handle_conn_state, false, diff --git a/android/hal-health.c b/android/hal-health.c index b92c8812a..344f55c6a 100644 --- a/android/hal-health.c +++ b/android/hal-health.c @@ -33,8 +33,10 @@ static bool interface_ready(void) return cbacks != NULL; } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { }; diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c index 16253e3d7..5787b5eae 100644 --- a/android/hal-hidhost.c +++ b/android/hal-hidhost.c @@ -102,8 +102,10 @@ static void handle_virtual_unplug(void *buf, uint16_t len) ev->status); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { { /* HAL_EV_HIDHOST_CONN_STATE */ .handler = handle_conn_state, diff --git a/android/hal-ipc.c b/android/hal-ipc.c index 00d460d84..8f5babe86 100644 --- a/android/hal-ipc.c +++ b/android/hal-ipc.c @@ -99,8 +99,10 @@ static void handle_msg(void *buf, ssize_t len) exit(EXIT_FAILURE); } - /* opcode is used as table offset and must be adjusted as events start - * with HAL_MINIMUM_EVENT offset */ + /* + * opcode is used as table offset and must be adjusted as events start + * with HAL_MINIMUM_EVENT offset + */ opcode = msg->opcode - HAL_MINIMUM_EVENT; /* if opcode is valid */ diff --git a/android/hal-pan.c b/android/hal-pan.c index f383081d4..a9ac4ff24 100644 --- a/android/hal-pan.c +++ b/android/hal-pan.c @@ -45,7 +45,8 @@ static void handle_ctrl_state(void *buf, uint16_t len) { struct hal_ev_pan_ctrl_state *ev = buf; - /* FIXME: Callback declared in bt_pan.h is 'typedef void + /* + * FIXME: Callback declared in bt_pan.h is 'typedef void * (*btpan_control_state_callback)(btpan_control_state_t state, * bt_status_t error, int local_role, const char* ifname); * But PanService.Java defined it wrong way. @@ -59,8 +60,10 @@ static void handle_ctrl_state(void *buf, uint16_t len) (char *)ev->name); } -/* handlers will be called from notification thread context, - * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ +/* + * handlers will be called from notification thread context, + * index in table equals to 'opcode - HAL_MINIMUM_EVENT' + */ static const struct hal_ipc_handler ev_handlers[] = { { /* HAL_EV_PAN_CTRL_STATE */ .handler = handle_ctrl_state, diff --git a/android/hal-utils.h b/android/hal-utils.h index 75de7e9b6..8a1d01518 100644 --- a/android/hal-utils.h +++ b/android/hal-utils.h @@ -34,7 +34,7 @@ void str2bt_uuid_t(const char *str, bt_uuid_t *uuid); const char *btproperty2str(const bt_property_t *property); const char *bdaddr2str(const bt_bdaddr_t *bd_addr); -/** +/* * Begin mapping section * * There are some mappings between integer values (enums) and strings diff --git a/android/handsfree.c b/android/handsfree.c index a4802ffeb..b3926f330 100644 --- a/android/handsfree.c +++ b/android/handsfree.c @@ -767,7 +767,8 @@ static void at_cmd_nrec(struct hfp_gw_result *result, enum hfp_gw_cmd_type type, switch (type) { case HFP_GW_CMD_TYPE_SET: - /* Android HAL defines start and stop parameter for NREC + /* + * Android HAL defines start and stop parameter for NREC * callback, but spec allows HF to only disable AG's NREC * feature for SLC duration. Follow spec here. */ @@ -940,7 +941,8 @@ static void at_cmd_bcc(struct hfp_gw_result *result, enum hfp_gw_cmd_type type, select_codec(0); return; } - /* we try connect to negotiated codec. If it fails, and it isn't + /* + * we try connect to negotiated codec. If it fails, and it isn't * CVSD codec, try connect CVSD */ if (!connect_sco() && device.negotiated_codec != CODEC_ID_CVSD) @@ -1110,7 +1112,8 @@ static void at_cmd_cind(struct hfp_gw_result *result, enum hfp_gw_cmd_type type, switch (type) { case HFP_GW_CMD_TYPE_TEST: - /* If device supports Codec Negotiation, AT+BAC should be + /* + * If device supports Codec Negotiation, AT+BAC should be * received first */ if ((device.features & HFP_HF_FEAT_CODEC) && @@ -1249,7 +1252,8 @@ static void at_cmd_bac(struct hfp_gw_result *result, enum hfp_gw_cmd_type type, init_codecs(); device.negotiated_codec = 0; - /* At least CVSD mandatory codec must exist + /* + * At least CVSD mandatory codec must exist * HFP V1.6 4.34.1 */ if (!hfp_gw_result_get_number(result, &val) || @@ -2017,7 +2021,8 @@ static void phone_state_incoming(int num_active, int num_held, uint8_t type, if (device.setup_state == HAL_HANDSFREE_CALL_STATE_INCOMING) { if (device.num_active != num_active || device.num_held != num_held) { - /* calls changed while waiting call ie. due to + /* + * calls changed while waiting call ie. due to * termination of active call */ update_indicator(IND_CALLHELD, @@ -2109,7 +2114,8 @@ static void phone_state_idle(int num_active, int num_held) } else if ((num_active > 0 || num_held > 0) && device.num_active == 0 && device.num_held == 0) { - /* If number of active or held calls change but there + /* + * If number of active or held calls change but there * was no call setup change this means that there were * calls present when headset was connected. */ diff --git a/android/hidhost.c b/android/hidhost.c index 9f4beadc8..1758020e3 100644 --- a/android/hidhost.c +++ b/android/hidhost.c @@ -249,20 +249,23 @@ static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond, switch (ev.type) { case UHID_START: case UHID_STOP: - /* These are called to start and stop the underlying hardware. + /* + * These are called to start and stop the underlying hardware. * We open the channels before creating the device so the * hardware is always ready. No need to handle these. * The kernel never destroys a device itself! Only an explicit - * UHID_DESTROY request can remove a device. */ - + * UHID_DESTROY request can remove a device. + */ break; case UHID_OPEN: case UHID_CLOSE: - /* OPEN/CLOSE are sent whenever user-space opens any interface + /* + * OPEN/CLOSE are sent whenever user-space opens any interface * provided by the kernel HID device. Whenever the open-count * is non-zero we must be ready for I/O. As long as it is zero, * we can decide to drop all I/O and put the device - * asleep This is optional, though. */ + * asleep This is optional, though. + */ break; case UHID_OUTPUT: handle_uhid_output(dev, &ev.u.output); @@ -271,11 +274,13 @@ static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond, /* TODO */ break; case UHID_OUTPUT_EV: - /* This is only sent by kernels prior to linux-3.11. It + /* + * This is only sent by kernels prior to linux-3.11. It * requires us to parse HID-descriptors in user-space to * properly handle it. This is redundant as the kernel * does it already. That's why newer kernels assemble - * the output-reports and send it to us via UHID_OUTPUT. */ + * the output-reports and send it to us via UHID_OUTPUT. + */ DBG("UHID_OUTPUT_EV unsupported"); break; default: @@ -358,9 +363,11 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, error: bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED); - /* Checking for ctrl_watch avoids a double g_io_channel_shutdown since + /* + * Checking for ctrl_watch avoids a double g_io_channel_shutdown since * it's likely that ctrl_watch_cb has been queued for dispatching in - * this mainloop iteration */ + * this mainloop iteration + */ if ((cond & (G_IO_HUP | G_IO_ERR)) && dev->ctrl_watch) g_io_channel_shutdown(chan, TRUE, NULL); @@ -424,15 +431,19 @@ static void bt_hid_notify_get_report(struct hid_device *dev, uint8_t *buf, goto send; } - /* Report porotocol mode reply contains id after hdr, in boot - * protocol mode id doesn't exist */ + /* + * Report porotocol mode reply contains id after hdr, in boot + * protocol mode id doesn't exist + */ ev_len += (dev->boot_dev) ? (len - 1) : (len - 2); ev = g_malloc0(ev_len); ev->status = HAL_HIDHOST_STATUS_OK; bdaddr2android(&dev->dst, ev->bdaddr); - /* Report porotocol mode reply contains id after hdr, in boot - * protocol mode id doesn't exist */ + /* + * Report porotocol mode reply contains id after hdr, in boot + * protocol mode id doesn't exist + */ if (dev->boot_dev) { ev->len = len - 1; memcpy(ev->data, buf + 1, ev->len); @@ -520,9 +531,11 @@ static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond, error: bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED); - /* Checking for intr_watch avoids a double g_io_channel_shutdown since + /* + * Checking for intr_watch avoids a double g_io_channel_shutdown since * it's likely that intr_watch_cb has been queued for dispatching in - * this mainloop iteration */ + * this mainloop iteration + */ if ((cond & (G_IO_HUP | G_IO_ERR)) && dev->intr_watch) g_io_channel_shutdown(chan, TRUE, NULL); @@ -954,10 +967,12 @@ static void bt_hid_info(const void *buf, uint16_t len) return; } - /* Data from hal_cmd_hidhost_set_info is usefull only when we create + /* + * Data from hal_cmd_hidhost_set_info is usefull only when we create * UHID device. Once device is created all the transactions will be * done through the fd. There is no way to use this information - * once device is created with HID internals. */ + * once device is created with HID internals. + */ DBG("Not supported"); ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HIDHOST, HAL_OP_HIDHOST_SET_INFO, @@ -1184,8 +1199,10 @@ static void bt_hid_set_report(const void *buf, uint16_t len) } req[0] = HID_MSG_SET_REPORT | cmd->type; - /* Report data coming to HAL is in ascii format, HAL sends - * data in hex to daemon, so convert to binary. */ + /* + * Report data coming to HAL is in ascii format, HAL sends + * data in hex to daemon, so convert to binary. + */ if (!hex2buf(cmd->data, req + 1, req_size - 1)) { status = HAL_STATUS_INVALID; goto failed; @@ -1254,8 +1271,10 @@ static void bt_hid_send_data(const void *buf, uint16_t len) } req[0] = HID_MSG_DATA | HID_DATA_TYPE_OUTPUT; - /* Report data coming to HAL is in ascii format, HAL sends - * data in hex to daemon, so convert to binary. */ + /* + * Report data coming to HAL is in ascii format, HAL sends + * data in hex to daemon, so convert to binary. + */ if (!hex2buf(cmd->data, req + 1, req_size - 1)) { status = HAL_STATUS_INVALID; goto failed; diff --git a/android/main.c b/android/main.c index a9565a65b..0a0c15080 100644 --- a/android/main.c +++ b/android/main.c @@ -201,8 +201,10 @@ static void service_unregister(const void *buf, uint16_t len) bt_health_unregister(); break; default: - /* This would indicate bug in HAL, as unregister should not be - * called in init failed */ + /* + * This would indicate bug in HAL, as unregister should not be + * called in init failed + */ DBG("service %u not supported", m->service_id); status = HAL_STATUS_FAILED; goto failed; @@ -427,9 +429,11 @@ static bool set_capabilities(void) header.version = _LINUX_CAPABILITY_VERSION; header.pid = 0; - /* CAP_NET_ADMIN: Allow use of MGMT interface + /* + * CAP_NET_ADMIN: Allow use of MGMT interface * CAP_NET_BIND_SERVICE: Allow use of privileged PSM - * CAP_NET_RAW: Allow use of bnep ioctl calls */ + * CAP_NET_RAW: Allow use of bnep ioctl calls + */ cap.effective = cap.permitted = CAP_TO_MASK(CAP_NET_RAW) | CAP_TO_MASK(CAP_NET_ADMIN) | diff --git a/android/mcap-lib.c b/android/mcap-lib.c index b93b0c824..b04eaac4b 100644 --- a/android/mcap-lib.c +++ b/android/mcap-lib.c @@ -841,8 +841,10 @@ static void mcap_cache_mcl(struct mcap_mcl *mcl) mcl->mi->cached = g_slist_remove(mcl->mi->cached, last); last->ctrl &= ~MCAP_CTRL_CACHED; if (last->ctrl & MCAP_CTRL_CONN) { - /* We have to release this MCL if */ - /* connection is not successful */ + /* + * We have to release this MCL if connection is not + * successful + */ last->ctrl |= MCAP_CTRL_FREE; } else { mcap_mcl_release(last); @@ -1064,8 +1066,10 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, void *cmd, mdl = get_mdl(mcl, mdl_id); if (mdl && (mdl->state == MDL_WAITING || mdl->state == MDL_DELETING )) { - /* Creation request arrives for a MDL that is being managed - * at current moment */ + /* + * Creation request arrives for a MDL that is being managed + * at current moment + */ mcap_send_cmd(mcl, MCAP_MD_CREATE_MDL_RSP, MCAP_MDL_BUSY, mdl_id, NULL, 0); return; @@ -1081,9 +1085,11 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, void *cmd, } if (cfga != 0 && cfga != conf) { - /* Remote device set default configuration but upper profile */ - /* has changed it. Protocol Error: force closing the MCL by */ - /* remote device using UNSPECIFIED_ERROR response */ + /* + * Remote device set default configuration but upper profile + * has changed it. Protocol Error: force closing the MCL by + * remote device using UNSPECIFIED_ERROR response + */ mcap_send_cmd(mcl, MCAP_MD_CREATE_MDL_RSP, MCAP_UNSPECIFIED_ERROR, mdl_id, NULL, 0); return; @@ -1101,8 +1107,10 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, void *cmd, mcl->mdls = g_slist_insert_sorted(mcl->mdls, mcap_mdl_ref(mdl), compare_mdl); } else if (mdl->state == MDL_CONNECTED) { - /* MCAP specification says that we should close the MCL if - * it is open when we receive a MD_CREATE_MDL_REQ */ + /* + * MCAP specification says that we should close the MCL if + * it is open when we receive a MD_CREATE_MDL_REQ + */ shutdown_mdl(mdl); } @@ -1135,8 +1143,10 @@ static void process_md_reconnect_mdl_req(struct mcap_mcl *mcl, void *cmd, mdl_id, NULL, 0); return; } else if (mdl->state == MDL_WAITING || mdl->state == MDL_DELETING ) { - /* Creation request arrives for a MDL that is being managed - * at current moment */ + /* + * Creation request arrives for a MDL that is being managed + * at current moment + */ mcap_send_cmd(mcl, MCAP_MD_RECONNECT_MDL_RSP, MCAP_MDL_BUSY, mdl_id, NULL, 0); return; @@ -1267,8 +1277,10 @@ static void invalid_req_state(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len) error("Invalid cmd received (op code = %d) in state %d", cmd[0], mcl->state); - /* Get previously mdlid sent to generate an appropriate - * response if it is possible */ + /* + * Get previously mdlid sent to generate an appropriate + * response if it is possible + */ mdlr = len < sizeof(mcap_md_req) ? MCAP_MDLID_RESERVED : ntohs(((mcap_md_req *) cmd)->mdl); mcap_send_cmd(mcl, cmd[0]+1, MCAP_INVALID_OPERATION, mdlr, NULL, 0); @@ -1557,12 +1569,16 @@ static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, mcap_rsp *rsp, static void post_process_rsp(struct mcap_mcl *mcl, struct mcap_mdl_op_cb *op) { if (mcl->priv_data != op) { - /* Queued MCAP request in some callback. */ - /* We should not delete the mcl private data */ + /* + * Queued MCAP request in some callback. + * We should not delete the mcl private data + */ free_mcap_mdl_op(op); } else { - /* This is not a queued request. It's safe */ - /* delete the mcl private data here. */ + /* + * This is not a queued request. It's safe + * delete the mcl private data here. + */ free_mcl_priv_data(mcl); } } @@ -2374,9 +2390,11 @@ static gboolean valid_btclock(uint32_t btclk) static gboolean read_btclock(struct mcap_mcl *mcl, uint32_t *btclock, uint16_t *btaccuracy) { - /* FIXME: btd_adapter_read_clock(...) always return FALSE, current - code doesn't support CSP (Clock Synchronization Protocol). To avoid - build dependancy on struct 'btd_adapter', removing this code. */ + /* + * FIXME: btd_adapter_read_clock(...) always return FALSE, current + * code doesn't support CSP (Clock Synchronization Protocol). To avoid + * build dependancy on struct 'btd_adapter', removing this code. + */ return FALSE; } @@ -2637,7 +2655,8 @@ static gboolean get_all_clocks(struct mcap_mcl *mcl, uint32_t *btclock, clock_gettime(CLK, base_time); - /* Tries to detect preemption between clock_gettime + /* + * Tries to detect preemption between clock_gettime * and read_btclock by measuring transaction time */ latency = time_us(base_time) - time_us(&t0); @@ -2847,8 +2866,10 @@ static void proc_sync_set_req(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len) } if (update) { - /* Indication frequency: required accuracy divided by ours */ - /* Converted to milisseconds */ + /* + * Indication frequency: required accuracy divided by ours + * Converted to milisseconds + */ ind_freq = (1000 * mcl->csp->rem_req_acc) / caps(mcl)->ts_acc; if (ind_freq < MAX(caps(mcl)->latency * 2 / 1000, 100)) { @@ -2879,9 +2900,11 @@ static void proc_sync_set_req(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len) set_data->ind_freq = ind_freq; set_data->role = get_btrole(mcl); - /* TODO is there some way to schedule a call based directly on + /* + * TODO is there some way to schedule a call based directly on * a BT clock value, instead of this estimation that uses - * the SO clock? */ + * the SO clock? + */ if (phase2_delay > 0) { when = phase2_delay + caps(mcl)->syncleadtime_ms; diff --git a/android/mcap-lib.h b/android/mcap-lib.h index 0a486d106..548d67259 100644 --- a/android/mcap-lib.h +++ b/android/mcap-lib.h @@ -102,9 +102,7 @@ typedef struct { uint16_t mdl; } __attribute__ ((packed)) mcap_md_req; -/* - * MCAP Response Packet Format - */ +/* MCAP Response Packet Format */ typedef struct { uint8_t op; @@ -113,9 +111,7 @@ typedef struct { uint8_t data[0]; } __attribute__ ((packed)) mcap_rsp; -/* - * MCAP Clock Synchronization Protocol - */ +/* MCAP Clock Synchronization Protocol */ typedef struct { uint8_t op; diff --git a/android/socket.c b/android/socket.c index 8374489a6..99d6bec3b 100644 --- a/android/socket.c +++ b/android/socket.c @@ -735,7 +735,8 @@ static int find_free_channel(void) static BtIOSecLevel get_sec_level(uint8_t flags) { - /* HAL_SOCK_FLAG_AUTH should require MITM but in our case setting + /* + * HAL_SOCK_FLAG_AUTH should require MITM but in our case setting * security to BT_IO_SEC_HIGH would also require 16-digits PIN code * for pre-2.1 devices which is not what Android expects. For this * reason we ignore this flag to not break apps which use "secure" @@ -1145,7 +1146,8 @@ void bt_socket_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode) DBG(""); - /* make sure channels assigned for profiles are reserved and not used + /* + * make sure channels assigned for profiles are reserved and not used * for app services */ for (i = 0; i < G_N_ELEMENTS(profiles); i++) -- 2.11.0