summaryrefslogtreecommitdiff
path: root/libgphoto2_port/usb
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2010-02-07 11:54:47 +0000
committerMarcus Meissner <marcus@jet.franken.de>2010-02-07 11:54:47 +0000
commit7a281bccf1b2689a97aa6591216641b202001680 (patch)
tree2e3d32cab3efb21a84b4be3f174853824c07ca2f /libgphoto2_port/usb
parent1453ee92e349c958b4521497a4774c58eef3f542 (diff)
downloadlibgphoto2-7a281bccf1b2689a97aa6591216641b202001680.tar.gz
also check for dev->config NULL here
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12694 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/usb')
-rw-r--r--libgphoto2_port/usb/check-mtp-device.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/libgphoto2_port/usb/check-mtp-device.c b/libgphoto2_port/usb/check-mtp-device.c
index c5e8a8a1e..9cf657ca7 100644
--- a/libgphoto2_port/usb/check-mtp-device.c
+++ b/libgphoto2_port/usb/check-mtp-device.c
@@ -119,29 +119,30 @@ found:
* 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) {
- fprintf(stderr, "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
- fprintf(stderr, " Interface description contains the string \"MTP\"\n");
- fprintf(stderr, " Device recognized as MTP, no further probing.\n");
- usb_close(devh);
- return 0;
+ 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) {
+ fprintf(stderr, "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
+ fprintf(stderr, " Interface description contains the string \"MTP\"\n");
+ fprintf(stderr, " Device recognized as MTP, no further probing.\n");
+ usb_close(devh);
+ return 0;
+ }
}
}
}
}
-
/* 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);*/