From 961afe82147a17a6eabafc8d2b000a1d98b2286d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 29 Sep 2008 13:08:25 +0200 Subject: Read the class of device before setting a new one --- plugins/hal.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins') 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); -- cgit