Skip to content

Commit

Permalink
Make device discovery API consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Dec 22, 2024
1 parent f6cc36b commit 6a286a4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
5 changes: 0 additions & 5 deletions analyzer/device/facade.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,6 @@ SU_GETTER(

existing = node->data;

/* We have the device BUT it we didn't see it in the last discovery */
/* TODO: Add methods for accessing these */
if (existing->epoch + 1 < existing->discovery->epoch)
goto done;

SU_TRY(props = suscan_device_properties_dup(existing));

done:
Expand Down
7 changes: 1 addition & 6 deletions analyzer/device/spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,15 @@ SU_GETTER(suscan_device_spec, struct suscan_device_properties *, properties)

if (self->uuid == SUSCAN_DEVICE_UUID_INVALID)
mutable->uuid = suscan_device_spec_uuid(self);

SU_INFO("Self UUID: 0x%016llx\n", self->uuid);

epoch = suscan_device_facade_get_epoch_for_uuid(facade, self->uuid);

/* Properties are up to date */
if (mutable->properties != NULL && self->properties->epoch == epoch)
goto done;

/* Changes found, discard current version */
if (self->properties != NULL) {
SU_INFO("Found properties, discarding...\n");
SU_DISPOSE(suscan_device_properties, self->properties);
mutable->properties = NULL;
}
Expand All @@ -241,8 +238,6 @@ SU_GETTER(suscan_device_spec, struct suscan_device_properties *, properties)
if (self->epoch <= epoch) {
mutable->properties = suscan_device_facade_get_properties(facade, self);
mutable->epoch = epoch;
} else {
SU_INFO("Discarding properties. Self epoch is %d, curr epoch is %d\n", self->epoch, epoch);
}

done:
Expand Down

0 comments on commit 6a286a4

Please sign in to comment.