Changeset 76ef94e in mainline for uspace/app
- Timestamp:
- 2011-05-07T15:51:20Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3ae5ca8
- Parents:
- d2bff2f (diff), b23e9cc (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:
-
- 2 added
- 3 edited
-
lsusb/Makefile (added)
-
lsusb/main.c (added)
-
usbinfo/dev.c (modified) (6 diffs)
-
usbinfo/main.c (modified) (3 diffs)
-
usbinfo/usbinfo.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/dev.c
rd2bff2f r76ef94e 40 40 #include "usbinfo.h" 41 41 42 usbinfo_device_t *prepare_device( devman_handle_t hc_handle,43 usb_address_t dev_addr)42 usbinfo_device_t *prepare_device(const char *name, 43 devman_handle_t hc_handle, usb_address_t dev_addr) 44 44 { 45 45 usbinfo_device_t *dev = malloc(sizeof(usbinfo_device_t)); … … 55 55 if (rc != EOK) { 56 56 fprintf(stderr, 57 NAME ": failed to create connection to the device: %s.\n",58 str_error(rc));57 NAME ": failed to create connection to device %s: %s.\n", 58 name, str_error(rc)); 59 59 goto leave; 60 60 } … … 64 64 if (rc != EOK) { 65 65 fprintf(stderr, 66 NAME ": failed to create default control pipe : %s.\n",67 str_error(rc));66 NAME ": failed to create default control pipe to %s: %s.\n", 67 name, str_error(rc)); 68 68 goto leave; 69 69 } … … 71 71 rc = usb_pipe_probe_default_control(&dev->ctrl_pipe); 72 72 if (rc != EOK) { 73 fprintf(stderr, 74 NAME ": probing default control pipe failed: %s.\n", 75 str_error(rc)); 73 if (rc == ENOENT) { 74 fprintf(stderr, NAME ": " \ 75 "device %s not present or malfunctioning.\n", 76 name); 77 } else { 78 fprintf(stderr, NAME ": " \ 79 "probing default control pipe of %s failed: %s.\n", 80 name, str_error(rc)); 81 } 76 82 goto leave; 77 83 } … … 84 90 if (rc != EOK) { 85 91 fprintf(stderr, 86 NAME ": failed to retrieve device descriptor : %s.\n",87 str_error(rc));92 NAME ": failed to retrieve device descriptor of %s: %s.\n", 93 name, str_error(rc)); 88 94 goto leave; 89 95 } … … 93 99 &dev->full_configuration_descriptor_size); 94 100 if (rc != EOK) { 95 fprintf(stderr, 96 NAME ": failed to retrieve configuration descriptor: %s.\n",97 str_error(rc));101 fprintf(stderr, NAME ": " \ 102 "failed to retrieve configuration descriptor of %s: %s.\n", 103 name, str_error(rc)); 98 104 goto leave; 99 105 } -
uspace/app/usbinfo/main.c
rd2bff2f r76ef94e 45 45 #include <usb/usbdevice.h> 46 46 #include <usb/pipes.h> 47 #include <usb/host.h> 47 48 #include "usbinfo.h" 49 50 static bool try_parse_class_and_address(const char *path, 51 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 52 { 53 size_t class_index; 54 size_t address; 55 int rc; 56 char *ptr; 57 58 rc = str_size_t(path, &ptr, 10, false, &class_index); 59 if (rc != EOK) { 60 return false; 61 } 62 if ((*ptr == ':') || (*ptr == '.')) { 63 ptr++; 64 } else { 65 return false; 66 } 67 rc = str_size_t(ptr, NULL, 10, true, &address); 68 if (rc != EOK) { 69 return false; 70 } 71 rc = usb_ddf_get_hc_handle_by_class(class_index, out_hc_handle); 72 if (rc != EOK) { 73 return false; 74 } 75 if (out_device_address != NULL) { 76 *out_device_address = (usb_address_t) address; 77 } 78 return true; 79 } 48 80 49 81 static bool resolve_hc_handle_and_dev_addr(const char *devpath, … … 60 92 if (str_cmp(devpath, "virt") == 0) { 61 93 devpath = "/virt/usbhc/usb00_a1/usb00_a2"; 94 } 95 96 if (try_parse_class_and_address(devpath, 97 out_hc_handle, out_device_address)) { 98 return true; 62 99 } 63 100 … … 271 308 } 272 309 273 usbinfo_device_t *dev = prepare_device(hc_handle, dev_addr); 310 usbinfo_device_t *dev = prepare_device(devpath, 311 hc_handle, dev_addr); 274 312 if (dev == NULL) { 275 313 continue; -
uspace/app/usbinfo/usbinfo.h
rd2bff2f r76ef94e 71 71 } 72 72 73 usbinfo_device_t *prepare_device( devman_handle_t, usb_address_t);73 usbinfo_device_t *prepare_device(const char *, devman_handle_t, usb_address_t); 74 74 void destroy_device(usbinfo_device_t *); 75 75
Note:
See TracChangeset
for help on using the changeset viewer.
