Changeset e50cd7f in mainline for uspace/lib/usb/src/hidparser.c


Ignore:
Timestamp:
2011-04-17T19:17:55Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63517c2, cfbbe1d3
Parents:
ef354b6 (diff), 8595577b (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:

new report structure fixes

File:
1 edited

Legend:

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

    ref354b6 re50cd7f  
    877877
    878878        offset = item->offset + (j * item->size);
    879        
    880879        // FIXME
    881880        if((size_t)(offset/8) != (size_t)((offset+item->size-1)/8)) {
     
    13521351
    13531352                field = list_get_instance(field_it, usb_hid_report_field_t, link);
    1354                 usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
    1355                 if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {
    1356                         ret++;
    1357                 }
    1358                 usb_hid_report_remove_last_item (field->collection_path);
     1353                if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0){
     1354                        usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
     1355                        if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK) {
     1356                                ret++;
     1357                        }
     1358                        usb_hid_report_remove_last_item (field->collection_path);
     1359                }
    13591360               
    13601361                field_it = field_it->next;
     
    15361537
    15371538/**
    1538  * Clones given report item structure and returns the new one
    1539  *
    1540  * @param item Report item structure to clone
    1541  * @return Clonned item
    1542  */
    1543 usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item)
    1544 {
    1545         usb_hid_report_item_t *new_report_item;
    1546        
    1547         if(!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
    1548                 return NULL;
    1549         }                                       
    1550         memcpy(new_report_item,item, sizeof(usb_hid_report_item_t));
    1551         link_initialize(&(new_report_item->link));
    1552 
    1553         return new_report_item;
    1554 }
    1555 
    1556 
    1557 /**
    15581539 *
    15591540 *
     
    16041585}
    16051586
     1587
     1588usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item)
     1589{
     1590        usb_hid_report_item_t *new_report_item;
     1591       
     1592        if(!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
     1593                return NULL;
     1594        }                                       
     1595        memcpy(new_report_item,item, sizeof(usb_hid_report_item_t));
     1596        link_initialize(&(new_report_item->link));
     1597
     1598        return new_report_item;
     1599}
     1600
     1601
     1602usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report,
     1603                                                        usb_hid_report_field_t *field,
     1604                            usb_hid_report_path_t *path, int flags,
     1605                            usb_hid_report_type_t type)
     1606{
     1607        usb_hid_report_description_t *report_des = usb_hid_report_find_description (report, path->report_id, type);
     1608        link_t *field_it;
     1609       
     1610        if(report_des == NULL){
     1611                return NULL;
     1612        }
     1613
     1614        if(field == NULL){
     1615                // vezmu prvni co mathuje podle path!!
     1616                field_it = report_des->report_items.next;
     1617        }
     1618        else {
     1619                field_it = field->link.next;
     1620        }
     1621
     1622        while(field_it != &report_des->report_items) {
     1623                field = list_get_instance(field_it, usb_hid_report_field_t, link);
     1624                       
     1625                usb_hid_report_path_append_item (field->collection_path, field->usage_page, field->usage);
     1626                if(usb_hid_report_compare_usage_path (field->collection_path, path, flags) == EOK){
     1627                        usb_hid_report_remove_last_item (field->collection_path);
     1628                        usb_log_debug("....OK\n");
     1629                        return field;
     1630                }
     1631                usb_hid_report_remove_last_item (field->collection_path);
     1632
     1633                field_it = field_it->next;
     1634        }
     1635
     1636        return NULL;
     1637}
    16061638/**
    16071639 * @}
Note: See TracChangeset for help on using the changeset viewer.