summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-09-29 12:17:55 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-09-29 12:17:55 +0200
commita81886773ef4bda574248d9d3a7942d9f6c04dbc (patch)
tree06f2d372115107ed9966e6fe2876aded9660d30d
parentafda5bee3495e4fe070cf59e2f240127c341faf4 (diff)
Add support for setting major and minor class together
-rw-r--r--src/dbus-hci.c20
-rw-r--r--src/dbus-hci.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index d724bf95..2681a750 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -1303,6 +1303,24 @@ int set_minor_class(int dd, const uint8_t *cls, uint8_t minor)
return 0;
}
+int set_major_and_minor_class(int dd, const uint8_t *cls,
+ uint8_t major, uint8_t minor)
+{
+ uint32_t dev_class;
+
+ dev_class = (cls[2] << 16) | ((cls[1] & 0x20) << 8) |
+ ((major & 0xdf) << 8) | minor;
+
+ if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
+ int err = errno;
+ error("Can't write class of device: %s (%d)",
+ strerror(err), err);
+ return -err;
+ }
+
+ return 0;
+}
+
/* Section reserved to device HCI callbacks */
void hcid_dbus_setname_complete(bdaddr_t *local)
@@ -1532,7 +1550,7 @@ int hcid_dbus_get_io_cap(bdaddr_t *local, bdaddr_t *remote,
}
int hcid_dbus_set_io_cap(bdaddr_t *local, bdaddr_t *remote,
- uint8_t cap, uint8_t auth)
+ uint8_t cap, uint8_t auth)
{
struct btd_adapter *adapter;
struct btd_device *device;
diff --git a/src/dbus-hci.h b/src/dbus-hci.h
index 35a8be7c..fdb51000 100644
--- a/src/dbus-hci.h
+++ b/src/dbus-hci.h
@@ -58,6 +58,8 @@ int set_limited_discoverable(int dd, const uint8_t *cls, gboolean limited);
int set_service_classes(int dd, const uint8_t *cls, uint8_t value);
int set_major_class(int dd, const uint8_t *cls, uint8_t major);
int set_minor_class(int dd, const uint8_t *cls, uint8_t minor);
+int set_major_and_minor_class(int dd, const uint8_t *cls,
+ uint8_t major, uint8_t minor);
const char *class_to_icon(uint32_t class);