Changeset fee6381 in mainline


Ignore:
Timestamp:
2011-04-07T20:22:57Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f2e33a
Parents:
f8e8738 (diff), 64dbc83 (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:

Changes from maklf

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/classes/hidparser.h

    rf8e8738 rfee6381  
    9292        /** */ 
    9393        link_t link;
     94
    9495} usb_hid_report_path_t;
    9596
     
    158159       
    159160        int use_report_id;
    160        
     161
     162        /** */
     163        link_t stack;
    161164} usb_hid_report_parser_t;     
    162165
  • uspace/lib/usb/src/hidparser.c

    rf8e8738 rfee6381  
    6464int usb_hid_report_reset_local_items();
    6565void usb_hid_free_report_list(link_t *head);
    66 
     66usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item);
    6767/*
    6868 * Data translation private functions
     
    105105    list_initialize(&(parser->output));
    106106    list_initialize(&(parser->feature));
     107
     108        list_initialize(&(parser->stack));
    107109
    108110        parser->use_report_id = 0;
     
    220222                                        if(!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
    221223                                                return ENOMEM;
    222                                         }
     224                                        }                                       
    223225                                        memcpy(new_report_item,report_item, sizeof(usb_hid_report_item_t));
     226                                        link_initialize(&(new_report_item->link));
     227                                       
    224228                                        /* reset local items */
    225229                                        new_report_item->usage_minimum = 0;
    226230                                        new_report_item->usage_maximum = 0;
     231                                        new_report_item->designator_index = 0;
     232                                        new_report_item->designator_minimum = 0;
     233                                        new_report_item->designator_maximum = 0;
     234                                        new_report_item->string_index = 0;
     235                                        new_report_item->string_minimum = 0;
     236                                        new_report_item->string_maximum = 0;
     237
     238                                        /* reset usage from current usage path */
     239                                        usb_hid_report_usage_path_t *path = list_get_instance(&usage_path->link, usb_hid_report_usage_path_t, link);
     240                                        path->usage = 0;
    227241                                       
    228                                         link_initialize(&(new_report_item->link));
    229242                                        report_item = new_report_item;
    230243                                                                               
     
    232245                                case USB_HID_REPORT_TAG_PUSH:
    233246                                        // push current state to stack
    234                                         // not yet implemented
     247                                        new_report_item = usb_hid_report_item_clone(report_item);
     248                                        list_prepend (&parser->stack, &new_report_item->link);
     249                                       
    235250                                        break;
    236251                                case USB_HID_REPORT_TAG_POP:
    237252                                        // restore current state from stack
    238                                         // not yet implemented                                             
     253                                        if(list_empty (&parser->stack)) {
     254                                                return EINVAL;
     255                                        }
     256                                       
     257                                        report_item = list_get_instance(&parser->stack, usb_hid_report_item_t, link);
     258                                        list_remove (parser->stack.next);
     259                                       
    239260                                        break;
    240261                                       
     
    13631384}
    13641385
     1386
     1387usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item)
     1388{
     1389        usb_hid_report_item_t *new_report_item;
     1390       
     1391        if(!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
     1392                return NULL;
     1393        }                                       
     1394        memcpy(new_report_item,item, sizeof(usb_hid_report_item_t));
     1395        link_initialize(&(new_report_item->link));
     1396
     1397        return new_report_item;
     1398}
     1399
    13651400/**
    13661401 * @}
Note: See TracChangeset for help on using the changeset viewer.