Changeset 73751c0 in mainline for uspace/lib
- Timestamp:
- 2011-03-18T12:16:36Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b495a93
- Parents:
- 42a3a57 (diff), b64eac6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 1 added
- 6 edited
-
c/Makefile (modified) (1 diff)
-
c/generic/l18n/langs.c (added)
-
c/include/l18n/langs.h (modified) (1 diff)
-
usb/include/usb/dp.h (modified) (1 diff)
-
usb/include/usb/pipes.h (modified) (1 diff)
-
usb/src/dp.c (modified) (1 diff)
-
usb/src/pipes.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r42a3a57 r73751c0 65 65 generic/str.c \ 66 66 generic/str_error.c \ 67 generic/l18n/langs.c \ 67 68 generic/fibril.c \ 68 69 generic/fibril_synch.c \ -
uspace/lib/c/include/l18n/langs.h
r42a3a57 r73751c0 57 57 } l18_win_locales_t; 58 58 59 const char *str_l18_win_locale(l18_win_locales_t); 60 59 61 #endif 60 62 -
uspace/lib/usb/include/usb/dp.h
r42a3a57 r73751c0 77 77 usb_dp_parser_data_t *, uint8_t *, uint8_t *); 78 78 79 void usb_dp_walk_simple(uint8_t *, size_t, usb_dp_descriptor_nesting_t *, 80 void (*)(uint8_t *, size_t, void *), void *); 81 79 82 #endif 80 83 /** -
uspace/lib/usb/include/usb/pipes.h
r42a3a57 r73751c0 123 123 124 124 int usb_device_get_assigned_interface(ddf_dev_t *); 125 usb_address_t usb_device_get_assigned_address(devman_handle_t); 125 126 126 127 int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *, -
uspace/lib/usb/src/dp.c
r42a3a57 r73751c0 258 258 } 259 259 260 /** Browser of the descriptor tree. 261 * 262 * @see usb_dp_walk_simple 263 * 264 * @param parser Descriptor parser. 265 * @param data Data for descriptor parser. 266 * @param root Pointer to current root of the tree. 267 * @param depth Current nesting depth. 268 * @param callback Callback for each found descriptor. 269 * @param arg Custom (user) argument. 270 */ 271 static void usb_dp_browse_simple_internal(usb_dp_parser_t *parser, 272 usb_dp_parser_data_t *data, uint8_t *root, size_t depth, 273 void (*callback)(uint8_t *, size_t, void *), void *arg) 274 { 275 if (root == NULL) { 276 return; 277 } 278 callback(root, depth, arg); 279 uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root); 280 do { 281 usb_dp_browse_simple_internal(parser, data, child, depth + 1, 282 callback, arg); 283 child = usb_dp_get_sibling_descriptor(parser, data, 284 root, child); 285 } while (child != NULL); 286 } 287 288 /** Browse flatten descriptor tree. 289 * 290 * The callback is called with following arguments: pointer to the start 291 * of the descriptor (somewhere inside @p descriptors), depth of the nesting 292 * (starting from 0 for the first descriptor) and the custom argument. 293 * Note that the size of the descriptor is not passed because it can 294 * be read from the first byte of the descriptor. 295 * 296 * @param descriptors Descriptor data. 297 * @param descriptors_size Size of descriptor data (in bytes). 298 * @param descriptor_nesting Possible descriptor nesting. 299 * @param callback Callback for each found descriptor. 300 * @param arg Custom (user) argument. 301 */ 302 void usb_dp_walk_simple(uint8_t *descriptors, size_t descriptors_size, 303 usb_dp_descriptor_nesting_t *descriptor_nesting, 304 void (*callback)(uint8_t *, size_t, void *), void *arg) 305 { 306 if ((descriptors == NULL) || (descriptors_size == 0) 307 || (descriptor_nesting == NULL) || (callback == NULL)) { 308 return; 309 } 310 311 usb_dp_parser_data_t data = { 312 .data = descriptors, 313 .size = descriptors_size, 314 .arg = NULL 315 }; 316 317 usb_dp_parser_t parser = { 318 .nesting = descriptor_nesting 319 }; 320 321 usb_dp_browse_simple_internal(&parser, &data, descriptors, 322 0, callback, arg); 323 } 260 324 261 325 /** @} -
uspace/lib/usb/src/pipes.c
r42a3a57 r73751c0 52 52 sysarg_t address; 53 53 54 55 54 /* 56 55 * We are sending special value as a handle - zero - to get … … 94 93 95 94 return (int) iface_no; 95 } 96 97 /** Tell USB address assigned to given device. 98 * 99 * @param dev_handle Devman handle of the USB device in question. 100 * @return USB address or negative error code. 101 */ 102 usb_address_t usb_device_get_assigned_address(devman_handle_t dev_handle) 103 { 104 int parent_phone = devman_parent_device_connect(dev_handle, 105 IPC_FLAG_BLOCKING); 106 if (parent_phone < 0) { 107 return parent_phone; 108 } 109 110 sysarg_t address; 111 112 int rc = async_req_2_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE), 113 IPC_M_USB_GET_ADDRESS, 114 dev_handle, &address); 115 116 if (rc != EOK) { 117 return rc; 118 } 119 120 async_hangup(parent_phone); 121 122 return (usb_address_t) address; 96 123 } 97 124
Note:
See TracChangeset
for help on using the changeset viewer.
