Changeset 9e195e2c in mainline for uspace/app/usbinfo/main.c
- Timestamp:
- 2011-05-12T09:03:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d59d0bb
- Parents:
- 456aea3 (diff), c372e03 (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 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/main.c
r456aea3 r9e195e2c 45 45 #include <usb/usbdevice.h> 46 46 #include <usb/pipes.h> 47 #include <usb/host.h> 48 #include <usb/driver.h> 47 49 #include "usbinfo.h" 50 51 static bool try_parse_class_and_address(const char *path, 52 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 53 { 54 size_t class_index; 55 size_t address; 56 int rc; 57 char *ptr; 58 59 rc = str_size_t(path, &ptr, 10, false, &class_index); 60 if (rc != EOK) { 61 return false; 62 } 63 if ((*ptr == ':') || (*ptr == '.')) { 64 ptr++; 65 } else { 66 return false; 67 } 68 rc = str_size_t(ptr, NULL, 10, true, &address); 69 if (rc != EOK) { 70 return false; 71 } 72 rc = usb_ddf_get_hc_handle_by_class(class_index, out_hc_handle); 73 if (rc != EOK) { 74 return false; 75 } 76 if (out_device_address != NULL) { 77 *out_device_address = (usb_address_t) address; 78 } 79 return true; 80 } 48 81 49 82 static bool resolve_hc_handle_and_dev_addr(const char *devpath, … … 60 93 if (str_cmp(devpath, "virt") == 0) { 61 94 devpath = "/virt/usbhc/usb00_a1/usb00_a2"; 95 } 96 97 if (try_parse_class_and_address(devpath, 98 out_hc_handle, out_device_address)) { 99 return true; 62 100 } 63 101 … … 271 309 } 272 310 273 usbinfo_device_t *dev = prepare_device(hc_handle, dev_addr); 311 usbinfo_device_t *dev = prepare_device(devpath, 312 hc_handle, dev_addr); 274 313 if (dev == NULL) { 275 314 continue;
Note:
See TracChangeset
for help on using the changeset viewer.