Changes in / [1f3158c:0c05496] in mainline


Ignore:
Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/usbhub.ma

    r1f3158c r0c05496  
    1110 usb&hub
    2 10 usb&class=hub
  • uspace/drv/usbkbd/usbkbd.ma

    r1f3158c r0c05496  
    1110 usb&class=hid
    2 10 usb&class=HID
    3 10 usb&interface&class=HID
    4210 usb&hid
  • uspace/lib/usb/src/recognise.c

    r1f3158c r0c05496  
    9999       
    100100        return rc;
    101 }
    102 
    103 /** Add match ids based on configuration descriptor.
    104  *
    105  * @param hc Open phone to host controller.
    106  * @param matches Match ids list to add matches to.
    107  * @param address USB address of the attached device.
    108  * @return Error code.
    109  */
    110 static int usb_add_config_descriptor_match_ids(int hc,
    111     match_id_list_t *matches, usb_address_t address,
    112     int config_count)
    113 {
    114         int final_rc = EOK;
    115        
    116         int config_index;
    117         for (config_index = 0; config_index < config_count; config_index++) {
    118                 int rc;
    119                 usb_standard_configuration_descriptor_t config_descriptor;
    120                 rc = usb_drv_req_get_bare_configuration_descriptor(hc,
    121                     address,  config_index, &config_descriptor);
    122                 if (rc != EOK) {
    123                         final_rc = rc;
    124                         continue;
    125                 }
    126 
    127                 size_t full_config_descriptor_size;
    128                 void *full_config_descriptor
    129                     = malloc(config_descriptor.total_length);
    130                 rc = usb_drv_req_get_full_configuration_descriptor(hc,
    131                     address, config_index,
    132                     full_config_descriptor, config_descriptor.total_length,
    133                     &full_config_descriptor_size);
    134                 if (rc != EOK) {
    135                         final_rc = rc;
    136                         continue;
    137                 }
    138                 if (full_config_descriptor_size
    139                     != config_descriptor.total_length) {
    140                         final_rc = ERANGE;
    141                         continue;
    142                 }
    143 
    144                 /*
    145                  * Iterate through config descriptor to find the interface
    146                  * descriptors.
    147                  */
    148                 size_t position = sizeof(config_descriptor);
    149                 while (position + 1 < full_config_descriptor_size) {
    150                         uint8_t *current_descriptor
    151                             = ((uint8_t *) full_config_descriptor) + position;
    152                         uint8_t cur_descr_len = current_descriptor[0];
    153                         uint8_t cur_descr_type = current_descriptor[1];
    154                        
    155                         position += cur_descr_len;
    156                        
    157                         if (cur_descr_type != USB_DESCTYPE_INTERFACE) {
    158                                 continue;
    159                         }
    160                         /*
    161                          * Finally, we found an interface descriptor.
    162                          */
    163                         usb_standard_interface_descriptor_t *interface
    164                             = (usb_standard_interface_descriptor_t *)
    165                             current_descriptor;
    166                        
    167                         rc = usb_add_match_id(matches, 50,
    168                             "usb&interface&class=%s",
    169                             usb_str_class(interface->interface_class));
    170                         if (rc != EOK) {
    171                                 final_rc = rc;
    172                                 break;
    173                         }
    174                 }
    175         }
    176        
    177         return final_rc;
    178101}
    179102
     
    226149
    227150        /*
    228          * If the device class points to interface we skip adding
    229          * class directly.
     151         * If the device class does not point to interface,
     152         * it is added immediatelly, otherwise full configuration
     153         * descriptor must be obtained and parsed.
    230154         */
    231155        if (device_descriptor.device_class != USB_CLASS_USE_INTERFACE) {
     
    235159                        return rc;
    236160                }
    237         }
    238         /*
    239          * Go through all configurations and add matches
    240          * based on interface class.
    241          */
    242         rc = usb_add_config_descriptor_match_ids(hc, matches,
    243             address, device_descriptor.configuration_count);
    244         if (rc != EOK) {
    245                 return rc;
     161        } else {
     162                /* TODO */
    246163        }
    247164
Note: See TracChangeset for help on using the changeset viewer.