summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-11-14 02:17:58 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-11-14 02:17:58 +0000
commit5ac3c1ef76b8d1640bad9a21b74b197a82111874 (patch)
tree79534ea0d8483a5a35e8f09dc746c07230647b4e /hcid
parente0cbfd7cc76db2b084c1218408e71838d3c4e3b0 (diff)
Inherit the device specific options from the default
Diffstat (limited to 'hcid')
-rw-r--r--hcid/hcid.h2
-rw-r--r--hcid/main.c4
-rw-r--r--hcid/parser.y2
3 files changed, 5 insertions, 3 deletions
diff --git a/hcid/hcid.h b/hcid/hcid.h
index a5074ffa..87875beb 100644
--- a/hcid/hcid.h
+++ b/hcid/hcid.h
@@ -97,7 +97,7 @@ extern struct hcid_opts hcid;
int read_config(char *file);
-struct device_opts *alloc_device_opts(char *addr);
+struct device_opts *alloc_device_opts(char *ref);
gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data);
gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data);
diff --git a/hcid/main.c b/hcid/main.c
index 5763798c..fbc85a5c 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -78,6 +78,7 @@ static inline void init_device_defaults(struct device_opts *device_opts)
{
memset(device_opts, 0, sizeof(*device_opts));
device_opts->scan = SCAN_PAGE | SCAN_INQUIRY;
+ device_opts->name = strdup("BlueZ");
}
struct device_opts *alloc_device_opts(char *ref)
@@ -95,7 +96,8 @@ struct device_opts *alloc_device_opts(char *ref)
device->next = device_list;
device_list = device;
- init_device_defaults(&device->opts);
+ memcpy(&device->opts, &default_device, sizeof(struct device_opts));
+ device->opts.name = strdup(default_device.name);
return &device->opts;
}
diff --git a/hcid/parser.y b/hcid/parser.y
index eb81ab22..7c33278e 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -183,7 +183,7 @@ device_opt:
| K_NAME dev_name {
if (parser_device->name)
free(parser_device->name);
- parser_device->name = $2;
+ parser_device->name = strdup($2);
}
| K_CLASS NUM {