if (long_read == NULL)
return 0;
- long_read->attrib = attrib;
+ long_read->attrib = g_attrib_ref(attrib);
long_read->func = func;
long_read->user_data = user_data;
long_read->handle = handle;
"Characteristics Discovery" },
{ "char-desc", cmd_char_desc, "[start hnd] [end hnd]",
"Characteristics Descriptor Discovery" },
+#ifdef __TIZEN_PATCH__
+ { "char-read-hnd", cmd_read_hnd, "<handle> [offset]",
+ "Characteristics Value/Descriptor Read by handle" },
+#else
{ "char-read-hnd", cmd_read_hnd, "<handle>",
"Characteristics Value/Descriptor Read by handle" },
+#endif
{ "char-read-uuid", cmd_read_uuid, "<UUID> [start hnd] [end hnd]",
"Characteristics Value/Descriptor Read by UUID" },
{ "char-write-req", cmd_char_write, "<handle> <new value>",
struct hci_request rq;
memset(&cp, 0, sizeof(cp));
+#ifdef __TIZEN_PATCH__
+ strncpy((char *) cp.name, name, sizeof(cp.name) - 1);
+#else
strncpy((char *) cp.name, name, sizeof(cp.name));
+#endif
memset(&rq, 0, sizeof(rq));
rq.ogf = OGF_HOST_CTL;
}
}
+#ifdef __TIZEN_PATCH__
+struct hci_vse_sec_brcm_link_loss_dbg_info{
+ unsigned char linklost_status;
+ unsigned char conn_handle;
+ char trans_pwr;
+ char rssi;
+ unsigned char ch_map[10];
+ unsigned char lmp_cmd[4];
+} __packed;
+
+static void linkloss_evt(const void *data, uint8_t size)
+{
+
+ struct hci_vse_sec_brcm_link_loss_dbg_info *ev = (void *) data;
+ char *status = NULL;
+ switch (ev->linklost_status) {
+ case 0:
+ status = "BT_Link_Supervision_Timeout";
+ break;
+ case 1:
+ status = "LE_Link_Supervision_Timeout";
+ break;
+ case 2:
+ status = "BT_LMP_Timeout_Local";
+ break;
+ case 3:
+ status = "BT_LMP_Timeout_Remote";
+ break;
+ case 4:
+ status = "LE_LMP_Timeout";
+ break;
+ case 5:
+ status = "Page_Timeout";
+ break;
+ default :
+ break;
+ }
+
+ print_field("Status:%s,Handle:%02x,Trans_Pwr:%d,RSSI:%d"
+ " Ch_map:%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+ " LMP_cmd:0x%x%x%x%x",
+ status, ev->conn_handle, ev->trans_pwr, ev->rssi,
+ ev->ch_map[0], ev->ch_map[1], ev->ch_map[2], ev->ch_map[3],
+ ev->ch_map[4], ev->ch_map[5], ev->ch_map[6], ev->ch_map[7],
+ ev->ch_map[8], ev->ch_map[9], ev->lmp_cmd[0], ev->lmp_cmd[1],
+ ev->lmp_cmd[2], ev->lmp_cmd[3]);
+}
+#endif
+
static const struct vendor_evt vendor_evt_table[] = {
+#ifdef __TIZEN_PATCH__
+ { 0x76, "SEC Link Loss", linkloss_evt, 18, true },
+#endif
{ }
};
return "Intel";
case 15:
return "Broadcom";
+#ifdef __TIZEN_PATCH__
+ default:
+ return "Unknown";
+#endif
}
return NULL;
return intel_vendor_ocf(ocf);
case 15:
return broadcom_vendor_ocf(ocf);
+#ifdef __TIZEN_PATCH__
+ default:
+ return broadcom_vendor_ocf(ocf);
+#endif
}
return NULL;
return intel_vendor_evt(evt);
case 15:
return broadcom_vendor_evt(evt);
+#ifdef __TIZEN_PATCH__
+ default:
+ return broadcom_vendor_evt(evt);
+#endif
}
return NULL;
static struct input_device *input_device_role_new(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
- struct btd_profile *p = btd_service_get_profile(service);
const char *path = device_get_path(device);
struct btd_adapter *adapter = device_get_adapter(device);
struct input_device *idev;
error("BNEP server cannot be added");
#ifdef __TIZEN_PATCH__
-{
+if (ns) {
/* Emit connected signal to BT application */
const gchar *adapter_path = adapter_get_path(na->adapter);
const char *pdev = na->setup->dev;
#ifdef __TIZEN_PATCH__
if (device) {
- device_get_tizen_addr(device, &t_addr);
+ device_get_tizen_addr(device, addr->type, &t_addr);
+
device_set_disconnect_reason(device, reason);
adapter_remove_connection(adapter, device, t_addr.bdaddr_type);
disconnect_notify(device, reason);
rand = le64_to_cpu(key->rand);
#ifdef __TIZEN_PATCH__
- device_get_tizen_addr(device, &t_addr);
+ device_get_tizen_addr(device, addr->type, &t_addr);
store_longtermkey(bdaddr, &t_addr.bdaddr, t_addr.bdaddr_type,
key->val, key->master, key->type,
key->enc_size, ediv, rand);
return;
#ifdef __TIZEN_PATCH__
- device_get_tizen_addr(device, &t_addr);
+ device_get_tizen_addr(device, addr->type, &t_addr);
store_csrk(bdaddr, &t_addr.bdaddr, t_addr.bdaddr_type, key->val, 0,
key->type);
#else
return;
#ifdef __TIZEN_PATCH__
- device_get_tizen_addr(device, &t_addr);
+ device_get_tizen_addr(device, addr->type, &t_addr);
store_irk(adapter, &t_addr.bdaddr, t_addr.bdaddr_type, irk->val);
#else
store_irk(adapter, &addr->bdaddr, addr->type, irk->val);
return;
#ifdef __TIZEN_PATCH__
- device_get_tizen_addr(dev, &t_addr);
+ device_get_tizen_addr(dev, ev->addr.type, &t_addr);
store_conn_param(adapter, &t_addr.bdaddr, t_addr.bdaddr_type,
ev->min_interval, ev->max_interval,
ev->latency, ev->timeout);
g_dbus_send_message(dbus_conn,
btd_error_failed(dev->connect, strerror(-err)));
else {
+#ifdef __TIZEN_PATCH__
+ /* SDP is not required for Samsung TV Power on */
+ if (g_strcmp0(profile->name, "hid-device") == 0) {
+ DBG("Skip SDP discovery.");
+ } else {
+#endif
/* Start passive SDP discovery to update known services */
if (dev->bredr && !dev->svc_refreshed)
device_browse_sdp(dev, NULL);
#ifdef __TIZEN_PATCH__
+ }
+#endif
+
+#ifdef __TIZEN_PATCH__
if (err)
g_dbus_send_message(dbus_conn,
btd_error_failed(dev->connect, strerror(-err)));
#ifdef __TIZEN_PATCH__
if (device->browse) {
- /* clear browse info */
- device->browse = NULL;
+ struct browse_req *req = device->browse;
+
+ if ((bdaddr_type == BDADDR_BREDR && req->search_uuid != 0) ||
+ (bdaddr_type != BDADDR_BREDR && req->search_uuid == 0))
+ device->browse = NULL;
+ else
+ DBG("device->browse is for other link");
}
#endif
#ifdef __TIZEN_PATCH__
void device_print_addr(struct btd_device *dev)
{
- char addr[18];
-
- ba2str(&dev->bdaddr, addr);
- DBG("IDA : %s %d", addr, dev->bdaddr_type);
+ char ida[18];
+ char rpa[18];
- if (dev->rpa) {
- ba2str(dev->rpa, addr);
- DBG("RPA : %s", addr);
- } else {
- DBG("No RPA");
- }
+ ba2str(&dev->bdaddr, ida);
- if (dev->bredr)
- DBG("BREDR Support");
- else
- DBG("BREDR Not Support");
-
- if (dev->le)
- DBG("LE Support");
- else
- DBG("LE Not Support");
+ if (dev->rpa)
+ ba2str(dev->rpa, rpa);
- DBG("***");
+ DBG("IDA %s [%d] : RPA [%s], BREDR [%d], LE [%d]",
+ ida, dev->bdaddr_type, dev->rpa ? rpa : "0",
+ dev->bredr ? 1 : 0, dev->le ? 1 : 0);
}
#endif
struct btd_gatt_database *database;
const bdaddr_t *src, *dst;
char srcaddr[18], dstaddr[18];
+#ifdef __TIZEN_PATCH__
+ uint8_t dst_type = BDADDR_BREDR;
+#endif
bt_io_get(io, &gerr, BT_IO_OPT_SEC_LEVEL, &sec_level,
BT_IO_OPT_IMTU, &mtu,
BT_IO_OPT_CID, &cid,
+#ifdef __TIZEN_PATCH__
+ BT_IO_OPT_DEST_TYPE, &dst_type,
+#endif
BT_IO_OPT_INVALID);
if (gerr) {
bt_att_set_remote_key(dev->att, dev->remote_csrk->key,
remote_counter, dev);
+#ifdef __TIZEN_PATCH__
+ if (dst_type != BDADDR_BREDR && device_get_rpa_exist(dev) == true) {
+ bt_att_set_remote_addr(dev->att,
+ device_get_rpa(dev), BDADDR_LE_RANDOM);
+ } else {
+ bt_att_set_remote_addr(dev->att,
+ &dev->bdaddr, dev->bdaddr_type);
+ }
+#endif
+
database = btd_adapter_get_database(dev->adapter);
src = btd_adapter_get_address(dev->adapter);
device->auth_bdaddr_type = type;
}
-void device_get_tizen_addr(struct btd_device *device,
- struct device_addr_type *addr)
+void device_get_tizen_addr(struct btd_device *device, uint8_t type,
+ struct device_addr_type *addr)
{
if (!device || !addr)
return;
+ if (type == BDADDR_BREDR) {
+ bacpy(&addr->bdaddr, &device->bdaddr);
+ addr->bdaddr_type = BDADDR_BREDR;
+ return;
+ }
+
if (device->rpa) {
bacpy(&addr->bdaddr, device->rpa);
addr->bdaddr_type = BDADDR_LE_RANDOM;
if (g_str_equal(p->remote_uuid, remote_uuid))
return service;
+
+#ifdef TIZEN_BT_HID_DEVICE_ENABLE
+ if (g_str_equal(HID_UUID, remote_uuid)) {
+ if (strcmp(p->name, "hid-device") == 0)
+ return service;
+ }
+#endif
}
return NULL;
void device_le_data_length_changed(struct btd_device *device, uint16_t max_tx_octets,
uint16_t max_tx_time, uint16_t max_rx_octets,
uint16_t max_rx_time);
-void device_get_tizen_addr(struct btd_device *device,
- struct device_addr_type *addr);
+void device_get_tizen_addr(struct btd_device *device, uint8_t type,
+ struct device_addr_type *addr);
#ifdef TIZEN_FEATURE_PLATFROM_SCAN_FILTER
void device_set_ibeacon_report_info(struct btd_device *device, void *data, uint8_t data_len,
uint8_t adv_type, int8_t rssi);
static bool get_dst_info(struct bt_att *att, bdaddr_t *dst, uint8_t *dst_type)
{
+#ifdef __TIZEN_PATCH__
+ return bt_att_get_remote_addr(att, dst, dst_type);
+#else
GIOChannel *io = NULL;
GError *gerr = NULL;
-#ifdef __TIZEN_PATCH__
- struct btd_adapter *adapter;
- bdaddr_t src;
-#endif
io = g_io_channel_unix_new(bt_att_get_fd(att));
if (!io)
return false;
-#ifdef __TIZEN_PATCH__
- bt_io_get(io, &gerr, BT_IO_OPT_SOURCE_BDADDR, &src,
- BT_IO_OPT_DEST_BDADDR, dst,
- BT_IO_OPT_DEST_TYPE, dst_type,
- BT_IO_OPT_INVALID);
-#else
bt_io_get(io, &gerr, BT_IO_OPT_DEST_BDADDR, dst,
BT_IO_OPT_DEST_TYPE, dst_type,
BT_IO_OPT_INVALID);
-#endif
if (gerr) {
error("gatt: bt_io_get: %s", gerr->message);
g_error_free(gerr);
g_io_channel_unref(io);
-#ifdef __TIZEN_PATCH__
- adapter = adapter_find(&src);
- if (adapter == NULL) {
- DBG("Cannot get adapter");
- return true;
- }
-
- if (*dst_type == BDADDR_LE_PUBLIC) {
- struct btd_device *device;
- char addr[18] = { 0 };
- char addr_rpa[18] = { 0 };
- const bdaddr_t *rpa;
-
- device = btd_adapter_find_device(adapter, dst, *dst_type);
- if (device == NULL) {
- DBG("Cannot find device");
- return true;
- }
-
- if (device_get_rpa_exist(device) == false)
- return true;
-
- rpa = device_get_rpa(device);
- if (rpa == NULL)
- return true;
-
- ba2str(dst, addr);
- ba2str(rpa, addr_rpa);
- DBG("Convert IDA [%s] to RPA [%s]", addr, addr_rpa);
-
- bacpy(dst, rpa);
- *dst_type = BDADDR_LE_RANDOM;
- }
-#endif
-
return true;
+#endif
}
static void gatt_ccc_read_cb(struct gatt_db_attribute *attrib,
static char *get_pse_record(struct ext_profile *ext, struct ext_io *l2cap,
struct ext_io *rfcomm)
{
+#ifdef __TIZEN_PATCH__
+ uint8_t chan = 0;
+
+ if (rfcomm)
+ chan = rfcomm->chan;
+
+ return g_strdup_printf(PSE_RECORD, chan, ext->version, ext->name);
+#else
uint16_t psm = 0;
uint8_t chan = 0;
if (rfcomm)
chan = rfcomm->chan;
-#ifdef __TIZEN_PATCH__
- return g_strdup_printf(PSE_RECORD, chan, ext->version, ext->name);
-#else
return g_strdup_printf(PSE_RECORD, chan, ext->version, ext->name, psm);
#endif
}
bool in_req; /* There's a pending incoming request */
#ifdef __TIZEN_PATCH__
+ bdaddr_t bdaddr;
+ uint8_t bdaddr_type;
bool service_change_indication; /* Service changed indication status */
#endif
}
#ifdef __TIZEN_PATCH__
+bool bt_att_set_remote_addr(struct bt_att *att,
+ const bdaddr_t *bdaddr, uint8_t bdaddr_type)
+{
+ if (!att)
+ return false;
+
+ bacpy(&att->bdaddr, bdaddr);
+ att->bdaddr_type = bdaddr_type;
+
+ return true;
+}
+
+bool bt_att_get_remote_addr(struct bt_att *att,
+ bdaddr_t *bdaddr, uint8_t *bdaddr_type)
+{
+ if (!att)
+ return false;
+
+ if (!bacmp(&att->bdaddr, BDADDR_ANY))
+ return false;
+
+ bacpy(bdaddr, &att->bdaddr);
+ *bdaddr_type = att->bdaddr_type;
+
+ return true;
+}
+
bool bt_att_set_svc_changed_indication_registered(struct bt_att *att, bool value)
{
if (!att)
#include <stdint.h>
#include "src/shared/att-types.h"
+#ifdef __TIZEN_PATCH__
+#include "lib/bluetooth.h"
+#endif
struct bt_att;
bt_att_counter_func_t func, void *user_data);
bool bt_att_has_crypto(struct bt_att *att);
#ifdef __TIZEN_PATCH__
+bool bt_att_set_remote_addr(struct bt_att *att,
+ const bdaddr_t *bdaddr, uint8_t bdaddr_type);
+bool bt_att_get_remote_addr(struct bt_att *att,
+ bdaddr_t *bdaddr, uint8_t *bdaddr_type);
bool bt_att_set_svc_changed_indication_registered(struct bt_att *att, bool value);
bool bt_att_get_svc_changed_indication_registered(struct bt_att *att);
#endif
\ No newline at end of file
return -1;
/* FIXME: This should use accept4() with SOCK_CLOEXEC */
+#ifdef __TIZEN_PATCH__
+ return accept(fd, NULL, NULL);
+#else
return accept(fd, NULL, 0);
+#endif
}
static bool alg_encrypt(int fd, const void *inbuf, size_t inlen,
* r' = padding || r
*
* The least significant octet of r becomes the least significant octet
- * of r’ and the most significant octet of padding becomes the most
+ * of r??and the most significant octet of padding becomes the most
* significant octet of r'.
*
* For example, if the 24-bit value r is 0x423456 then r' is
struct client *cli = user_data;
if (!success) {
+#ifndef __TIZEN_PATCH__
PRLOG("GATT discovery procedures failed - error code: 0x%02x\n",
att_ecode);
+#else
+ PRLOG("GATT discovery procedures failed: %s (0x%02x)\n",
+ ecode_to_string(att_ecode), att_ecode);
+#endif
return;
}
int i;
if (!success) {
+#ifndef __TIZEN_PATCH__
PRLOG("\nRead multiple request failed: 0x%02x\n", att_ecode);
+#else
+ PRLOG("\nRead multiple request failed: %s (0x%02x)\n",
+ ecode_to_string(att_ecode), att_ecode);
+#endif
return;
}
static void register_notify_cb(uint16_t att_ecode, void *user_data)
{
if (att_ecode) {
+#ifndef __TIZEN_PATCH__
PRLOG("Failed to register notify handler "
"- error code: 0x%02x\n", att_ecode);
+#else
+ PRLOG("Failed to register notify handler: %s (0x%02x)\n",
+ ecode_to_string(att_ecode), att_ecode);
+#endif
return;
}
static void print_link_policy(struct hci_dev_info *di)
{
+#ifdef __TIZEN_PATCH__
+ char *str;
+ str = hci_lptostr(di->link_policy);
+ printf("\tLink policy: %s\n", str);
+ bt_free(str);
+#else
printf("\tLink policy: %s\n", hci_lptostr(di->link_policy));
+#endif
}
static void print_link_mode(struct hci_dev_info *di)
static void run_command(char *cmdname, char *home)
{
+#ifdef __TIZEN_PATCH__
+ char *argv[10], *envp[3];
+#else
char *argv[9], *envp[3];
+#endif
int pos = 0, idx = 0;
int serial_fd;
pid_t pid, dbus_pid, daemon_pid;