summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-09-29 13:08:25 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-09-29 13:08:25 +0200
commit961afe82147a17a6eabafc8d2b000a1d98b2286d (patch)
tree2eb01278faaa5e72bd3c68b30b53fb54201e29a8 /plugins
parent6822f03fb6c77fffc66e8f333f9878e7d5de8041 (diff)
Read the class of device before setting a new one
Diffstat (limited to 'plugins')
-rw-r--r--plugins/hal.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/hal.c b/plugins/hal.c
index 130c76de..1adab4d8 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);