Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 04028225 in mainline


Ignore:
Timestamp:
2011-05-20T20:11:39Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
a9ab7f47
Parents:
0edf7c7
Message:

Getting address by handle also moved into libusb

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkbd/main.c

    r0edf7c7 r04028225  
    173173                /* Try to get its address. */
    174174                if (!addr_found) {
    175                         addr = usb_device_get_assigned_address(dev_handle);
     175                        addr = usb_hc_get_address_by_handle(dev_handle);
    176176                        if (addr >= 0) {
    177177                                addr_found = true;
  • uspace/app/usbinfo/main.c

    r0edf7c7 r04028225  
    128128                /* Try to get its address. */
    129129                if (!addr_found) {
    130                         addr = usb_device_get_assigned_address(dev_handle);
     130                        addr = usb_hc_get_address_by_handle(dev_handle);
    131131                        if (addr >= 0) {
    132132                                addr_found = true;
  • uspace/lib/usb/include/usb/hc.h

    r0edf7c7 r04028225  
    6060    devman_handle_t *);
    6161
     62int usb_hc_get_address_by_handle(devman_handle_t);
     63
    6264int usb_ddf_get_hc_handle_by_class(size_t, devman_handle_t *);
    6365
  • uspace/lib/usb/src/hc.c

    r0edf7c7 r04028225  
    171171}
    172172
     173/** Tell USB address assigned to device with given handle.
     174 *
     175 * @param dev_handle Devman handle of the USB device in question.
     176 * @return USB address or negative error code.
     177 */
     178usb_address_t usb_hc_get_address_by_handle(devman_handle_t dev_handle)
     179{
     180        int parent_phone = devman_parent_device_connect(dev_handle,
     181            IPC_FLAG_BLOCKING);
     182        if (parent_phone < 0) {
     183                return parent_phone;
     184        }
     185
     186        sysarg_t address;
     187
     188        int rc = async_req_2_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
     189            IPC_M_USB_GET_ADDRESS,
     190            dev_handle, &address);
     191
     192        if (rc != EOK) {
     193                return rc;
     194        }
     195
     196        async_hangup(parent_phone);
     197
     198        return (usb_address_t) address;
     199}
     200
    173201
    174202/** Get host controller handle by its class index.
  • uspace/lib/usbdev/include/usb/dev/pipes.h

    r0edf7c7 r04028225  
    163163
    164164int usb_device_get_assigned_interface(ddf_dev_t *);
    165 usb_address_t usb_device_get_assigned_address(devman_handle_t);
    166165
    167166int usb_pipe_initialize(usb_pipe_t *, usb_device_connection_t *,
  • uspace/lib/usbdev/src/pipes.c

    r0edf7c7 r04028225  
    9797
    9898        return (int) iface_no;
    99 }
    100 
    101 /** Tell USB address assigned to given device.
    102  *
    103  * @param dev_handle Devman handle of the USB device in question.
    104  * @return USB address or negative error code.
    105  */
    106 usb_address_t usb_device_get_assigned_address(devman_handle_t dev_handle)
    107 {
    108         int parent_phone = devman_parent_device_connect(dev_handle,
    109             IPC_FLAG_BLOCKING);
    110         if (parent_phone < 0) {
    111                 return parent_phone;
    112         }
    113 
    114         sysarg_t address;
    115 
    116         int rc = async_req_2_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
    117             IPC_M_USB_GET_ADDRESS,
    118             dev_handle, &address);
    119 
    120         if (rc != EOK) {
    121                 return rc;
    122         }
    123 
    124         async_hangup(parent_phone);
    125 
    126         return (usb_address_t) address;
    12799}
    128100
Note: See TracChangeset for help on using the changeset viewer.