summaryrefslogtreecommitdiff
path: root/libgphoto2_port/usb
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2010-02-07 01:34:01 +0000
committerMarcus Meissner <marcus@jet.franken.de>2010-02-07 01:34:01 +0000
commit1453ee92e349c958b4521497a4774c58eef3f542 (patch)
treed5cf239db5fd858b284d364c399c02868766d8e2 /libgphoto2_port/usb
parent30f396653889094683f36a48547edd10e2f72f67 (diff)
downloadlibgphoto2-1453ee92e349c958b4521497a4774c58eef3f542.tar.gz
dev->config might be NULL (like on MacOS X)
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12693 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/usb')
-rw-r--r--libgphoto2_port/usb/libusb.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/libgphoto2_port/usb/libusb.c b/libgphoto2_port/usb/libusb.c
index c06af0765..9fa28fbb7 100644
--- a/libgphoto2_port/usb/libusb.c
+++ b/libgphoto2_port/usb/libusb.c
@@ -843,28 +843,30 @@ gp_port_usb_match_mtp_device(struct usb_device *dev,int *configno, int *interfac
* MTP interface descriptions, that's how they can be detected, before
* we try the more esoteric "OS descriptors" (below).
*/
- for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
- unsigned int j;
- for (j = 0; j < dev->config[i].bNumInterfaces; j++) {
- int k;
- for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) {
- buf[0] = '\0';
- ret = usb_get_string_simple(devh,
- dev->config[i].interface[j].altsetting[k].iInterface,
- (char *) buf,
- 1024);
- if (ret < 3)
- continue;
- if (strcmp((char *) buf, "MTP") == 0) {
- gp_log (GP_LOG_DEBUG, "mtp matcher", "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
- gp_log (GP_LOG_DEBUG, "mtp matcher", " Interface description contains the string \"MTP\"\n");
- gp_log (GP_LOG_DEBUG, "mtp matcher", " Device recognized as MTP, no further probing.\n");
- goto found;
+ if (dev->config) {
+ for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
+ unsigned int j;
+
+ for (j = 0; j < dev->config[i].bNumInterfaces; j++) {
+ int k;
+ for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) {
+ buf[0] = '\0';
+ ret = usb_get_string_simple(devh,
+ dev->config[i].interface[j].altsetting[k].iInterface,
+ (char *) buf,
+ 1024);
+ if (ret < 3)
+ continue;
+ if (strcmp((char *) buf, "MTP") == 0) {
+ gp_log (GP_LOG_DEBUG, "mtp matcher", "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
+ gp_log (GP_LOG_DEBUG, "mtp matcher", " Interface description contains the string \"MTP\"\n");
+ gp_log (GP_LOG_DEBUG, "mtp matcher", " Device recognized as MTP, no further probing.\n");
+ goto found;
+ }
}
}
}
}
-
/* get string descriptor at 0xEE */
ret = usb_get_descriptor (devh, 0x03, 0xee, buf, sizeof(buf));
if (ret > 0) gp_log_data("get_MS_OSD",buf, ret);