diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2021-03-31 13:58:39 +0200 |
---|---|---|
committer | Hans Ulrich Niedermann <github@n-dimensional.de> | 2021-04-01 20:07:08 +0200 |
commit | 4316f75ed4ce7a4ae5296264699665631c4e62d6 (patch) | |
tree | 47ac144172d161092c91b313d9eab907d3b65e61 /packaging | |
parent | 84ddc4ec3b44bf81fbda16ca006cc27e1d345b41 (diff) | |
download | libgphoto2-4316f75ed4ce7a4ae5296264699665631c4e62d6.tar.gz |
Remove obsolete gp2ddb (gphoto2 device database) idea
The gphoto2 device database (gp2ddb) was originally intended to
replace the device lists in the camlib code by a device list
maintained in a text file outside of the camlib C code.
This device list file could then be changed without
recompiling camlibs, at the cost of adding a simple gp2ddb
to internal binary representation compiler to libgphoto2.
This would have allowed a user to very easily add a new camera
model to the list of camera models supported by a specific
camlib, as long as that new camera model uses the same
protocol as already supported camera models do.
As the gp2ddb idea has never been developed any further in the
15 yearns since my initial commit from 2006, this idea appears
to be obsolete and can thus be removed from the codebase.
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/generic/print-camera-list.c | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/packaging/generic/print-camera-list.c b/packaging/generic/print-camera-list.c index babc9dd8d..744da1f84 100644 --- a/packaging/generic/print-camera-list.c +++ b/packaging/generic/print-camera-list.c @@ -836,170 +836,6 @@ empty_end_func (const func_params_t *params, void *data) } - -#ifdef ENABLED_GP2DDB - -static int -ddb_begin_func (const func_params_t *params, void **data) -{ - printf("# Beginning of gphoto2 device database (PRE-ALPHA format!)\n\n"); - print_version_comment(stdout, "# ", "\n", NULL, "\n"); - return 0; -} - - -static int -ddb_end_func (const func_params_t *params, void *data) -{ - printf("# End of gphoto2 device database (PRE-ALPHA format!).\n"); - return 0; -} - - -static void -ddb_list_out_func(const char *str, void *data) -{ - int *first = (int *)data; - printf("%s %s", (*first)?"":",", str); - *first = 0; -} - - -static void -ddb_delayed_head(const func_params_t *params, - const int i, - const int total, - const CameraAbilities *a, - const char *camlib_basename) -{ - int first = 1; - printf("# This is a PRE-ALPHA data format. Do not use it.\n\n"); - - if (params->add_comments) { - printf ("# %s\n", a->model); - } - - printf("# automatically generated camera record %d/%d\n", i+1, total); - printf("device \"%s\" {\n", a->model); - - printf(" device_type"); - printf(" %s;\n", gpi_enum_to_string(a->device_type, - gpi_gphoto_device_type_map); - - printf(" driver \"%s\";\n", camlib_basename); - - printf(" driver_status"); - printf(" %s;\n", gpi_enum_to_string(a->status, - gpi_camera_driver_status_map); - - printf(" operations"); - first = 1; - gpi_flags_to_string_list(a->operations, - gpi_camera_operation_map, - ddb_list_out_func, - (void *) &first); - printf(";\n"); - - printf(" file_operations"); - first = 1; - gpi_flags_to_string_list(a->file_operations, - gpi_file_operation_map, - ddb_list_out_func, - (void *) &first); - printf(";\n"); - - printf(" folder_operations"); - first = 1; - gpi_flags_to_string_list(a->folder_operations, - gpi_folder_operation_map, - ddb_list_out_func, - (void *) &first); - printf(";\n"); -} - - -static int -ddb_camera_func (const func_params_t *params, - const int i, - const int total, - const CameraAbilities *a, - void *data) -{ - const char *camlib_basename = path_basename(a->library); - int head_printed = 0; -#define DELAYED_HEAD() \ - do { \ - if (!head_printed) { \ - ddb_delayed_head(params, i, total, \ - a, camlib_basename); \ - head_printed = 1; \ - } \ - } while (0) - - if ((a->port & GP_PORT_SERIAL)) { - int first = 1; - DELAYED_HEAD(); - printf(" interface serial {\n"); - if (a->speed[0] != 0) { - unsigned int i; - printf(" speeds"); - for (i=0; - ((i < (sizeof(a->speed)/sizeof(a->speed[0]))) && - (a->speed[i] != 0)); i++) { - printf("%s %d", (first)?"":",", a->speed[i]); - first = 0; - } - printf(";\n"); - } - printf(" };\n"); - } - - if ((a->port & GP_PORT_USB)) { - if (a->usb_vendor) { - /* usb product id may have the legal value zero! */ - DELAYED_HEAD(); - printf(" interface usb {\n"); - printf(" vendor 0x%04x;\n", a->usb_vendor); - printf(" product 0x%04x;\n", a->usb_product); - printf(" };\n"); - } - if ((a->usb_class) && (a->usb_class != 666)) { - DELAYED_HEAD(); - printf(" interface usb {\n"); - printf(" class 0x%02x;\n", a->usb_class); - if (a->usb_subclass != -1) { - printf(" subclass 0x%02x;\n", a->usb_subclass); - } - if (a->usb_protocol != -1) { - printf(" protocol 0x%02x;\n", a->usb_protocol); - } - printf(" };\n"); - } - } - if ((a->port & GP_PORT_DISK)) { - DELAYED_HEAD(); - printf(" interface disk;\n"); - } - if ((a->port & GP_PORT_PTPIP)) { - DELAYED_HEAD(); - printf(" interface ptpip;\n"); - } -#undef DELAYED_HEAD - - if (head_printed) { - printf(" # driver_options {\n"); - printf(" # option \"foo\";\n"); - printf(" # option \"bar\" \"bla\";\n"); - printf(" # };\n"); - - printf("}; # %s\n\n", a->model); - } - return 0; -} - -#endif /* ENABLED_GP2DDB */ - - /* print_fdi_map * * Print FDI Device Information file for HAL with information on @@ -1615,18 +1451,6 @@ static const output_format_t formats[] = { NULL, empty_end_func }, -#ifdef ENABLED_GP2DDB - {"gp2ddb", - "gphoto2 device database (PRE-ALPHA)", - "PRE-ALPHA test stage, do not use for production! Machine parseable.", - NULL, - ddb_begin_func, - ddb_camera_func, - NULL, - NULL, - ddb_end_func - }, -#endif {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} }; |