Changeset eb522e8 in mainline for uspace/app/usbinfo/desctree.c
- Timestamp:
- 2011-06-01T08:43:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d6c1f1
- Parents:
- 9e2e715 (diff), e51a514 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/desctree.c
r9e2e715 reb522e8 1 1 /* 2 * Copyright (c) 20 08 Lukas Mejdrech2 * Copyright (c) 2010 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup u dp29 /** @addtogroup usbinfo 30 30 * @{ 31 31 */ 32 33 /** @file 34 * UDP standalone module implementation. 35 * Contains skeleton module functions mapping. 36 * The functions are used by the module skeleton as module specific entry 37 * points. 38 * @see module.c 32 /** 33 * @file 34 * Descriptor tree dump. 39 35 */ 40 36 41 #include "udp.h" 42 #include "udp_module.h" 37 #include <stdio.h> 38 #include <stdlib.h> 39 #include <errno.h> 40 #include <str_error.h> 41 #include <bool.h> 43 42 44 #include <async.h> 45 #include <stdio.h> 46 #include <errno.h> 47 #include <ipc/ipc.h> 48 #include <ipc/services.h> 43 #include <usb/usb.h> 44 #include <usb/descriptor.h> 45 #include <usb/debug.h> 46 #include <usb/classes/classes.h> 49 47 50 #include <net/modules.h>51 #include < net/packet.h>48 #include "usbinfo.h" 49 #include <usb/dev/dp.h> 52 50 53 #include <net_interface.h> 54 #include <tl_local.h> 55 56 /** UDP module global data. */ 57 extern udp_globals_t udp_globals; 58 59 int tl_module_start_standalone(async_client_conn_t client_connection) 51 static void browse_descriptor_tree_internal(usb_dp_parser_t *parser, 52 usb_dp_parser_data_t *data, uint8_t *root, size_t depth, 53 dump_descriptor_in_tree_t callback, void *arg) 60 54 { 61 ipcarg_t phonehash; 62 int rc; 63 64 async_set_client_connection(client_connection); 65 udp_globals.net_phone = net_connect_module(); 66 if (udp_globals.net_phone < 0) 67 return udp_globals.net_phone; 68 69 rc = pm_init(); 70 if (rc != EOK) 71 return EOK; 72 73 rc = udp_initialize(client_connection); 74 if (rc != EOK) 75 goto out; 76 77 rc = REGISTER_ME(SERVICE_UDP, &phonehash); 78 if (rc != EOK) 79 goto out; 80 81 async_manager(); 82 83 out: 84 pm_destroy(); 85 return rc; 55 if (root == NULL) { 56 return; 57 } 58 callback(root, depth, arg); 59 uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root); 60 do { 61 browse_descriptor_tree_internal(parser, data, child, depth + 1, 62 callback, arg); 63 child = usb_dp_get_sibling_descriptor(parser, data, 64 root, child); 65 } while (child != NULL); 86 66 } 87 67 88 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 89 ipc_call_t *answer, int *answer_count) 68 void browse_descriptor_tree(uint8_t *descriptors, size_t descriptors_size, 69 usb_dp_descriptor_nesting_t *descriptor_nesting, 70 dump_descriptor_in_tree_t callback, size_t initial_depth, void *arg) 90 71 { 91 return udp_message_standalone(callid, call, answer, answer_count); 72 usb_dp_parser_data_t data = { 73 .data = descriptors, 74 .size = descriptors_size, 75 .arg = NULL 76 }; 77 78 usb_dp_parser_t parser = { 79 .nesting = descriptor_nesting 80 }; 81 82 browse_descriptor_tree_internal(&parser, &data, descriptors, 83 initial_depth, callback, arg); 92 84 } 93 85
Note:
See TracChangeset
for help on using the changeset viewer.