diff --git a/android/android-tester.c b/android/android-tester.c
index f7f3f31..f04f8ac 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
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.
*/
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 7098fc2..be3fed1 100644
--- a/android/avctp.c
+++ b/android/avctp.c
#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
*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)
*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 2c49dcb..3d309b9 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
&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 e8d1907..7fdf597 100644
--- a/android/avdtp.h
+++ b/android/avdtp.h
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 dc3852b..8df2992 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
*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 32edbd6..caf9335 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
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;
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 20455e3..76ce790 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
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;
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--;
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,
{
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;
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) ||
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 ?
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))
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;
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,
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.
*/
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));
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;
{
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 */
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;
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 844de83..57f97f4 100644
--- a/android/bluetoothd-snoop.c
+++ b/android/bluetoothd-snoop.c
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 cd53b98..90ed292 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
(!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 ee285da..3dae27a 100644
--- a/android/client/history.c
+++ b/android/client/history.c
#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 cef124f..4d6ff83 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
}
}
-/*
- * 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;
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)
{
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 f421421..ebf9c59 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
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 0341d25..df3fd30 100644
--- a/android/client/if-hh.c
+++ b/android/client/if-hh.c
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)
{
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 8865ffc..ff6006c 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
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 4c1af82..20a1fc8 100644
--- a/android/client/if-sock.c
+++ b/android/client/if-sock.c
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];
read_accepted(pollfd->fd);
}
-/** listen */
+/* listen */
static void listen_c(int argc, const char **argv, enum_func *enum_func,
void **user)
}
}
-/** 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 aceea39..cf3fd80 100644
--- a/android/client/tabcompletion.c
+++ b/android/client/tabcompletion.c
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;
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 0e81e7d..78349ba 100644
--- a/android/gatt.c
+++ b/android/gatt.c
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
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.
*/
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 ||
{
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.
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;
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);
/* 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,
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++;
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);
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
*/
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);
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));
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;
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.
/* 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.
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
*/
}
}
- /* 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);
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)
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)
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;
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)
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 ||
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 ac495a1..68888b2 100644
--- a/android/hal-a2dp.c
+++ b/android/hal-a2dp.c
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 76d1efb..1c889cc 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
}
#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,
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) {
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++);
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)
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
*/
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.
*/
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
{
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
{
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
*/
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 5f98f5b..5e07366 100644
--- a/android/hal-avrcp.c
+++ b/android/hal-avrcp.c
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 1fa10e0..2155978 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
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 3bbae2b..16b5607 100644
--- a/android/hal-gatt.c
+++ b/android/hal-gatt.c
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 e5b573f..d992506 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
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 b92c881..344f55c 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
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 16253e3..5787b5e 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
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 00d460d..8f5babe 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
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 f383081..a9ac4ff 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
{
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.
(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 75de7e9..8a1d015 100644
--- a/android/hal-utils.h
+++ b/android/hal-utils.h
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 a4802ff..b3926f3 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
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.
*/
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)
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) &&
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) ||
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,
} 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 9f4bead..1758020 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
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);
/* 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:
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);
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);
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);
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,
}
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;
}
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 a9565a6..0a0c150 100644
--- a/android/main.c
+++ b/android/main.c
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;
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 b93b0c8..b04eaac 100644
--- a/android/mcap-lib.c
+++ b/android/mcap-lib.c
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);
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;
}
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;
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);
}
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;
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);
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);
}
}
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;
}
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);
}
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)) {
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 0a486d1..548d672 100644
--- a/android/mcap-lib.h
+++ b/android/mcap-lib.h
uint16_t mdl;
} __attribute__ ((packed)) mcap_md_req;
-/*
- * MCAP Response Packet Format
- */
+/* MCAP Response Packet Format */
typedef struct {
uint8_t op;
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 8374489..99d6bec 100644
--- a/android/socket.c
+++ b/android/socket.c
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"
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++)