Changeset 0bd2879 in mainline for uspace/drv/uhci/utils/usb_device.c
- Timestamp:
- 2011-01-08T21:51:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 977fcea
- Parents:
- 602eac5
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/utils/usb_device.c
r602eac5 r0bd2879 32 32 #include <usb/usbdrv.h> 33 33 34 #include "identify.h" 34 #include "debug.h" 35 #include "usb_device.h" 35 36 37 /*----------------------------------------------------------------------------*/ 38 #define CHECK_RET_RETURN(ret, child, message, args...)\ 39 if (ret < 0) { \ 40 uhci_print_error("Failed(%d) to "message, ret, ##args); \ 41 return ret; \ 42 } else (void)0 43 44 int usb_device_init(device_t *device, device_t *hc, usb_address_t address, 45 int hub_port) 46 { 47 assert(device); 48 assert(hc); 49 50 int ret = 0; 51 char *name; 52 53 /* create name */ 54 ret = asprintf(&name, "usbdevice on hc%p/root_hub[%d]/%#x", 55 hc, hub_port, address); 56 CHECK_RET_RETURN(ret, child, "create device name.\n"); 57 58 device->name = name; 59 60 /* use descriptors to identify the device */ 61 ret = usb_device_identify(device, hc, address); 62 CHECK_RET_RETURN(ret, child, "identify device.\n"); 63 64 return EOK; 65 } 66 /*----------------------------------------------------------------------------*/ 36 67 struct device_descriptor_packet 37 68 { … … 66 97 } 67 98 /*----------------------------------------------------------------------------*/ 68 int identify_device(device_t *hc, device_t *child, usb_address_t address)99 int usb_device_identify(device_t *device, device_t *hc, usb_address_t address) 69 100 { 101 assert(device); 102 assert(hc); 103 70 104 struct device_descriptor_packet packet = 71 105 DEVICE_DESCRIPTOR_PACKET_INITIALIZER; … … 73 107 packet.descriptor.device_class = USB_CLASS_HUB; 74 108 usb_drv_create_match_ids_from_device_descriptor( 75 & child->match_ids, &packet.descriptor );109 &device->match_ids, &packet.descriptor ); 76 110 77 111 return 0; 78 112 } 113 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.