Changeset 08af5a6 in mainline
- Timestamp:
- 2010-10-20T21:15:51Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8507a1
- Parents:
- bbfb86c
- Location:
- uspace/lib/usbvirt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/device.h
rbbfb86c r08af5a6 104 104 /** Number of configurations. */ 105 105 size_t configuration_count; 106 /** Index of currently selected configuration. */ 107 uint8_t current_configuration; 106 108 } usbvirt_descriptors_t; 107 109 -
uspace/lib/usbvirt/stdreq.c
rbbfb86c r08af5a6 132 132 } 133 133 134 static int handle_set_configuration(uint16_t configuration_value, 135 uint16_t zero1, uint16_t zero2) 136 { 137 if ((zero1 != 0) || (zero2 != 0)) { 138 return EINVAL; 139 } 140 141 /* 142 * Configuration value is 1 byte information. 143 */ 144 if (configuration_value > 255) { 145 return EINVAL; 146 } 147 148 /* 149 * Do nothing when in default state. According to specification, 150 * this is not specified. 151 */ 152 if (device->state == USBVIRT_STATE_DEFAULT) { 153 return EOK; 154 } 155 156 if (configuration_value == 0) { 157 device->state = USBVIRT_STATE_ADDRESS; 158 } else { 159 /* 160 * TODO: browse provided configurations and verify that 161 * user selected existing configuration. 162 */ 163 device->state = USBVIRT_STATE_CONFIGURED; 164 if (device->descriptors) { 165 device->descriptors->current_configuration 166 = configuration_value; 167 } 168 } 169 170 return EOK; 171 } 172 134 173 #define HANDLE_REQUEST(request, data, type, dev, user_callback, default_handler) \ 135 174 do { \ … … 161 200 request->index, request->length)); 162 201 202 HANDLE_REQUEST(request, data, USB_DEVREQ_SET_CONFIGURATION, 203 device, on_set_configuration, 204 handle_set_configuration(request->value, 205 request->index, request->length)); 206 163 207 return ENOTSUP; 164 208 }
Note:
See TracChangeset
for help on using the changeset viewer.