1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Peter D'Hoye 2007-09-20 23:31:57 +00:00
parent 0979cae1cd
commit a576657011

View file

@ -85,7 +85,7 @@ static struct usb_config_descriptor storage_config_desc = {
.bConfigurationValue = 1, .bConfigurationValue = 1,
.iConfiguration = CONFIG_STR_ID, .iConfiguration = CONFIG_STR_ID,
.bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, .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 = { static struct usb_interface_descriptor storage_interface_desc = {
@ -162,12 +162,14 @@ struct usb_response res;
/* helper functions */ /* helper functions */
static int config_buf(uint8_t *buf, uint8_t type, unsigned index); static int config_buf(uint8_t *buf, uint8_t type, unsigned index);
static int set_config(int config); static int set_config(int config);
static int set_interface_alt_setting(int interface_alt_setting);
struct device { struct device {
struct usb_ep* in; struct usb_ep* in;
struct usb_ep* out; struct usb_ep* out;
struct usb_ep* intr; struct usb_ep* intr;
uint32_t used_config; uint32_t used_config;
uint32_t used_interface_alt_setting;
struct usb_descriptor_header** descriptors; struct usb_descriptor_header** descriptors;
}; };
@ -291,9 +293,15 @@ int usb_storage_driver_request(struct usb_ctrlrequest* request)
res.buf = &dev.used_config; res.buf = &dev.used_config;
break; 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: case USB_REQ_SET_INTERFACE:
logf("usb storage: set interface"); logf("usb storage: set interface");
ret = 0; ret = set_interface_alt_setting(request->wValue);
break; break;
} }
@ -357,8 +365,6 @@ static int config_buf(uint8_t *buf, uint8_t type, unsigned index)
static int set_config(int config) static int set_config(int config)
{ {
(void)config;
/* enable endpoints */ /* enable endpoints */
logf("setup %s", dev.in->name); logf("setup %s", dev.in->name);
ops->enable(dev.in, (struct usb_endpoint_descriptor*)dev.descriptors[1]); ops->enable(dev.in, (struct usb_endpoint_descriptor*)dev.descriptors[1]);
@ -372,3 +378,10 @@ static int set_config(int config)
return 0; return 0;
} }
static int set_interface_alt_setting(int interface_alt_setting)
{
dev.used_interface_alt_setting = interface_alt_setting;
return 0;
}