Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/hidpath.c

    r5f7b75a r9d05599  
    149149                usb_log_debug("\tFLAGS: %d\n", path_item->flags);               
    150150               
    151                 item = item->next;
     151                item = item->next;
    152152        }
    153153}
     
    156156 * Compares two usage paths structures
    157157 *
    158  *
    159  * @param report_path usage path structure to compare with @path
     158 * If USB_HID_PATH_COMPARE_COLLECTION_ONLY flag is given, the last item in report_path structure is forgotten
     159 *
     160 * @param report_path usage path structure to compare
    160161 * @param path usage patrh structure to compare
    161162 * @param flags Flags determining the mode of comparison
     
    178179        }
    179180
    180         // Empty path match all others
    181181        if(path->depth == 0){
    182182                return EOK;
     
    189189       
    190190        switch(flags){
    191                 /* path is somewhere in report_path */
    192                 case USB_HID_PATH_COMPARE_ANYWHERE:
    193                         if(path->depth != 1){
    194                                 return 1;
    195                         }
    196 
    197                         // projit skrz cestu a kdyz nekde sedi tak vratim EOK
    198                         // dojduli az za konec tak nnesedi
    199                         report_link = report_path->head.next;
    200                         path_link = path->head.next;
    201                         path_item = list_get_instance(path_link, usb_hid_report_usage_path_t, link);
    202 
    203                         while(report_link != &report_path->head) {
    204                                 report_item = list_get_instance(report_link, usb_hid_report_usage_path_t, link);
    205                                 if(report_item->usage_page == path_item->usage_page){
    206                                         if(only_page == 0){
    207                                                 if(report_item->usage == path_item->usage) {
    208                                                         return EOK;
    209                                                 }
    210                                         }
    211                                         else {
    212                                                 return EOK;
    213                                         }
    214                                 }
    215 
    216                                 report_link = report_link->next;
    217                         }
    218 
    219                         return 1;
    220                         break;
    221                 /* the paths must be identical */
     191                /* path must be completly identical */
    222192                case USB_HID_PATH_COMPARE_STRICT:
    223193                                if(report_path->depth != path->depth){
    224194                                        return 1;
    225195                                }
    226                
    227                 /* path is prefix of the report_path */
    228                 case USB_HID_PATH_COMPARE_BEGIN:
    229        
     196
    230197                                report_link = report_path->head.next;
    231198                                path_link = path->head.next;
     
    254221                                }
    255222
    256                                 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) && (path_link == &path->head)) ||
    257                                    ((report_link == &report_path->head) && (path_link == &path->head))) {
     223                                if(((report_link == &report_path->head) && (path_link == &path->head)) ||
     224                                   (((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) &&
     225                                    (path_link = &path->head) &&
     226                                    (report_link == report_path->head.prev))) {
    258227                                        return EOK;
    259228                                }
     
    263232                        break;
    264233
    265                 /* path is suffix of report_path */
     234                /* compare with only the end of path*/
    266235                case USB_HID_PATH_COMPARE_END:
    267236
    268                                 report_link = report_path->head.prev;
     237                                if((flags & USB_HID_PATH_COMPARE_COLLECTION_ONLY) != 0) {
     238                                        report_link = report_path->head.prev->prev;
     239                                }
     240                                else {
     241                                        report_link = report_path->head.prev;
     242                                }
    269243                                path_link = path->head.prev;
    270244
Note: See TracChangeset for help on using the changeset viewer.