diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-10-18 07:36:47 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-10-18 07:36:47 +0200 |
commit | fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b (patch) | |
tree | 80f82fdbeaf8d2f94c5a1a48ea28a5e452b561f5 /pcilib/property.c | |
parent | 6a4a556b15bda7e0c737f247c8282c1b3a9d1e0d (diff) | |
download | pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.gz pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.bz2 pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.tar.xz pcitool-fa54d4c2ca8ffcece7a9c6e9c784e2150cbed78b.zip |
Support reading/writting register views by id
Diffstat (limited to 'pcilib/property.c')
-rw-r--r-- | pcilib/property.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pcilib/property.c b/pcilib/property.c index 1db6dd3..276360a 100644 --- a/pcilib/property.c +++ b/pcilib/property.c @@ -206,3 +206,17 @@ int pcilib_get_property(pcilib_t *ctx, const char *prop, pcilib_value_t *val) { int pcilib_set_property(pcilib_t *ctx, const char *prop, const pcilib_value_t *val) { return pcilib_write_register_view(ctx, NULL, NULL, prop, val); } + +int pcilib_get_property_attr(pcilib_t *ctx, const char *prop, const char *attr, pcilib_value_t *val) { + pcilib_view_context_t *view_ctx; + + view_ctx = pcilib_find_view_context_by_name(ctx, prop); + if (!view_ctx) { + pcilib_error("The specified property (%s) is not found", prop); + return PCILIB_ERROR_NOTFOUND; + } + + if (!view_ctx->xml) return NULL; + + return pcilib_get_xml_attr(ctx, view_ctx->xml, attr, val); +} |