Changeset 3f03199 in mainline for uspace/lib/usbhid


Ignore:
Timestamp:
2013-09-15T06:33:53Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9348862
Parents:
dd7078c (diff), 1c0cef0 (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.
Message:

Merge mainline changes.

Major conflicts in USB HC drivers.
Compiles and UHCI works (qemu).
OHCI has device remove problems.

Location:
uspace/lib/usbhid/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/src/hiddescriptor.c

    rdd7078c r3f03199  
    333333        }
    334334
    335         usb_hid_report_description_t *report_des = NULL;
    336        
    337         list_foreach(report->reports, report_it) {
    338                 report_des = list_get_instance(report_it,
    339                                 usb_hid_report_description_t, reports_link);
    340 
     335        list_foreach(report->reports, reports_link,
     336            usb_hid_report_description_t, report_des) {
    341337                // if report id not set, return the first of the type
    342338                if(((report_des->report_id == report_id) || (report_id == 0)) &&
     
    902898void usb_hid_descriptor_print_list(list_t *list)
    903899{
    904         usb_hid_report_field_t *report_item;
    905 
    906900        if(list == NULL || list_empty(list)) {
    907901            usb_log_debug("\tempty\n");
     
    909903        }
    910904
    911         list_foreach(*list, item) {
    912                 report_item = list_get_instance(item, usb_hid_report_field_t,
    913                                 ritems_link);
    914 
     905        list_foreach(*list, ritems_link, usb_hid_report_field_t,
     906            report_item) {
    915907                usb_log_debug("\t\tOFFSET: %X\n", report_item->offset);
    916908                usb_log_debug("\t\tSIZE: %zu\n", report_item->size);
     
    937929
    938930                usb_log_debug("\n");
    939 
    940         }
    941 
     931        }
    942932}
    943933
     
    951941void usb_hid_descriptor_print(usb_hid_report_t *report)
    952942{
    953         if(report == NULL) {
     943        if (report == NULL)
    954944                return;
    955         }
    956 
    957         usb_hid_report_description_t *report_des;
    958 
    959         list_foreach(report->reports, report_it) {
    960                 report_des = list_get_instance(report_it,
    961                         usb_hid_report_description_t, reports_link);
     945
     946        list_foreach(report->reports, reports_link,
     947            usb_hid_report_description_t, report_des) {
    962948                usb_log_debug("Report ID: %d\n", report_des->report_id);
    963949                usb_log_debug("\tType: %d\n", report_des->type);
  • uspace/lib/usbhid/src/hidparser.c

    rdd7078c r3f03199  
    130130    size_t size, uint8_t *report_id)
    131131{
    132         usb_hid_report_field_t *item;
    133 
    134132        usb_hid_report_description_t *report_des;
    135133        usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT;
     
    153151
    154152        /* read data */
    155         list_foreach(report_des->report_items, list_item) {
    156                 item = list_get_instance(list_item, usb_hid_report_field_t,
    157                     ritems_link);
     153        list_foreach(report_des->report_items, ritems_link,
     154            usb_hid_report_field_t, item) {
    158155
    159156                if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
     
    163160                                item->value =
    164161                                        usb_hid_translate_data(item, data);
    165                
     162                               
    166163                                item->usage = USB_HID_EXTENDED_USAGE(
    167164                                    item->usages[item->value -
     
    184181                                /* variable item */
    185182                                item->value = usb_hid_translate_data(item,
    186                                     data);                             
    187                         }                       
     183                                    data);
     184                        }
    188185                }
    189186        }
     
    295292        usb_hid_report_description_t *report_des = NULL;
    296293
    297         list_foreach(report->reports, report_it) {
    298                 report_des = list_get_instance(report_it,
    299                     usb_hid_report_description_t, reports_link);
    300                
    301                 if ((report_des->report_id == report_id) &&
    302                     (report_des->type == USB_HID_REPORT_TYPE_OUTPUT)) {
     294        list_foreach(report->reports, reports_link,
     295            usb_hid_report_description_t, rdes) {
     296                if ((rdes->report_id == report_id) &&
     297                    (rdes->type == USB_HID_REPORT_TYPE_OUTPUT)) {
     298                        report_des = rdes;
    303299                        break;
    304300                }
     
    351347
    352348        if (report->use_report_ids != 0) {
    353                 buffer[0] = report_id;         
     349                buffer[0] = report_id;
    354350        }
    355351
     
    362358        }
    363359
    364         usb_hid_report_field_t *report_item;
    365 
    366         list_foreach(report_des->report_items, item) {
    367                 report_item = list_get_instance(item, usb_hid_report_field_t,
    368                     ritems_link);
    369 
     360        list_foreach(report_des->report_items, ritems_link,
     361            usb_hid_report_field_t, report_item) {
    370362                value = usb_hid_translate_data_reverse(report_item,
    371363                    report_item->value);
     
    382374                        }
    383375                        size_t shift = 8 - offset % 8 - length;
    384                         value = value << shift;                                                 
     376                        value = value << shift;
    385377                        value = value & (((1 << length) - 1) << shift);
    386                                
     378                       
    387379                        uint8_t mask = 0;
    388380                        mask = 0xff - (((1 << length) - 1) << shift);
     
    400392
    401393                                        tmp_value = tmp_value << (offset % 8);
    402        
     394                                       
    403395                                        mask = ~(((1 << (8 - (offset % 8))) - 1)
    404396                                            << (offset % 8));
     
    413405                                        value = value & ((1 << (length -
    414406                                            ((offset + length) % 8))) - 1);
    415                                
     407                                       
    416408                                        mask = (1 << (length -
    417409                                            ((offset + length) % 8))) - 1;
  • uspace/lib/usbhid/src/hidpath.c

    rdd7078c r3f03199  
    176176        usb_log_debug("\tLENGTH: %d\n", path->depth);
    177177
    178         usb_hid_report_usage_path_t *path_item;
    179 
    180         list_foreach(path->items, item) {
    181                 path_item = list_get_instance(item, usb_hid_report_usage_path_t,
    182                         rpath_items_link);
     178        list_foreach(path->items, rpath_items_link,
     179            usb_hid_report_usage_path_t, path_item) {
    183180
    184181                usb_log_debug("\tUSAGE_PAGE: %X\n", path_item->usage_page);
     
    237234                        usb_hid_report_usage_path_t, rpath_items_link);
    238235
    239                 list_foreach(report_path->items, report_link) {
    240                         report_item = list_get_instance(report_link,
    241                                 usb_hid_report_usage_path_t, rpath_items_link);
     236                list_foreach(report_path->items, rpath_items_link,
     237                    usb_hid_report_usage_path_t, report_item) {
     238
     239                        if (USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
     240                                path_item->usage_page)) {
    242241                               
    243                         if(USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
    244                                 path_item->usage_page)){
    245                                        
    246                                 if(only_page == 0){
    247                                         if(USB_HID_SAME_USAGE(
    248                                                 report_item->usage,
    249                                                 path_item->usage)) {
    250                                                        
     242                                if (only_page == 0) {
     243                                        if (USB_HID_SAME_USAGE(report_item->usage,
     244                                            path_item->usage))
    251245                                                return EOK;
    252                                         }
    253246                                }
    254247                                else {
     
    266259                        return 1;
    267260                }
    268                
     261
    269262        /* path is prefix of the report_path */
    270263        case USB_HID_PATH_COMPARE_BEGIN:
    271        
     264
    272265                report_link = report_path->items.head.next;
    273266                path_link = path->items.head.next;
     267               
     268                while ((report_link != &report_path->items.head) &&
     269                    (path_link != &path->items.head)) {
    274270                       
    275                 while((report_link != &report_path->items.head) &&
    276                       (path_link != &path->items.head)) {
    277                                          
    278271                        report_item = list_get_instance(report_link,
    279                                 usb_hid_report_usage_path_t, rpath_items_link);
    280                                          
     272                            usb_hid_report_usage_path_t, rpath_items_link);
     273                       
    281274                        path_item = list_get_instance(path_link,
    282275                                usb_hid_report_usage_path_t, rpath_items_link);
    283276
    284                         if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
    285                                 path_item->usage_page) || ((only_page == 0) &&
     277                        if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
     278                            path_item->usage_page) || ((only_page == 0) &&
    286279                            !USB_HID_SAME_USAGE(report_item->usage,
    287                                 path_item->usage))) {
    288                        
     280                            path_item->usage))) {
    289281                                return 1;
    290                         }
    291                         else {
     282                        } else {
    292283                                report_link = report_link->next;
    293                                 path_link = path_link->next;                   
     284                                path_link = path_link->next;
    294285                        }
    295                        
    296                 }
    297 
    298                 if((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) &&
    299                         (path_link == &path->items.head)) ||
    300                    ((report_link == &report_path->items.head) &&
    301                         (path_link == &path->items.head))) {
    302                                
     286                }
     287
     288                if ((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) &&
     289                    (path_link == &path->items.head)) ||
     290                    ((report_link == &report_path->items.head) &&
     291                    (path_link == &path->items.head))) {
    303292                        return EOK;
    304                 }
    305                 else {
     293                } else {
    306294                        return 1;
    307                 }                                               
     295                }
    308296                break;
    309297
     
    405393        usb_hid_report_path_t *usage_path)
    406394{
    407         usb_hid_report_usage_path_t *path_item;
    408395        usb_hid_report_usage_path_t *new_path_item;
    409396        usb_hid_report_path_t *new_usage_path = usb_hid_report_path ();
     
    419406        }
    420407
    421         list_foreach(usage_path->items, path_link) {
    422                 path_item = list_get_instance(path_link,
    423                         usb_hid_report_usage_path_t, rpath_items_link);
     408        list_foreach(usage_path->items, rpath_items_link,
     409            usb_hid_report_usage_path_t, path_item) {
    424410
    425411                new_path_item = malloc(sizeof(usb_hid_report_usage_path_t));
Note: See TracChangeset for help on using the changeset viewer.