diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-09-29 13:08:25 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-09-29 13:08:25 +0200 |
commit | 961afe82147a17a6eabafc8d2b000a1d98b2286d (patch) | |
tree | 2eb01278faaa5e72bd3c68b30b53fb54201e29a8 /plugins/hal.c | |
parent | 6822f03fb6c77fffc66e8f333f9878e7d5de8041 (diff) | |
download | bluez-961afe82147a17a6eabafc8d2b000a1d98b2286d.tar.gz |
Read the class of device before setting a new one
Diffstat (limited to 'plugins/hal.c')
-rw-r--r-- | plugins/hal.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/hal.c b/plugins/hal.c index 130c76def..1adab4d8d 100644 --- a/plugins/hal.c +++ b/plugins/hal.c @@ -66,16 +66,18 @@ static void formfactor_reply(DBusPendingCall *call, void *user_data) minor += 1 << 4; } - if (adapter_get_class(adapter, cls) < 0) + dd = hci_open_dev(adapter_get_dev_id(adapter)); + if (dd < 0) return; + if (hci_read_class_of_dev(dd, cls, 500) < 0) { + hci_close_dev(dd); + return; + } + debug("Current device class is 0x%02x%02x%02x\n", cls[2], cls[1], cls[0]); - dd = hci_open_dev(adapter_get_dev_id(adapter)); - if (dd < 0) - return; - /* Computer major class */ debug("Setting 0x%06x for major/minor device class", (1 << 8) | minor); |