forked from pool/libgphoto2
quilt refreshed with latest 2.4 libusb1 fixes
OBS-URL: https://build.opensuse.org/package/show/graphics/libgphoto2?expand=0&rev=76
This commit is contained in:
parent
9458e59200
commit
0f688358b6
@ -1,7 +1,8 @@
|
|||||||
diff -ru ./camlibs/canon/canon.c /home/marcus/projects/libgphoto2-2_4/libgphoto2/camlibs/canon/canon.c
|
Index: camlibs/canon/canon.c
|
||||||
--- camlibs/canon/canon.c 2012-03-30 23:23:47.000000000 +0200
|
===================================================================
|
||||||
+++ camlibs/canon/canon.c 2012-07-19 20:19:15.693782425 +0200
|
--- camlibs/canon/canon.c.orig
|
||||||
@@ -1333,8 +1333,7 @@
|
+++ camlibs/canon/canon.c
|
||||||
|
@@ -1333,8 +1333,7 @@ void canon_int_find_new_image ( Camera *
|
||||||
if ( is_image ( new_name ) ) {
|
if ( is_image ( new_name ) ) {
|
||||||
/* Yup, we'll assume that this is the new image. */
|
/* Yup, we'll assume that this is the new image. */
|
||||||
GP_DEBUG ( " Found our new image file" );
|
GP_DEBUG ( " Found our new image file" );
|
||||||
@ -11,10 +12,11 @@ diff -ru ./camlibs/canon/canon.c /home/marcus/projects/libgphoto2-2_4/libgphoto2
|
|||||||
strcpy ( path->folder, canon2gphotopath ( camera, path->folder ) );
|
strcpy ( path->folder, canon2gphotopath ( camera, path->folder ) );
|
||||||
|
|
||||||
/* FIXME: Marcus: make it less large effort... */
|
/* FIXME: Marcus: make it less large effort... */
|
||||||
diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto2/camlibs/ptp2/library.c
|
Index: camlibs/ptp2/library.c
|
||||||
--- camlibs/ptp2/library.c 2012-04-15 17:11:15.000000000 +0200
|
===================================================================
|
||||||
+++ camlibs/ptp2/library.c 2012-07-19 20:19:15.686782359 +0200
|
--- camlibs/ptp2/library.c.orig
|
||||||
@@ -715,7 +715,7 @@
|
+++ camlibs/ptp2/library.c
|
||||||
|
@@ -715,7 +715,7 @@ static struct {
|
||||||
{"Nikon:Coolpix L110 (PTP mode)", 0x04b0, 0x017e, PTP_CAP},
|
{"Nikon:Coolpix L110 (PTP mode)", 0x04b0, 0x017e, PTP_CAP},
|
||||||
|
|
||||||
/* miguel@rozsas.eng.br */
|
/* miguel@rozsas.eng.br */
|
||||||
@ -23,7 +25,7 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
/* Graeme Wyatt <graeme.wyatt@nookawarra.com> */
|
/* Graeme Wyatt <graeme.wyatt@nookawarra.com> */
|
||||||
{"Nikon:Coolpix L120 (PTP mode)", 0x04b0, 0x0185, PTP_CAP},
|
{"Nikon:Coolpix L120 (PTP mode)", 0x04b0, 0x0185, PTP_CAP},
|
||||||
/* Kévin Ottens <ervin@ipsquad.net> */
|
/* Kévin Ottens <ervin@ipsquad.net> */
|
||||||
@@ -740,6 +740,8 @@
|
@@ -740,6 +740,8 @@ static struct {
|
||||||
{"Nikon:Coolpix S8000 (PTP mode)",0x04b0, 0x021f, 0},
|
{"Nikon:Coolpix S8000 (PTP mode)",0x04b0, 0x021f, 0},
|
||||||
/* Aleksej Serdjukov <deletesoftware@yandex.ru> */
|
/* Aleksej Serdjukov <deletesoftware@yandex.ru> */
|
||||||
{"Nikon:Coolpix S5100 (PTP mode)",0x04b0, 0x0220, 0},
|
{"Nikon:Coolpix S5100 (PTP mode)",0x04b0, 0x0220, 0},
|
||||||
@ -32,7 +34,7 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
/* Nikon Coolpix 2000 */
|
/* Nikon Coolpix 2000 */
|
||||||
{"Nikon:Coolpix 2000 (PTP mode)", 0x04b0, 0x0302, 0},
|
{"Nikon:Coolpix 2000 (PTP mode)", 0x04b0, 0x0302, 0},
|
||||||
/* From IRC reporter. */
|
/* From IRC reporter. */
|
||||||
@@ -810,6 +812,11 @@
|
@@ -810,6 +812,11 @@ static struct {
|
||||||
/* IRC Reporter popolon */
|
/* IRC Reporter popolon */
|
||||||
{"Nikon:DSC D5100 (PTP mode)", 0x04b0, 0x0429, PTP_CAP|PTP_CAP_PREVIEW},
|
{"Nikon:DSC D5100 (PTP mode)", 0x04b0, 0x0429, PTP_CAP|PTP_CAP_PREVIEW},
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
#if 0
|
#if 0
|
||||||
/* Thomas Luzat <thomas.luzat@gmx.net> */
|
/* Thomas Luzat <thomas.luzat@gmx.net> */
|
||||||
/* this was reported as not working, mass storage only:
|
/* this was reported as not working, mass storage only:
|
||||||
@@ -1058,6 +1065,8 @@
|
@@ -1058,6 +1065,8 @@ static struct {
|
||||||
|
|
||||||
/* Martin Lasarsch at SUSE. MTP_PROPLIST returns just 0 entries */
|
/* Martin Lasarsch at SUSE. MTP_PROPLIST returns just 0 entries */
|
||||||
{"Canon:Digital IXUS 90 IS", 0x04a9, 0x3174, PTPBUG_DELETE_SENDS_EVENT},
|
{"Canon:Digital IXUS 90 IS", 0x04a9, 0x3174, PTPBUG_DELETE_SENDS_EVENT},
|
||||||
@ -53,7 +55,7 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
|
|
||||||
/* https://sourceforge.net/tracker/?func=detail&aid=2722422&group_id=8874&atid=358874 */
|
/* https://sourceforge.net/tracker/?func=detail&aid=2722422&group_id=8874&atid=358874 */
|
||||||
{"Canon:Digital IXUS 85 IS", 0x04a9, 0x3174, PTPBUG_DELETE_SENDS_EVENT},
|
{"Canon:Digital IXUS 85 IS", 0x04a9, 0x3174, PTPBUG_DELETE_SENDS_EVENT},
|
||||||
@@ -1289,6 +1298,9 @@
|
@@ -1289,6 +1298,9 @@ static struct {
|
||||||
{"Apple:iPod Touch 3rd Gen (PTP mode)", 0x05ac, 0x1299, 0},
|
{"Apple:iPod Touch 3rd Gen (PTP mode)", 0x05ac, 0x1299, 0},
|
||||||
{"Apple:iPad (PTP mode)", 0x05ac, 0x129a, 0},
|
{"Apple:iPad (PTP mode)", 0x05ac, 0x129a, 0},
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
/* https://sourceforge.net/tracker/index.php?func=detail&aid=1869653&group_id=158745&atid=809061 */
|
/* https://sourceforge.net/tracker/index.php?func=detail&aid=1869653&group_id=158745&atid=809061 */
|
||||||
{"Pioneer:DVR-LX60D", 0x08e4, 0x0142, 0},
|
{"Pioneer:DVR-LX60D", 0x08e4, 0x0142, 0},
|
||||||
|
|
||||||
@@ -4555,12 +4567,14 @@
|
@@ -4555,12 +4567,14 @@ get_file_func (CameraFilesystem *fs, con
|
||||||
unsigned char *ximage = NULL;
|
unsigned char *ximage = NULL;
|
||||||
unsigned int xlen = 0;
|
unsigned int xlen = 0;
|
||||||
|
|
||||||
@ -81,44 +83,346 @@ diff -ru ./camlibs/ptp2/library.c /home/marcus/projects/libgphoto2-2_4/libgphoto
|
|||||||
gp_log (GP_LOG_ERROR, "get_file_func/GP_FILE_TYPE_PREVIEW", "size mismatch %d vs %d", size, xlen);
|
gp_log (GP_LOG_ERROR, "get_file_func/GP_FILE_TYPE_PREVIEW", "size mismatch %d vs %d", size, xlen);
|
||||||
set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ThumbFormat);
|
set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ThumbFormat);
|
||||||
CR (gp_file_set_data_and_size (file, (char*)ximage, xlen));
|
CR (gp_file_set_data_and_size (file, (char*)ximage, xlen));
|
||||||
diff -ru ./libgphoto2_port/libusb1/libusb1.c /home/marcus/projects/libgphoto2-2_4/libgphoto2/libgphoto2_port/libusb1/libusb1.c
|
Index: libgphoto2_port/libusb1/libusb1.c
|
||||||
--- libgphoto2_port/libusb1/libusb1.c 2012-03-26 21:34:10.000000000 +0200
|
===================================================================
|
||||||
+++ libgphoto2_port/libusb1/libusb1.c 2012-07-19 20:05:50.066206830 +0200
|
--- libgphoto2_port/libusb1/libusb1.c.orig
|
||||||
@@ -119,6 +119,7 @@
|
+++ libgphoto2_port/libusb1/libusb1.c
|
||||||
|
@@ -71,6 +71,10 @@ struct _GPPortPrivateLibrary {
|
||||||
|
|
||||||
|
int detached;
|
||||||
|
|
||||||
|
+ time_t devslastchecked;
|
||||||
|
+ int nrofdevs;
|
||||||
|
+ struct libusb_device_descriptor *descs;
|
||||||
|
+ libusb_device **devs;
|
||||||
|
};
|
||||||
|
|
||||||
|
GPPortType
|
||||||
|
@@ -79,38 +83,34 @@ gp_port_library_type (void)
|
||||||
|
return (GP_PORT_USB);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static time_t gp_devslastchecked = 0;
|
||||||
|
-static int gp_nrofdevs = 0;
|
||||||
|
-static struct libusb_device_descriptor *gp_descs;
|
||||||
|
-static libusb_device **gp_devs;
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-load_devicelist (libusb_context *ctx) {
|
||||||
|
+load_devicelist (GPPortPrivateLibrary *pl) {
|
||||||
|
time_t xtime;
|
||||||
|
|
||||||
|
time(&xtime);
|
||||||
|
- if (xtime != gp_devslastchecked) {
|
||||||
|
- if (gp_nrofdevs)
|
||||||
|
- libusb_free_device_list (gp_devs, 1);
|
||||||
|
- free (gp_descs);
|
||||||
|
- gp_nrofdevs = 0;
|
||||||
|
- gp_devs = NULL;
|
||||||
|
- gp_descs = NULL;
|
||||||
|
+ if (xtime != pl->devslastchecked) {
|
||||||
|
+ if (pl->nrofdevs)
|
||||||
|
+ libusb_free_device_list (pl->devs, 1);
|
||||||
|
+ free (pl->descs);
|
||||||
|
+ pl->nrofdevs = 0;
|
||||||
|
+ pl->devs = NULL;
|
||||||
|
+ pl->descs = NULL;
|
||||||
|
}
|
||||||
|
- if (!gp_nrofdevs) {
|
||||||
|
+ if (!pl->nrofdevs) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- gp_nrofdevs = libusb_get_device_list (ctx, &gp_devs);
|
||||||
|
- gp_descs = malloc (sizeof(gp_descs[0])*gp_nrofdevs);
|
||||||
|
- for (i=0;i<gp_nrofdevs;i++) {
|
||||||
|
+ pl->nrofdevs = libusb_get_device_list (pl->ctx, &pl->devs);
|
||||||
|
+ pl->descs = malloc (sizeof(pl->descs[0])*pl->nrofdevs);
|
||||||
|
+ for (i=0;i<pl->nrofdevs;i++) {
|
||||||
|
int ret;
|
||||||
|
- ret = libusb_get_device_descriptor(gp_devs[i], &gp_descs[i]);
|
||||||
|
+ ret = libusb_get_device_descriptor(pl->devs[i], &pl->descs[i]);
|
||||||
|
if (ret)
|
||||||
|
gp_log (GP_LOG_ERROR, "libusb1", "libusb_get_device_descriptor(%d) returned %d", i, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- time (&gp_devslastchecked);
|
||||||
|
- return gp_nrofdevs;
|
||||||
|
+ time (&pl->devslastchecked);
|
||||||
|
+ return pl->nrofdevs;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
@@ -119,6 +119,10 @@ gp_port_library_list (GPPortInfoList *li
|
||||||
GPPortInfo info;
|
GPPortInfo info;
|
||||||
int nrofdevices = 0;
|
int nrofdevices = 0;
|
||||||
int d, i, i1, i2, unknownint;
|
int d, i, i1, i2, unknownint;
|
||||||
+ libusb_context *ctx;
|
+ libusb_context *ctx;
|
||||||
|
+ libusb_device **devs = NULL;
|
||||||
|
+ int nrofdevs = 0;
|
||||||
|
+ struct libusb_device_descriptor *descs;
|
||||||
|
|
||||||
/* generic matcher. This will catch passed XXX,YYY entries for instance. */
|
/* generic matcher. This will catch passed XXX,YYY entries for instance. */
|
||||||
info.type = GP_PORT_USB;
|
info.type = GP_PORT_USB;
|
||||||
@@ -126,8 +127,8 @@
|
@@ -126,26 +130,33 @@ gp_port_library_list (GPPortInfoList *li
|
||||||
strcpy (info.path, "^usb:");
|
strcpy (info.path, "^usb:");
|
||||||
CHECK (gp_port_info_list_append (list, info));
|
CHECK (gp_port_info_list_append (list, info));
|
||||||
|
|
||||||
- libusb_init (NULL);
|
- libusb_init (NULL);
|
||||||
- gp_nrofdevs = load_devicelist (NULL);
|
- gp_nrofdevs = load_devicelist (NULL);
|
||||||
+ libusb_init (&ctx);
|
+ libusb_init (&ctx);
|
||||||
+ gp_nrofdevs = load_devicelist (ctx);
|
+ nrofdevs = libusb_get_device_list (ctx, &devs);
|
||||||
|
+ descs = malloc (sizeof(descs[0])*nrofdevs);
|
||||||
|
+ for (i=0;i<nrofdevs;i++) {
|
||||||
|
+ int ret;
|
||||||
|
+ ret = libusb_get_device_descriptor(devs[i], &descs[i]);
|
||||||
|
+ if (ret)
|
||||||
|
+ gp_log (GP_LOG_ERROR, "libusb1", "libusb_get_device_descriptor(%d) returned %d", i, ret);
|
||||||
|
+ }
|
||||||
|
|
||||||
for (d = 0; d < gp_nrofdevs; d++) {
|
- for (d = 0; d < gp_nrofdevs; d++) {
|
||||||
|
+ for (d = 0; d < nrofdevs; d++) {
|
||||||
/* Devices which are definitely not cameras. */
|
/* Devices which are definitely not cameras. */
|
||||||
@@ -239,7 +240,9 @@
|
- if ( (gp_descs[d].bDeviceClass == LIBUSB_CLASS_HUB) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_HID) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_PRINTER) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_COMM) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == 0xe0) /* wireless / bluetooth */
|
||||||
|
+ if ( (descs[d].bDeviceClass == LIBUSB_CLASS_HUB) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_HID) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_PRINTER) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_COMM) ||
|
||||||
|
+ (descs[d].bDeviceClass == 0xe0) /* wireless / bluetooth */
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
/* excepts HUBs, usually the interfaces have the classes, not
|
||||||
|
* the device */
|
||||||
|
unknownint = 0;
|
||||||
|
- for (i = 0; i < gp_descs[d].bNumConfigurations; i++) {
|
||||||
|
+ for (i = 0; i < descs[d].bNumConfigurations; i++) {
|
||||||
|
struct libusb_config_descriptor *config;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- ret = libusb_get_config_descriptor (gp_devs[d], i, &config);
|
||||||
|
+ ret = libusb_get_config_descriptor (devs[d], i, &config);
|
||||||
|
if (ret) {
|
||||||
|
unknownint++;
|
||||||
|
continue;
|
||||||
|
@@ -185,22 +196,22 @@ gp_port_library_list (GPPortInfoList *li
|
||||||
|
/* Redo the same bus/device walk, but now add the ports with usb:x,y notation,
|
||||||
|
* so we can address all USB devices.
|
||||||
|
*/
|
||||||
|
- for (d = 0; d < gp_nrofdevs; d++) {
|
||||||
|
+ for (d = 0; d < nrofdevs; d++) {
|
||||||
|
/* Devices which are definitely not cameras. */
|
||||||
|
- if ( (gp_descs[d].bDeviceClass == LIBUSB_CLASS_HUB) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_HID) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_PRINTER) ||
|
||||||
|
- (gp_descs[d].bDeviceClass == LIBUSB_CLASS_COMM)
|
||||||
|
+ if ( (descs[d].bDeviceClass == LIBUSB_CLASS_HUB) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_HID) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_PRINTER) ||
|
||||||
|
+ (descs[d].bDeviceClass == LIBUSB_CLASS_COMM)
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
/* excepts HUBs, usually the interfaces have the classes, not
|
||||||
|
* the device */
|
||||||
|
unknownint = 0;
|
||||||
|
- for (i = 0; i < gp_descs[d].bNumConfigurations; i++) {
|
||||||
|
+ for (i = 0; i < descs[d].bNumConfigurations; i++) {
|
||||||
|
struct libusb_config_descriptor *config;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- ret = libusb_get_config_descriptor (gp_devs[d], i, &config);
|
||||||
|
+ ret = libusb_get_config_descriptor (devs[d], i, &config);
|
||||||
|
if (ret) {
|
||||||
|
gp_log (GP_LOG_ERROR, "libusb1", "libusb_get_config_descriptor(%d) returned %d", d, ret);
|
||||||
|
unknownint++;
|
||||||
|
@@ -226,8 +237,8 @@ gp_port_library_list (GPPortInfoList *li
|
||||||
|
info.type = GP_PORT_USB;
|
||||||
|
strcpy (info.name, "Universal Serial Bus");
|
||||||
|
snprintf (info.path,sizeof(info.path), "usb:%03d,%03d",
|
||||||
|
- libusb_get_bus_number (gp_devs[d]),
|
||||||
|
- libusb_get_device_address (gp_devs[d])
|
||||||
|
+ libusb_get_bus_number (devs[d]),
|
||||||
|
+ libusb_get_device_address (devs[d])
|
||||||
|
);
|
||||||
|
CHECK (gp_port_info_list_append (list, info));
|
||||||
|
}
|
||||||
|
@@ -239,7 +250,7 @@ gp_port_library_list (GPPortInfoList *li
|
||||||
strcpy (info.path, "usb:");
|
strcpy (info.path, "usb:");
|
||||||
CHECK (gp_port_info_list_append (list, info));
|
CHECK (gp_port_info_list_append (list, info));
|
||||||
}
|
}
|
||||||
- libusb_exit (NULL);
|
- libusb_exit (NULL);
|
||||||
+ libusb_exit (ctx);
|
+ libusb_exit (ctx); /* should free all stuff above */
|
||||||
+ gp_nrofdevs = 0;
|
|
||||||
+ gp_devs = NULL;
|
|
||||||
return (GP_OK);
|
return (GP_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +276,6 @@
|
@@ -269,11 +280,10 @@ gp_port_usb_exit (GPPort *port)
|
||||||
|
{
|
||||||
|
if (port->pl) {
|
||||||
|
libusb_exit (port->pl->ctx);
|
||||||
|
+ free (port->pl->descs);
|
||||||
|
free (port->pl);
|
||||||
port->pl = NULL;
|
port->pl = NULL;
|
||||||
}
|
}
|
||||||
- if (gp_devs) libusb_free_device_list (gp_devs, 1);
|
- if (gp_devs) libusb_free_device_list (gp_devs, 1);
|
||||||
+ gp_devs = NULL; gp_nrofdevs = 0;
|
- free (gp_descs);
|
||||||
free (gp_descs);
|
|
||||||
return (GP_OK);
|
return (GP_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -744,6 +754,7 @@ gp_port_usb_find_device_lib(GPPort *port
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
int d, busnr = 0, devnr = 0;
|
||||||
|
+ GPPortPrivateLibrary *pl = port->pl;
|
||||||
|
|
||||||
|
if (!port)
|
||||||
|
return (GP_ERROR_BAD_PARAMETERS);
|
||||||
|
@@ -767,23 +778,23 @@ gp_port_usb_find_device_lib(GPPort *port
|
||||||
|
return GP_ERROR_BAD_PARAMETERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
- gp_nrofdevs = load_devicelist (port->pl->ctx);
|
||||||
|
+ pl->nrofdevs = load_devicelist (port->pl);
|
||||||
|
|
||||||
|
- for (d = 0; d < gp_nrofdevs; d++) {
|
||||||
|
+ for (d = 0; d < pl->nrofdevs; d++) {
|
||||||
|
struct libusb_config_descriptor *confdesc;
|
||||||
|
int ret;
|
||||||
|
int config = -1, interface = -1, altsetting = -1;
|
||||||
|
|
||||||
|
- if ((gp_descs[d].idVendor != idvendor) ||
|
||||||
|
- (gp_descs[d].idProduct != idproduct))
|
||||||
|
+ if ((pl->descs[d].idVendor != idvendor) ||
|
||||||
|
+ (pl->descs[d].idProduct != idproduct))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- if (busnr && (busnr != libusb_get_bus_number (gp_devs[d])))
|
||||||
|
+ if (busnr && (busnr != libusb_get_bus_number (pl->devs[d])))
|
||||||
|
continue;
|
||||||
|
- if (devnr && (devnr != libusb_get_device_address (gp_devs[d])))
|
||||||
|
+ if (devnr && (devnr != libusb_get_device_address (pl->devs[d])))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- port->pl->d = gp_devs[d];
|
||||||
|
+ port->pl->d = pl->devs[d];
|
||||||
|
|
||||||
|
gp_log (GP_LOG_VERBOSE, "libusb1",
|
||||||
|
"Looking for USB device "
|
||||||
|
@@ -791,9 +802,9 @@ gp_port_usb_find_device_lib(GPPort *port
|
||||||
|
idvendor, idproduct);
|
||||||
|
|
||||||
|
/* Use the first config, interface and altsetting we find */
|
||||||
|
- gp_port_usb_find_first_altsetting(gp_devs[d], &config, &interface, &altsetting);
|
||||||
|
+ gp_port_usb_find_first_altsetting(pl->devs[d], &config, &interface, &altsetting);
|
||||||
|
|
||||||
|
- ret = libusb_get_config_descriptor (gp_devs[d], config, &confdesc);
|
||||||
|
+ ret = libusb_get_config_descriptor (pl->devs[d], config, &confdesc);
|
||||||
|
if (ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
@@ -810,11 +821,11 @@ gp_port_usb_find_device_lib(GPPort *port
|
||||||
|
port->settings.usb.interface = confdesc->interface[interface].altsetting[altsetting].bInterfaceNumber;
|
||||||
|
port->settings.usb.altsetting = confdesc->interface[interface].altsetting[altsetting].bAlternateSetting;
|
||||||
|
|
||||||
|
- port->settings.usb.inep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
- port->settings.usb.outep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_OUT, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
- port->settings.usb.intep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_INTERRUPT);
|
||||||
|
+ port->settings.usb.inep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
+ port->settings.usb.outep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_OUT, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
+ port->settings.usb.intep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_INTERRUPT);
|
||||||
|
|
||||||
|
- port->settings.usb.maxpacketsize = libusb_get_max_packet_size (gp_devs[d], port->settings.usb.inep);
|
||||||
|
+ port->settings.usb.maxpacketsize = libusb_get_max_packet_size (pl->devs[d], port->settings.usb.inep);
|
||||||
|
gp_log (GP_LOG_VERBOSE, "libusb1",
|
||||||
|
"Detected defaults: config %d, "
|
||||||
|
"interface %d, altsetting %d, "
|
||||||
|
@@ -998,6 +1009,8 @@ gp_port_usb_match_device_by_class(struct
|
||||||
|
if (class == 666) /* Special hack for MTP devices with MS OS descriptors. */
|
||||||
|
return gp_port_usb_match_mtp_device (dev, configno, interfaceno, altsettingno);
|
||||||
|
|
||||||
|
+ ret = libusb_get_device_descriptor(dev, &desc);
|
||||||
|
+
|
||||||
|
if (desc.bDeviceClass == class &&
|
||||||
|
(subclass == -1 ||
|
||||||
|
desc.bDeviceSubClass == subclass) &&
|
||||||
|
@@ -1005,7 +1018,6 @@ gp_port_usb_match_device_by_class(struct
|
||||||
|
desc.bDeviceProtocol == protocol))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
- ret = libusb_get_device_descriptor(dev, &desc);
|
||||||
|
|
||||||
|
for (i = 0; i < desc.bNumConfigurations; i++) {
|
||||||
|
struct libusb_config_descriptor *config;
|
||||||
|
@@ -1045,6 +1057,7 @@ gp_port_usb_find_device_by_class_lib(GPP
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
int d, busnr = 0, devnr = 0;
|
||||||
|
+ GPPortPrivateLibrary *pl = port->pl;
|
||||||
|
|
||||||
|
if (!port)
|
||||||
|
return (GP_ERROR_BAD_PARAMETERS);
|
||||||
|
@@ -1065,14 +1078,14 @@ gp_port_usb_find_device_by_class_lib(GPP
|
||||||
|
if (!class)
|
||||||
|
return GP_ERROR_BAD_PARAMETERS;
|
||||||
|
|
||||||
|
- gp_nrofdevs = load_devicelist (port->pl->ctx);
|
||||||
|
- for (d = 0; d < gp_nrofdevs; d++) {
|
||||||
|
+ pl->nrofdevs = load_devicelist (port->pl);
|
||||||
|
+ for (d = 0; d < pl->nrofdevs; d++) {
|
||||||
|
struct libusb_config_descriptor *confdesc;
|
||||||
|
int i, ret, config = -1, interface = -1, altsetting = -1;
|
||||||
|
|
||||||
|
- if (busnr && (busnr != libusb_get_bus_number (gp_devs[d])))
|
||||||
|
+ if (busnr && (busnr != libusb_get_bus_number (pl->devs[d])))
|
||||||
|
continue;
|
||||||
|
- if (devnr && (devnr != libusb_get_device_address (gp_devs[d])))
|
||||||
|
+ if (devnr && (devnr != libusb_get_device_address (pl->devs[d])))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
gp_log (GP_LOG_VERBOSE, "gphoto2-port-usb",
|
||||||
|
@@ -1080,17 +1093,17 @@ gp_port_usb_find_device_by_class_lib(GPP
|
||||||
|
"(class 0x%x, subclass, 0x%x, protocol 0x%x)...",
|
||||||
|
class, subclass, protocol);
|
||||||
|
|
||||||
|
- ret = gp_port_usb_match_device_by_class(gp_devs[d], class, subclass, protocol, &config, &interface, &altsetting);
|
||||||
|
+ ret = gp_port_usb_match_device_by_class(pl->devs[d], class, subclass, protocol, &config, &interface, &altsetting);
|
||||||
|
if (!ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- port->pl->d = gp_devs[d];
|
||||||
|
+ port->pl->d = pl->devs[d];
|
||||||
|
gp_log (GP_LOG_VERBOSE, "libusb1",
|
||||||
|
"Found USB class device "
|
||||||
|
"(class 0x%x, subclass, 0x%x, protocol 0x%x)",
|
||||||
|
class, subclass, protocol);
|
||||||
|
|
||||||
|
- ret = libusb_get_config_descriptor (gp_devs[d], config, &confdesc);
|
||||||
|
+ ret = libusb_get_config_descriptor (pl->devs[d], config, &confdesc);
|
||||||
|
if (ret) continue;
|
||||||
|
|
||||||
|
/* Set the defaults */
|
||||||
|
@@ -1098,9 +1111,9 @@ gp_port_usb_find_device_by_class_lib(GPP
|
||||||
|
port->settings.usb.interface = confdesc->interface[interface].altsetting[altsetting].bInterfaceNumber;
|
||||||
|
port->settings.usb.altsetting = confdesc->interface[interface].altsetting[altsetting].bAlternateSetting;
|
||||||
|
|
||||||
|
- port->settings.usb.inep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
- port->settings.usb.outep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_OUT, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
- port->settings.usb.intep = gp_port_usb_find_ep(gp_devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_INTERRUPT);
|
||||||
|
+ port->settings.usb.inep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
+ port->settings.usb.outep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_OUT, LIBUSB_TRANSFER_TYPE_BULK);
|
||||||
|
+ port->settings.usb.intep = gp_port_usb_find_ep(pl->devs[d], config, interface, altsetting, LIBUSB_ENDPOINT_IN, LIBUSB_TRANSFER_TYPE_INTERRUPT);
|
||||||
|
port->settings.usb.maxpacketsize = 0;
|
||||||
|
gp_log (GP_LOG_DEBUG, "libusb1", "inep to look for is %02x", port->settings.usb.inep);
|
||||||
|
for (i=0;i<confdesc->interface[interface].altsetting[altsetting].bNumEndpoints;i++) {
|
||||||
|
@@ -1117,8 +1130,8 @@ gp_port_usb_find_device_by_class_lib(GPP
|
||||||
|
port->settings.usb.config,
|
||||||
|
port->settings.usb.interface,
|
||||||
|
port->settings.usb.altsetting,
|
||||||
|
- gp_descs[d].idVendor,
|
||||||
|
- gp_descs[d].idProduct,
|
||||||
|
+ pl->descs[d].idVendor,
|
||||||
|
+ pl->descs[d].idProduct,
|
||||||
|
port->settings.usb.inep,
|
||||||
|
port->settings.usb.outep,
|
||||||
|
port->settings.usb.intep
|
||||||
|
Loading…
Reference in New Issue
Block a user