diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2008-03-16 14:32:07 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2008-03-16 14:32:07 +0000 |
commit | 3d70cbeee615082e5d3b066e2752e8088e09d033 (patch) | |
tree | 6460f7515403cb80afae7ef2de1118053f85d95e | |
parent | 8432909fcd004602f3a0aafcbc7cf3d47e01e629 (diff) | |
download | libgphoto2-3d70cbeee615082e5d3b066e2752e8088e09d033.tar.gz |
backported from TRUNK
- Disabled 0x109 olympus id for HAL
- info.bus now called info.subsystem by HAL FDI rules
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@10997 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | packaging/generic/print-camera-list.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/packaging/generic/print-camera-list.c b/packaging/generic/print-camera-list.c index 76336a7ef..7c7732db9 100644 --- a/packaging/generic/print-camera-list.c +++ b/packaging/generic/print-camera-list.c @@ -70,6 +70,8 @@ typedef struct { GPVersionFunc version_func; } module_version; + + const module_version module_versions[] = { { "libgphoto2", gp_library_version }, { "libgphoto2_port", gp_port_library_version }, @@ -382,14 +384,31 @@ typedef struct { char *owner; char *group; char *script; - char *begin_string; - char *usbcam_string; + const char *begin_string; + const char *usbcam_string; } udev_persistent_data_t; static void udev_parse_params (const func_params_t *params, void **data) { + /* Note: 2 lines because we need to use || ... having them on the same + * line would mean &&. + */ + static const char * const begin_strings[] = { + /* UDEV_PRE_0_98 */ + "BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n" + "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n", + /* UDEV_0_98 */ + "SUBSYSTEM!=\"usb|usb_device\", GOTO=\"libgphoto2_rules_end\"\n" + "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n" + }; + static const char * const usbcam_strings[] = { + /* UDEV_PRE_0_98 */ + "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ", + /* UDEV_0_98 */ + "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ", + }; udev_persistent_data_t *pdata; pdata = calloc(1, sizeof(udev_persistent_data_t)); pdata->version = UDEV_0_98; @@ -436,37 +455,12 @@ udev_parse_params (const func_params_t *params, void **data) FATAL("The <script> parameter conflicts with the <mode,group,owner> parameters."); } - /* Note: 2 lines because we need to use || ... having them on the same - * line would mean &&. - */ - static char *begin_strings[] = { - /* UDEV_PRE_0_98 */ - "BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n" - "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n", - /* UDEV_0_98 */ - "SUBSYSTEM!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n" - "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n" - }; - static char *usbcam_strings[] = { - /* UDEV_PRE_0_98 */ - "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ", - /* UDEV_0_98 */ - "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ", - }; pdata->begin_string = begin_strings[pdata->version]; pdata->usbcam_string = usbcam_strings[pdata->version]; } -static void -version_str_func(const char *str, void *data) -{ - const char **foo = (const char **)data; - fprintf(stdout, "V[%s]", str); - fflush(stdout); - *foo = str; -} -static inline const char * +static const char * get_version_str(udev_version_t version) { return gpi_enum_to_string(version, udev_version_t_map); @@ -798,7 +792,7 @@ fdi_begin_func (const func_params_t *params, void **data) print_version_comment(stdout, " | ", "\n", "<!--+\n", " +-->\n"); printf("<deviceinfo version=\"0.2\">\n"); printf(" <device>\n"); - printf(" <match key=\"info.bus\" string=\"usb\">\n"); + printf(" <match key=\"info.subsystem\" string=\"usb\">\n"); return 0; } @@ -829,7 +823,7 @@ fdi_camera_func (const func_params_t *params, *d = '\0'; if ((a->port & GP_PORT_USB)) { - if (a->usb_vendor == 0x07b4 && a->usb_product == 0x105) { + if (a->usb_vendor == 0x07b4 && (a->usb_product == 0x105 || a->usb_product == 0x109) ) { /* Marcus says: The Olympus Sierra/Storage dual mode camera firmware. * Some HAL using software gets deeply confused by this being here * and also detected as mass storage elsewhere, so blacklist @@ -917,7 +911,7 @@ fdi_device_begin_func (const func_params_t *params, void **data) print_version_comment(stdout, " | ", "\n", "<!--+\n", " +-->\n"); printf("<deviceinfo version=\"0.2\">\n"); printf(" <device>\n"); - printf(" <match key=\"info.bus\" string=\"usb\">\n"); + printf(" <match key=\"info.subsystem\" string=\"usb\">\n"); return 0; } @@ -949,7 +943,7 @@ fdi_device_camera_func (const func_params_t *params, if ((a->port & GP_PORT_USB)) { - if (a->usb_vendor == 0x07b4 && a->usb_product == 0x105) { + if (a->usb_vendor == 0x07b4 && (a->usb_product == 0x105 || a->usb_product == 0x109)) { /* Marcus says: The Olympus Sierra/Storage dual mode camera firmware. * Some HAL using software gets deeply confused by this being here * and also detected as mass storage elsewhere, so blacklist |