Changeset 3100ebe in mainline
- Timestamp:
- 2011-03-16T10:14:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 81ca204
- Parents:
- 2180979
- Location:
- uspace/app/usbinfo
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/Makefile
r2180979 r3100ebe 34 34 35 35 SOURCES = \ 36 dev.c \ 36 37 dump.c \ 37 38 info.c \ -
uspace/app/usbinfo/dump.c
r2180979 r3100ebe 101 101 } 102 102 103 void dump_match_ids(match_id_list_t *matches )103 void dump_match_ids(match_id_list_t *matches, const char *line_prefix) 104 104 { 105 printf("Match ids:\n");106 105 link_t *link; 107 106 for (link = matches->ids.next; … … 110 109 match_id_t *match = list_get_instance(link, match_id_t, link); 111 110 112 printf( INDENT "%d %s\n", match->score, match->id);111 printf("%s%d %s\n", line_prefix, match->score, match->id); 113 112 } 114 113 } -
uspace/app/usbinfo/info.c
r2180979 r3100ebe 42 42 #include "usbinfo.h" 43 43 44 void dump_short_device_identification(usbinfo_device_t *dev) 45 { 46 printf("%sDevice 0x%04x by vendor 0x%04x\n", get_indent(0), 47 (int) dev->device_descriptor.product_id, 48 (int) dev->device_descriptor.vendor_id); 49 } 50 51 void dump_device_match_ids(usbinfo_device_t *dev) 52 { 53 match_id_list_t matches; 54 init_match_ids(&matches); 55 usb_device_create_match_ids_from_device_descriptor( 56 &dev->device_descriptor, &matches); 57 dump_match_ids(&matches, get_indent(0)); 58 } 59 44 60 int dump_device(devman_handle_t hc_handle, usb_address_t address) 45 61 { … … 92 108 goto leave; 93 109 } 94 dump_match_ids(&match_id_list );110 dump_match_ids(&match_id_list, get_indent(0)); 95 111 96 112 /* -
uspace/app/usbinfo/main.c
r2180979 r3100ebe 164 164 } 165 165 166 printf("Device `%s':\n------------\n", devpath); 167 dump_device(hc_handle, dev_addr); 166 usbinfo_device_t *dev = prepare_device(hc_handle, dev_addr); 167 if (dev == NULL) { 168 continue; 169 } 170 171 /* Run actions the user specified. */ 172 /* TODO */ 173 174 175 printf("%s\n", devpath); 176 dump_short_device_identification(dev); 177 dump_device_match_ids(dev); 178 179 /* Destroy the control pipe (close the session etc.). */ 180 destroy_device(dev); 168 181 } 169 182 -
uspace/app/usbinfo/usbinfo.h
r2180979 r3100ebe 38 38 #include <usb/usb.h> 39 39 #include <usb/descriptor.h> 40 #include <usb/pipes.h> 40 41 #include <usb/debug.h> 41 42 #include <ipc/devman.h> 42 43 44 typedef struct { 45 usb_endpoint_pipe_t ctrl_pipe; 46 usb_device_connection_t wire; 47 usb_standard_device_descriptor_t device_descriptor; 48 } usbinfo_device_t; 43 49 44 50 #define NAME "usbinfo" … … 46 52 void dump_buffer(const char *, size_t, const uint8_t *, size_t); 47 53 const char *get_indent(size_t); 48 void dump_match_ids(match_id_list_t * matches);54 void dump_match_ids(match_id_list_t *, const char *); 49 55 void dump_usb_descriptor(uint8_t *, size_t); 50 56 int dump_device(devman_handle_t, usb_address_t); … … 56 62 } 57 63 64 usbinfo_device_t *prepare_device(devman_handle_t, usb_address_t); 65 void destroy_device(usbinfo_device_t *); 66 67 68 void dump_short_device_identification(usbinfo_device_t *); 69 void dump_device_match_ids(usbinfo_device_t *); 70 58 71 #endif 59 72 /**
Note:
See TracChangeset
for help on using the changeset viewer.