From b331c5aeafa41bf16c28e616cbea5ed67b4a9f69 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 1 Jul 2019 08:34:33 +0200 Subject: rename GP_PORT_TCP -> GP_PORT_IP as we just use it specify an IP, regardless of what the driver does --- camlibs/lumix/lumix.c | 16 +++++----------- libgphoto2_port/gphoto2/gphoto2-port-info-list.h | 2 +- libgphoto2_port/ptpip/ptpip.c | 10 +++++----- libgphoto2_port/test/test-port-list.c | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/camlibs/lumix/lumix.c b/camlibs/lumix/lumix.c index 36606f0f4..5442b78d5 100644 --- a/camlibs/lumix/lumix.c +++ b/camlibs/lumix/lumix.c @@ -134,7 +134,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context) struct sockaddr_in serv_addr; unsigned char buffer[65536]; GPPortInfo info; - char *xpath; int i, start, end, tries; switchToRecMode (camera); @@ -149,7 +148,6 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context) } gp_port_get_info (camera->port, &info); - gp_port_info_get_path (info, &xpath); /* xpath now contains tcp:192.168.1.1 */ memset(&serv_addr, 0, sizeof(serv_addr)); @@ -411,8 +409,8 @@ loadCmd (Camera *camera,char* cmd) { curl = curl_easy_init(); gp_port_get_info (camera->port, &info); - gp_port_info_get_path (info, &xpath); /* xpath now contains tcp:192.168.1.1 */ - snprintf( URL,100, "http://%s/%s", xpath+4, cmd); + gp_port_info_get_path (info, &xpath); /* xpath now contains ip:192.168.1.1 */ + snprintf( URL,100, "http://%s/%s", xpath+strlen("ip:"), cmd); GP_LOG_D("cam url is %s", URL); curl_easy_setopt(curl, CURLOPT_URL, URL); @@ -772,8 +770,8 @@ GetPixRange(Camera *camera, int start, int num) { list = curl_slist_append(list, "Accept: text/xml"); gp_port_get_info (camera->port, &info); - gp_port_info_get_path (info, &xpath); /* xpath now contains tcp:192.168.1.1 */ - snprintf( URL, 1000, "http://%s%s",xpath+4, CDS_Control); + gp_port_info_get_path (info, &xpath); /* xpath now contains ip:192.168.1.1 */ + snprintf( URL, 1000, "http://%s%s",xpath+strlen("ip:"), CDS_Control); curl_easy_setopt(curl, CURLOPT_URL, URL); lmb.size = 0; @@ -1758,7 +1756,7 @@ int camera_abilities (CameraAbilitiesList *list) { memset(&a, 0, sizeof(a)); strcpy(a.model, "Panasonic:LumixGSeries"); a.status = GP_DRIVER_STATUS_EXPERIMENTAL; - a.port = GP_PORT_TCP; + a.port = GP_PORT_IP; a.operations = GP_CAPTURE_IMAGE| GP_OPERATION_CAPTURE_VIDEO | GP_OPERATION_CONFIG; a.file_operations = GP_FILE_OPERATION_PREVIEW ; /* it should be possible to browse and DL images the files using the ReadImageFromCamera() function but for now lets keep it simple*/ @@ -1799,7 +1797,6 @@ int camera_init (Camera *camera, GPContext *context) { GPPortInfo info; - char *xpath; int ret; camera->pl = calloc(sizeof(CameraPrivateLibrary),1); @@ -1823,9 +1820,6 @@ camera_init (Camera *camera, GPContext *context) GP_LOG_E ("Failed to get port info?"); return ret; } - gp_port_info_get_path (info, &xpath); - /* xpath now contains tcp:192.168.1.1 */ - gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); if (switchToRecMode (camera) != NULL) { diff --git a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h index eec6ceabe..fcb840b68 100644 --- a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h +++ b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h @@ -39,7 +39,7 @@ typedef enum { GP_PORT_PTPIP = 1 << 4, /**< \brief PTP/IP port. */ GP_PORT_USB_DISK_DIRECT = 1 << 5, /**< \brief Direct IO to an usb mass storage device. */ GP_PORT_USB_SCSI = 1 << 6, /**< \brief USB Mass Storage raw SCSI port. */ - GP_PORT_TCP = 1 << 7 /**< \brief generic TCP port. */ + GP_PORT_IP = 1 << 7 /**< \brief generic IP address port. */ } GPPortType; /** diff --git a/libgphoto2_port/ptpip/ptpip.c b/libgphoto2_port/ptpip/ptpip.c index 225419a9d..20947d805 100644 --- a/libgphoto2_port/ptpip/ptpip.c +++ b/libgphoto2_port/ptpip/ptpip.c @@ -186,16 +186,16 @@ gp_port_library_list (GPPortInfoList *list) gp_port_info_list_append (list, info); /* do not check return */ gp_port_info_new (&info); - gp_port_info_set_type (info, GP_PORT_TCP); - gp_port_info_set_name (info, _("TCP Connection")); - gp_port_info_set_path (info, "tcp:"); + gp_port_info_set_type (info, GP_PORT_IP); + gp_port_info_set_name (info, _("IP Connection")); + gp_port_info_set_path (info, "ip:"); CHECK (gp_port_info_list_append (list, info)); /* Generic matcher so you can pass any IP address */ gp_port_info_new (&info); - gp_port_info_set_type (info, GP_PORT_TCP); + gp_port_info_set_type (info, GP_PORT_IP); gp_port_info_set_name (info, ""); - gp_port_info_set_path (info, "^tcp:"); + gp_port_info_set_path (info, "^ip:"); gp_port_info_list_append (list, info); /* do not check return */ #ifdef HAVE_MDNS_BONJOUR ret = DNSServiceBrowse ( diff --git a/libgphoto2_port/test/test-port-list.c b/libgphoto2_port/test/test-port-list.c index 10c3ecdd0..4da17af58 100644 --- a/libgphoto2_port/test/test-port-list.c +++ b/libgphoto2_port/test/test-port-list.c @@ -107,7 +107,7 @@ run_test () case GP_PORT_USB_SCSI: port_type_str = "USBSCSI"; break; case GP_PORT_DISK: port_type_str = "DISK"; break; case GP_PORT_PTPIP: port_type_str = "PTPIP"; break; - case GP_PORT_TCP: port_type_str = "TCP"; break; + case GP_PORT_IP: port_type_str = "IP"; break; default: port_type_str = "UNKNOWN"; return 3; break; } printf ("No: %d\n" -- cgit v1.2.1