diff --git a/airscan-device.c b/airscan-device.c index 60d0be1..04919bc 100644 --- a/airscan-device.c +++ b/airscan-device.c @@ -215,6 +215,7 @@ device_new (zeroconf_devinfo *devinfo) log_debug(dev->log, "device created"); dev->proto_ctx.log = dev->log; + dev->proto_ctx.devinfo = dev->devinfo; dev->proto_ctx.devcaps = &dev->opt.caps; devopt_init(&dev->opt); diff --git a/airscan-zeroconf.c b/airscan-zeroconf.c index 2095021..a77a19c 100644 --- a/airscan-zeroconf.c +++ b/airscan-zeroconf.c @@ -1304,7 +1304,9 @@ zeroconf_parse_devinfo_from_ident(const char *ident) devinfo = mem_new(zeroconf_devinfo, 1); devinfo->ident = str_dup(ident); devinfo->name = str_dup(name); + devinfo->model = str_dup(""); devinfo->endpoints = zeroconf_endpoint_new(proto, uri); + return devinfo; } @@ -1349,9 +1351,11 @@ zeroconf_devinfo_lookup (const char *ident) if (dev_conf != NULL) { http_uri *uri = http_uri_clone(dev_conf->uri); devinfo->name = str_dup(dev_conf->name); + devinfo->model = str_dup(""); devinfo->endpoints = zeroconf_endpoint_new(dev_conf->proto, uri); } else { devinfo->name = str_dup(zeroconf_device_name(device)); + devinfo->model = str_dup(device->model ? device->model : ""); devinfo->endpoints = zeroconf_device_endpoints(device, proto); } @@ -1365,6 +1369,7 @@ zeroconf_devinfo_free (zeroconf_devinfo *devinfo) { mem_free((char*) devinfo->ident); mem_free((char*) devinfo->name); + mem_free((char*) devinfo->model); zeroconf_endpoint_list_free(devinfo->endpoints); mem_free(devinfo); } diff --git a/airscan.h b/airscan.h index 173e6f5..9c2fe66 100644 --- a/airscan.h +++ b/airscan.h @@ -2892,6 +2892,7 @@ zeroconf_finding_done (ZEROCONF_METHOD method); typedef struct { const char *ident; /* Unique ident */ const char *name; /* Human-friendly name */ + const char *model; /* Model name, for quirks. "" if unknown */ zeroconf_endpoint *endpoints; /* Device endpoints */ } zeroconf_devinfo; @@ -3248,6 +3249,7 @@ typedef struct { /* Common context */ log_ctx *log; /* Logging context */ struct proto_handler *proto; /* Link to proto_handler */ + const zeroconf_devinfo *devinfo; /* Device info, from zeroconf */ const devcaps *devcaps; /* Device capabilities */ PROTO_OP op; /* Current operation */ http_client *http; /* HTTP client for sending requests */