diff options
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test/test.c b/test/test.c index 84df874..6537b6b 100644 --- a/test/test.c +++ b/test/test.c @@ -4,22 +4,30 @@ int main(int argc, char *argv[]) { - struct uca_t *uca = uca_init(); - if (uca == NULL) { - printf("Couldn't find a camera\n"); + if (argc < 2) { + printf("usage: uca <property-name>\n"); return 1; } + else { + int property = uca_get_property_id(argv[1]); + if (property == UCA_PROP_INVALID) { + printf("Property invalid!\n"); + return 1; + } - uint32_t width = 2560, height = 2160; + struct uca_t *uca = uca_init(); + if (uca == NULL) { + printf("Couldn't find a camera\n"); + return 1; + } - uca->cam_set_property(uca, UCA_PROP_WIDTH, &width); - uca->cam_set_property(uca, UCA_PROP_HEIGHT, &height); + uint32_t value; /* this type should be right, most of the time */ + if (uca->cam_get_property(uca, property, &value) == UCA_PROP_INVALID) + printf("Property not supported on this camera\n"); + else + printf("%s = %u\n", argv[1], value); - char camera_name[256] = "foobar"; - uca->cam_get_property(uca, UCA_PROP_NAME, camera_name); - - printf("Camera name: %s\n", camera_name); - - uca_destroy(uca); + uca_destroy(uca); + } return 0; } |