Changeset 7351dc3 in mainline


Ignore:
Timestamp:
2011-03-10T18:43:13Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e69f10b
Parents:
2f593872 (diff), 60a228f (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:

Merged bugfix

File:
1 edited

Legend:

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

    r2f593872 r7351dc3  
    112112        usb_hid_report_item_t *new_report_item;
    113113
    114         size_t offset=0;
     114        size_t offset_input=0;
     115        size_t offset_output=0;
     116        size_t offset_feature=0;
    115117       
    116118
     
    118120                return ENOMEM;
    119121        }
     122        memset(report_item, 0, sizeof(usb_hid_report_item_t));
     123       
    120124        link_initialize(&(report_item->link)); 
    121125
     
    143147                                        // store report item to report and create the new one
    144148                                        usb_log_debug("\nNEW REPORT ITEM: %X",tag);
    145 
    146                                         report_item->offset = offset;
    147                                         offset += report_item->count * report_item->size;
    148149                                       
    149150                                        switch(tag) {
    150151                                                case USB_HID_REPORT_TAG_INPUT:
     152                                                        report_item->offset = offset_input;
     153                                                        offset_input += report_item->count * report_item->size;
    151154                                                        usb_log_debug(" - INPUT\n");
    152155                                                        list_append(&(report_item->link), &(parser->input));
    153156                                                        break;
    154157                                                case USB_HID_REPORT_TAG_OUTPUT:
     158                                                        report_item->offset = offset_output;
     159                                                        offset_output += report_item->count * report_item->size;
    155160                                                        usb_log_debug(" - OUTPUT\n");
    156161                                                                list_append(&(report_item->link), &(parser->output));
     
    158163                                                        break;
    159164                                                case USB_HID_REPORT_TAG_FEATURE:
     165                                                        report_item->offset = offset_feature;
     166                                                        offset_feature += report_item->count * report_item->size;
    160167                                                        usb_log_debug(" - FEATURE\n");
    161168                                                                list_append(&(report_item->link), &(parser->feature));
     
    652659        }
    653660
    654         if((item->physical_minimum == 0) && (item->physical_maximum ==0)) {
     661        if((item->physical_minimum == 0) && (item->physical_maximum == 0)) {
    655662                item->physical_minimum = item->logical_minimum;
    656663                item->physical_maximum = item->logical_maximum;         
    657664        }
    658665
    659         resolution = (item->logical_maximum - item->logical_minimum) / ((item->physical_maximum - item->physical_minimum) * (usb_pow(10,(item->unit_exponent))));
     666        if(item->physical_maximum == item->physical_minimum){
     667            resolution = 1;
     668        }
     669        else {
     670            resolution = (item->logical_maximum - item->logical_minimum) /
     671                ((item->physical_maximum - item->physical_minimum) *
     672                (usb_pow(10,(item->unit_exponent))));
     673        }
    660674        offset = item->offset + (j * item->size);
    661675       
     
    694708
    695709                usb_log_debug2("offset %d\n", offset);
     710       
    696711                usb_log_debug2("foo %x\n", *foo);
    697712                usb_log_debug2("maska %x\n",  mask);
     
    699714        }
    700715
    701         usb_log_debug2("---\n\n");
     716        usb_log_debug2("---\n\n"); 
    702717
    703718        return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum);
Note: See TracChangeset for help on using the changeset viewer.