summaryrefslogtreecommitdiff
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2007-09-20 23:31:57 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2007-09-20 23:31:57 +0000
commita576657011ec1f0268ad1b1902e27ac378cda3de (patch)
tree1c95879becdf703f2ad5265eaf04e8c0f0b2bea8 /firmware/usbstack
parent0979cae1cd8b2d3c0a128cd6a67df1f9206e820d (diff)
Get/Set Interface - just stores the value, makes one more compliance test pass
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14794 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/drivers/device/usb_storage.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/firmware/usbstack/drivers/device/usb_storage.c b/firmware/usbstack/drivers/device/usb_storage.c
index f9fca55b73..01419da778 100644
--- a/firmware/usbstack/drivers/device/usb_storage.c
+++ b/firmware/usbstack/drivers/device/usb_storage.c
@@ -85,7 +85,7 @@ static struct usb_config_descriptor storage_config_desc = {
.bConfigurationValue = 1,
.iConfiguration = CONFIG_STR_ID,
.bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
- .bMaxPower = 1,
+ .bMaxPower = 250, /* 500mA in 2mA units */
};
static struct usb_interface_descriptor storage_interface_desc = {
@@ -162,12 +162,14 @@ struct usb_response res;
/* helper functions */
static int config_buf(uint8_t *buf, uint8_t type, unsigned index);
static int set_config(int config);
+static int set_interface_alt_setting(int interface_alt_setting);
struct device {
struct usb_ep* in;
struct usb_ep* out;
struct usb_ep* intr;
uint32_t used_config;
+ uint32_t used_interface_alt_setting;
struct usb_descriptor_header** descriptors;
};
@@ -291,9 +293,15 @@ int usb_storage_driver_request(struct usb_ctrlrequest* request)
res.buf = &dev.used_config;
break;
+ case USB_REQ_GET_INTERFACE:
+ logf("usb storage: get interface");
+ ret = 1;
+ res.buf = &dev.used_interface_alt_setting;
+ break;
+
case USB_REQ_SET_INTERFACE:
logf("usb storage: set interface");
- ret = 0;
+ ret = set_interface_alt_setting(request->wValue);
break;
}
@@ -357,8 +365,6 @@ static int config_buf(uint8_t *buf, uint8_t type, unsigned index)
static int set_config(int config)
{
- (void)config;
-
/* enable endpoints */
logf("setup %s", dev.in->name);
ops->enable(dev.in, (struct usb_endpoint_descriptor*)dev.descriptors[1]);
@@ -372,3 +378,10 @@ static int set_config(int config)
return 0;
}
+static int set_interface_alt_setting(int interface_alt_setting)
+{
+ dev.used_interface_alt_setting = interface_alt_setting;
+
+ return 0;
+}
+