summaryrefslogtreecommitdiff
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
parent0979cae1cd8b2d3c0a128cd6a67df1f9206e820d (diff)
downloadrockbox-a576657011ec1f0268ad1b1902e27ac378cda3de.tar.gz
rockbox-a576657011ec1f0268ad1b1902e27ac378cda3de.zip
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
-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 = {
85 .bConfigurationValue = 1, 85 .bConfigurationValue = 1,
86 .iConfiguration = CONFIG_STR_ID, 86 .iConfiguration = CONFIG_STR_ID,
87 .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, 87 .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
88 .bMaxPower = 1, 88 .bMaxPower = 250, /* 500mA in 2mA units */
89}; 89};
90 90
91static struct usb_interface_descriptor storage_interface_desc = { 91static struct usb_interface_descriptor storage_interface_desc = {
@@ -162,12 +162,14 @@ struct usb_response res;
162/* helper functions */ 162/* helper functions */
163static int config_buf(uint8_t *buf, uint8_t type, unsigned index); 163static int config_buf(uint8_t *buf, uint8_t type, unsigned index);
164static int set_config(int config); 164static int set_config(int config);
165static int set_interface_alt_setting(int interface_alt_setting);
165 166
166struct device { 167struct device {
167 struct usb_ep* in; 168 struct usb_ep* in;
168 struct usb_ep* out; 169 struct usb_ep* out;
169 struct usb_ep* intr; 170 struct usb_ep* intr;
170 uint32_t used_config; 171 uint32_t used_config;
172 uint32_t used_interface_alt_setting;
171 struct usb_descriptor_header** descriptors; 173 struct usb_descriptor_header** descriptors;
172}; 174};
173 175
@@ -291,9 +293,15 @@ int usb_storage_driver_request(struct usb_ctrlrequest* request)
291 res.buf = &dev.used_config; 293 res.buf = &dev.used_config;
292 break; 294 break;
293 295
296 case USB_REQ_GET_INTERFACE:
297 logf("usb storage: get interface");
298 ret = 1;
299 res.buf = &dev.used_interface_alt_setting;
300 break;
301
294 case USB_REQ_SET_INTERFACE: 302 case USB_REQ_SET_INTERFACE:
295 logf("usb storage: set interface"); 303 logf("usb storage: set interface");
296 ret = 0; 304 ret = set_interface_alt_setting(request->wValue);
297 break; 305 break;
298 } 306 }
299 307
@@ -357,8 +365,6 @@ static int config_buf(uint8_t *buf, uint8_t type, unsigned index)
357 365
358static int set_config(int config) 366static int set_config(int config)
359{ 367{
360 (void)config;
361
362 /* enable endpoints */ 368 /* enable endpoints */
363 logf("setup %s", dev.in->name); 369 logf("setup %s", dev.in->name);
364 ops->enable(dev.in, (struct usb_endpoint_descriptor*)dev.descriptors[1]); 370 ops->enable(dev.in, (struct usb_endpoint_descriptor*)dev.descriptors[1]);
@@ -372,3 +378,10 @@ static int set_config(int config)
372 return 0; 378 return 0;
373} 379}
374 380
381static int set_interface_alt_setting(int interface_alt_setting)
382{
383 dev.used_interface_alt_setting = interface_alt_setting;
384
385 return 0;
386}
387