Changeset 41ef5b9 in mainline for uspace/app
- Timestamp:
- 2011-03-21T17:16:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4d0c40b
- Parents:
- fd9f6e4c (diff), 434ef65 (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/app
- Files:
-
- 5 edited
-
bdsh/cmds/modules/bdd/bdd.c (modified) (4 diffs)
-
usbinfo/dev.c (modified) (5 diffs)
-
usbinfo/info.c (modified) (8 diffs)
-
usbinfo/main.c (modified) (3 diffs)
-
usbinfo/usbinfo.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/bdd/bdd.c
rfd9f6e4c r41ef5b9 70 70 unsigned int i, j; 71 71 devmap_handle_t handle; 72 aoff64_t offset; 72 73 uint8_t *blk; 73 74 size_t size, bytes, rows; … … 120 121 } 121 122 123 offset = ba * block_size; 124 122 125 while (size > 0) { 123 126 rc = block_read_direct(handle, ba, 1, blk); … … 133 136 134 137 for (j = 0; j < rows; j++) { 138 printf("[%06" PRIxOFF64 "] ", offset); 135 139 for (i = 0; i < BPR; i++) { 136 140 if (j * BPR + i < bytes) … … 152 156 } 153 157 } 158 offset += BPR; 154 159 putchar('\n'); 155 160 } -
uspace/app/usbinfo/dev.c
rfd9f6e4c r41ef5b9 59 59 } 60 60 61 rc = usb_ endpoint_pipe_initialize_default_control(&dev->ctrl_pipe,61 rc = usb_pipe_initialize_default_control(&dev->ctrl_pipe, 62 62 &dev->wire); 63 63 if (rc != EOK) { … … 68 68 } 69 69 70 rc = usb_ endpoint_pipe_probe_default_control(&dev->ctrl_pipe);70 rc = usb_pipe_probe_default_control(&dev->ctrl_pipe); 71 71 if (rc != EOK) { 72 72 fprintf(stderr, … … 76 76 } 77 77 78 rc = usb_ endpoint_pipe_start_session(&dev->ctrl_pipe);78 rc = usb_pipe_start_session(&dev->ctrl_pipe); 79 79 if (rc != EOK) { 80 80 fprintf(stderr, … … 107 107 108 108 leave: 109 if (usb_ endpoint_pipe_is_session_started(&dev->ctrl_pipe)) {110 usb_ endpoint_pipe_end_session(&dev->ctrl_pipe);109 if (usb_pipe_is_session_started(&dev->ctrl_pipe)) { 110 usb_pipe_end_session(&dev->ctrl_pipe); 111 111 } 112 112 … … 118 118 void destroy_device(usbinfo_device_t *dev) 119 119 { 120 usb_ endpoint_pipe_end_session(&dev->ctrl_pipe);120 usb_pipe_end_session(&dev->ctrl_pipe); 121 121 free(dev); 122 122 } -
uspace/app/usbinfo/info.c
rfd9f6e4c r41ef5b9 42 42 #include <usb/classes/classes.h> 43 43 #include <usb/classes/hid.h> 44 #include <usb/classes/hub.h> 44 45 #include "usbinfo.h" 45 46 … … 109 110 usb_standard_device_descriptor_t *descriptor) 110 111 { 111 printf("%sDevice (0x%04x by 0x%04x, %s )\n", prefix,112 printf("%sDevice (0x%04x by 0x%04x, %s, %zu configurations)\n", prefix, 112 113 (int) descriptor->product_id, 113 114 (int) descriptor->vendor_id, 114 usb_str_class(descriptor->device_class)); 115 usb_str_class(descriptor->device_class), 116 (size_t) descriptor->configuration_count); 115 117 } 116 118 … … 118 120 usb_standard_configuration_descriptor_t *descriptor) 119 121 { 120 printf("%sConfiguration #%d\n", prefix, 121 (int) descriptor->configuration_number); 122 printf("%sConfiguration #%d (%zu interfaces, total %zuB)\n", prefix, 123 (int) descriptor->configuration_number, 124 (size_t) descriptor->interface_count, 125 (size_t) descriptor->total_length); 122 126 } 123 127 … … 125 129 usb_standard_interface_descriptor_t *descriptor) 126 130 { 127 printf("%sInterface #%d (%s, 0x%02x, 0x%02x) \n", prefix,131 printf("%sInterface #%d (%s, 0x%02x, 0x%02x), alternate %d\n", prefix, 128 132 (int) descriptor->interface_number, 129 133 usb_str_class(descriptor->interface_class), 130 134 (int) descriptor->interface_subclass, 131 (int) descriptor->interface_protocol); 135 (int) descriptor->interface_protocol, 136 (int) descriptor->alternate_setting); 132 137 } 133 138 … … 153 158 } 154 159 155 156 static void dump_descriptor_tree_brief_callback(uint8_t *descriptor, 160 static void dump_descriptor_tree_brief_hub(const char *prefix, 161 usb_hub_descriptor_header_t *descriptor) 162 { 163 printf("%shub (%d ports)\n", prefix, 164 (int) descriptor->port_count); 165 } 166 167 168 static void dump_descriptor_tree_callback(uint8_t *descriptor, 157 169 size_t depth, void *arg) 158 170 { … … 171 183 if (descr_size >= sizeof(descriptor_type)) { \ 172 184 callback(indent, (descriptor_type *) descriptor); \ 185 if (arg != NULL) { \ 186 usb_dump_standard_descriptor(stdout, \ 187 get_indent(depth +2), "\n", \ 188 descriptor, descr_size); \ 189 } \ 173 190 } else { \ 174 191 descr_type = -1; \ … … 191 208 usb_standard_hid_descriptor_t, 192 209 dump_descriptor_tree_brief_hid); 210 /* 211 * Probably useless, hub descriptor shall not be part of 212 * configuration descriptor. 213 */ 214 _BRANCH(USB_DESCTYPE_HUB, 215 usb_hub_descriptor_header_t, 216 dump_descriptor_tree_brief_hub); 193 217 194 218 default: … … 203 227 void dump_descriptor_tree_brief(usbinfo_device_t *dev) 204 228 { 205 dump_descriptor_tree_ brief_callback((uint8_t *)&dev->device_descriptor,229 dump_descriptor_tree_callback((uint8_t *)&dev->device_descriptor, 206 230 (size_t) -1, NULL); 207 231 usb_dp_walk_simple(dev->full_configuration_descriptor, 208 232 dev->full_configuration_descriptor_size, 209 233 usb_dp_standard_descriptor_nesting, 210 dump_descriptor_tree_ brief_callback,234 dump_descriptor_tree_callback, 211 235 NULL); 212 236 } 237 238 void dump_descriptor_tree_full(usbinfo_device_t *dev) 239 { 240 dump_descriptor_tree_callback((uint8_t *)&dev->device_descriptor, 241 (size_t) -1, dev); 242 usb_dp_walk_simple(dev->full_configuration_descriptor, 243 dev->full_configuration_descriptor_size, 244 usb_dp_standard_descriptor_nesting, 245 dump_descriptor_tree_callback, 246 dev); 247 } 248 213 249 214 250 void dump_strings(usbinfo_device_t *dev) -
uspace/app/usbinfo/main.c
rfd9f6e4c r41ef5b9 134 134 _OPTION("-m --match-ids", "Print match ids generated for the device."); 135 135 _OPTION("-t --descriptor-tree", "Print descriptor tree."); 136 _OPTION("-T --descriptor-tree-full", "Print detailed descriptor tree"); 136 137 _OPTION("-s --strings", "Try to print all string descriptors."); 137 138 … … 149 150 {"match-ids", no_argument, NULL, 'm'}, 150 151 {"descriptor-tree", no_argument, NULL, 't'}, 152 {"descriptor-tree-full", no_argument, NULL, 'T'}, 151 153 {"strings", no_argument, NULL, 's'}, 152 154 {0, 0, NULL, 0} 153 155 }; 154 static const char *short_options = "himt s";156 static const char *short_options = "himtTs"; 155 157 156 158 static usbinfo_action_t actions[] = { … … 168 170 .opt = 't', 169 171 .action = dump_descriptor_tree_brief, 172 .active = false 173 }, 174 { 175 .opt = 'T', 176 .action = dump_descriptor_tree_full, 170 177 .active = false 171 178 }, -
uspace/app/usbinfo/usbinfo.h
rfd9f6e4c r41ef5b9 44 44 45 45 typedef struct { 46 usb_ endpoint_pipe_t ctrl_pipe;46 usb_pipe_t ctrl_pipe; 47 47 usb_device_connection_t wire; 48 48 usb_standard_device_descriptor_t device_descriptor; … … 82 82 void dump_device_match_ids(usbinfo_device_t *); 83 83 void dump_descriptor_tree_brief(usbinfo_device_t *); 84 void dump_descriptor_tree_full(usbinfo_device_t *); 84 85 void dump_strings(usbinfo_device_t *); 85 86
Note:
See TracChangeset
for help on using the changeset viewer.
