Changeset 96bfe76 in mainline


Ignore:
Timestamp:
2011-03-25T15:18:13Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c0f158
Parents:
b53d3b7
Message:

Output report API

Location:
uspace/lib/usb
Files:
2 edited

Legend:

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

    rb53d3b7 r96bfe76  
    207207    const usb_hid_report_in_callbacks_t *callbacks, void *arg);
    208208
    209 int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
     209size_t usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
    210210        usb_hid_report_path_t *path, int flags);
    211211
     
    223223void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path, int32_t tag, int32_t data);
    224224int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path, usb_hid_report_path_t *path, int flags);
    225 int     usb_hid_report_path_clone(usb_hid_report_path_t *new_usage_path, usb_hid_report_path_t *usage_path);
    226 
    227 
    228 // output
    229 //      - funkce co vrati cesty poli v output reportu
    230 //      - funkce co pro danou cestu nastavi data
    231 //      - finalize
    232 
     225usb_hid_report_path_t *usb_hid_report_path_clone(usb_hid_report_path_t *usage_path);
     226
     227
     228// output API
     229/** Allocates output report buffer*/
     230uint8_t *usb_hid_report_output(usb_hid_report_parser_t *parser);
     231/** Frees output report buffer*/
     232void usb_hid_report_output_free(uint8_t *output);
     233
     234/** Returns size of output for given usage path */
     235size_t usb_hid_report_output_size(usb_hid_report_parser_t *parser,
     236                                  usb_hid_report_path_t *path, int flags);
     237/** Updates the output report buffer by translated given data */
     238int usb_hid_report_output_translate(usb_hid_report_parser_t *parser,
     239                                    usb_hid_report_path_t *path, int flags,
     240                                    uint8_t *buffer, size_t size,
     241                                    int32_t *data, size_t data_size);
    233242#endif
    234243/**
  • uspace/lib/usb/src/hidparser.c

    rb53d3b7 r96bfe76  
    164164                                        // store current usage path
    165165                                        report_item->usage_path = usage_path;
    166 
    167                                         // new current usage path
    168                                         tmp_usage_path = usb_hid_report_path();
    169166                                       
    170                                         // copy old path to the new one
    171                                         usb_hid_report_path_clone(tmp_usage_path, usage_path);
     167                                        // clone path to the new one
     168                                        tmp_usage_path = usb_hid_report_path_clone(usage_path);
    172169
    173170                                        // swap
     
    796793}
    797794
    798 int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
     795size_t usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
    799796        usb_hid_report_path_t *path, int flags)
    800797{       
     
    949946                        break;
    950947
    951                 /* given path must be the end of the report one*/
     948                /* compare with only the end of path*/
    952949                case USB_HID_PATH_COMPARE_END:
    953950                                report_link = report_path->link.prev;
     
    10191016
    10201017/**
    1021  *
    1022  */
    1023 int     usb_hid_report_path_clone(usb_hid_report_path_t *new_usage_path, usb_hid_report_path_t *usage_path)
     1018 * Clone content of given usage path to the new one
     1019 *
     1020 */
     1021usb_hid_report_path_t *usb_hid_report_path_clone(usb_hid_report_path_t *usage_path)
    10241022{
    10251023        usb_hid_report_usage_path_t *path_item;
    10261024        link_t *path_link;
    1027 
     1025        usb_hid_report_path_t *new_usage_path = usb_hid_report_path ();
     1026
     1027        if(new_usage_path == NULL){
     1028                return NULL;
     1029        }
    10281030       
    10291031        if(list_empty(&usage_path->link)){
    1030                 return EOK;
     1032                return new_usage_path;
    10311033        }
    10321034
     
    10391041        }
    10401042
    1041         return EOK;
     1043        return new_usage_path;
    10421044}
    10431045
Note: See TracChangeset for help on using the changeset viewer.