summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2007-01-03 20:36:54 +0000
committerMarcus Meissner <marcus@jet.franken.de>2007-01-03 20:36:54 +0000
commitec026db1eaf8dfbbaa41398bc628c80bcca19c79 (patch)
tree3099b916918688d8a092f7566d8236524d4438c3 /libgphoto2_port
parent463a5bb61b143eb992486e83ad9ee550ec07bb2d (diff)
downloadlibgphoto2-ec026db1eaf8dfbbaa41398bc628c80bcca19c79.tar.gz
added r/o maxpacketsize to USB settings and report it to the camera
library. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@9852 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/NEWS4
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port.h6
-rw-r--r--libgphoto2_port/usb/libusb.c9
3 files changed, 16 insertions, 3 deletions
diff --git a/libgphoto2_port/NEWS b/libgphoto2_port/NEWS
index 493e9d0a0..10237f37d 100644
--- a/libgphoto2_port/NEWS
+++ b/libgphoto2_port/NEWS
@@ -3,6 +3,10 @@ libgphoto2_port 0.7.2
Build:
* Put auto* files into auto-aux/ and auto-m4/.
+USB:
+ * Reported wMaxPacketsize of the IN endpoint to the camlib
+ via GPPortSettings.
+
------------------------------------------------------------------------
libgphoto2_port 0.7.1
diff --git a/libgphoto2_port/gphoto2/gphoto2-port.h b/libgphoto2_port/gphoto2/gphoto2-port.h
index 5645bf298..91f9532ab 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port.h
@@ -69,9 +69,9 @@ struct _GPPortSettingsSerial {
typedef struct _GPPortSettingsUSB GPPortSettingsUSB;
struct _GPPortSettingsUSB {
int inep, outep, intep;
- int config;
- int interface;
- int altsetting;
+ int config, interface, altsetting;
+
+ int maxpacketsize; /* r/o */
/* must be last to avoid binary incompatibility.
* luckily we just need to make sure this struct does not
diff --git a/libgphoto2_port/usb/libusb.c b/libgphoto2_port/usb/libusb.c
index 06cde8621..5dabad8d9 100644
--- a/libgphoto2_port/usb/libusb.c
+++ b/libgphoto2_port/usb/libusb.c
@@ -617,6 +617,8 @@ gp_port_usb_find_device_lib(GPPort *port, int idvendor, int idproduct)
/* Set the defaults */
if (dev->config) {
+ int i;
+
if (dev->config[config].interface[interface].altsetting[altsetting].bInterfaceClass
== USB_CLASS_MASS_STORAGE) {
gp_log (GP_LOG_VERBOSE, "gphoto2-port-usb",
@@ -632,6 +634,13 @@ gp_port_usb_find_device_lib(GPPort *port, int idvendor, int idproduct)
port->settings.usb.inep = gp_port_usb_find_ep(dev, config, interface, altsetting, USB_ENDPOINT_IN, USB_ENDPOINT_TYPE_BULK);
port->settings.usb.outep = gp_port_usb_find_ep(dev, config, interface, altsetting, USB_ENDPOINT_OUT, USB_ENDPOINT_TYPE_BULK);
port->settings.usb.intep = gp_port_usb_find_ep(dev, config, interface, altsetting, USB_ENDPOINT_IN, USB_ENDPOINT_TYPE_INTERRUPT);
+
+ for (i=0;i<dev->config[config].interface[interface].altsetting[altsetting].bNumEndpoints;i++) {
+ if (port->settings.usb.inep == dev->config[config].interface[interface].altsetting[altsetting].endpoint[i].bEndpointAddress) {
+ port->settings.usb.maxpacketsize = dev->config[config].interface[interface].altsetting[altsetting].endpoint[i].wMaxPacketSize;
+ break;
+ }
+ }
gp_log (GP_LOG_VERBOSE, "gphoto2-port-usb",
"Detected defaults: config %d, "
"interface %d, altsetting %d, "