diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-02-25 01:27:58 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-02-25 01:27:58 +0000 |
commit | c1204af6f455fb03e321f67e8602be01e1c1382f (patch) | |
tree | e4b1f6bacb0ffd53a99cf2dafe1d7f7e31cdea76 /hcid/dbus-device.c | |
parent | eee51867fc0adcc623a3ee96919ebb404260ae7e (diff) |
Add support for remote manufacturer information
Diffstat (limited to 'hcid/dbus-device.c')
-rw-r--r-- | hcid/dbus-device.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/hcid/dbus-device.c b/hcid/dbus-device.c index c19b26d1..069875fc 100644 --- a/hcid/dbus-device.c +++ b/hcid/dbus-device.c @@ -574,8 +574,36 @@ static DBusMessage *handle_dev_get_remote_revision_req(DBusMessage *msg, void *d static DBusMessage *handle_dev_get_remote_manufacturer_req(DBusMessage *msg, void *data) { - /*FIXME: */ - return bluez_new_failure_msg(msg, BLUEZ_EDBUS_NOT_IMPLEMENTED); + struct hci_dbus_data *dbus_data = data; + DBusMessageIter iter; + DBusMessage *reply; + char filename[PATH_MAX + 1]; + char addr[18], *addr_ptr, *str; + int compid; + + get_device_address(dbus_data->dev_id, addr, sizeof(addr)); + + snprintf(filename, PATH_MAX, "%s/%s/manufacturers", STORAGEDIR, addr); + + dbus_message_iter_init(msg, &iter); + dbus_message_iter_get_basic(&iter, &addr_ptr); + + str = textfile_get(filename, addr_ptr); + if (!str) + return bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | ENXIO); + + reply = dbus_message_new_method_return(msg); + + compid = atoi(str); + + free(str); + + str = bt_compidtostr(compid); + + dbus_message_append_args(reply, DBUS_TYPE_STRING, &str, + DBUS_TYPE_INVALID); + + return reply; } static DBusMessage *handle_dev_get_remote_company_req(DBusMessage *msg, void *data) |