Changes in / [1ce4189:6c6a95d2] in mainline


Ignore:
Location:
uspace
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/generic/hiddev.c

    r1ce4189 r6c6a95d2  
    3939#include <errno.h>
    4040#include <str_error.h>
    41 #include <bool.h>
    4241
    4342#include <usbhid_iface.h>
     
    6564    size_t size, size_t *act_size, unsigned int flags);
    6665
    67 static int usb_generic_hid_client_connected(ddf_fun_t *fun);
    68 
    6966/*----------------------------------------------------------------------------*/
    7067
     
    7572
    7673static ddf_dev_ops_t usb_generic_hid_ops = {
    77         .interfaces[USBHID_DEV_IFACE] = &usb_generic_iface,
    78         .open = usb_generic_hid_client_connected
     74        .interfaces[USBHID_DEV_IFACE] = &usb_generic_iface
    7975};
    8076
     
    108104       
    109105        /*! @todo This should probably be atomic. */
    110         if (usb_hid_report_ready()) {
    111                 memcpy(buffer, hid_dev->input_report,
    112                     hid_dev->input_report_size);
    113                 *act_size = hid_dev->input_report_size;
    114                 usb_hid_report_received();
    115         }
     106        memcpy(buffer, hid_dev->input_report, hid_dev->input_report_size);
     107        *act_size = hid_dev->input_report_size;
    116108       
    117109        // clear the buffer so that it will not be received twice
    118         //memset(hid_dev->input_report, 0, hid_dev->input_report_size);
     110        memset(hid_dev->input_report, 0, hid_dev->input_report_size);
    119111       
    120         // note that we already received this report
    121 //      report_received = true;
    122        
    123         return EOK;
    124 }
    125 
    126 /*----------------------------------------------------------------------------*/
    127 
    128 static int usb_generic_hid_client_connected(ddf_fun_t *fun)
    129 {
    130         usb_hid_report_received();
    131112        return EOK;
    132113}
  • uspace/drv/usbhid/kbd/kbddev.c

    r1ce4189 r6c6a95d2  
    255255       
    256256        if (hid_dev == NULL || hid_dev->data == NULL) {
    257                 usb_log_debug("default_connection_handler: "
    258                     "Missing parameter.\n");
    259257                async_answer_0(icallid, EINVAL);
    260258                return;
     
    269267
    270268                if (kbd_dev->console_phone != -1) {
    271                         usb_log_debug("default_connection_handler: "
    272                             "console phone already set\n");
    273269                        async_answer_0(icallid, ELIMIT);
    274270                        return;
     
    276272
    277273                kbd_dev->console_phone = callback;
    278                
    279                 usb_log_debug("default_connection_handler: OK\n");
    280274                async_answer_0(icallid, EOK);
    281275                return;
    282276        }
    283277       
    284         usb_log_debug("default_connection_handler: Wrong function.\n");
    285278        async_answer_0(icallid, EINVAL);
    286279}
  • uspace/drv/usbhid/mouse/mousedev.c

    r1ce4189 r6c6a95d2  
    4343#include <str_error.h>
    4444#include <ipc/mouse.h>
    45 #include <io/console.h>
    46 
    47 #include <ipc/kbd.h>
    48 #include <io/keycode.h>
    4945
    5046#include "mousedev.h"
     
    6561
    6662const char *HID_MOUSE_FUN_NAME = "mouse";
    67 const char *HID_MOUSE_WHEEL_FUN_NAME = "mouse-wheel";
    6863const char *HID_MOUSE_CLASS_NAME = "mouse";
    69 const char *HID_MOUSE_WHEEL_CLASS_NAME = "keyboard";
    7064
    7165/** Default idle rate for mouses. */
     
    125119       
    126120        if (hid_dev == NULL || hid_dev->data == NULL) {
    127                 usb_log_debug("default_connection_handler: Missing "
    128                     "parameters.\n");
    129121                async_answer_0(icallid, EINVAL);
    130122                return;
     
    135127        usb_mouse_t *mouse_dev = (usb_mouse_t *)hid_dev->data;
    136128       
    137         int *phone = (str_cmp(fun->name, HID_MOUSE_FUN_NAME) == 0)
    138                      ? &mouse_dev->mouse_phone : &mouse_dev->wheel_phone;
    139        
    140129        if (method == IPC_M_CONNECT_TO_ME) {
    141130                int callback = IPC_GET_ARG5(*icall);
    142131
    143                 if (*phone != -1) {
    144                         usb_log_debug("default_connection_handler: Console "
    145                             "phone to mouse already set.\n");
     132                if (mouse_dev->console_phone != -1) {
    146133                        async_answer_0(icallid, ELIMIT);
    147                         //async_answer_0(icallid, EOK);
    148134                        return;
    149135                }
    150136
    151                 *phone = callback;
     137                mouse_dev->console_phone = callback;
    152138                usb_log_debug("Console phone to mouse set ok (%d).\n", callback);
    153139                async_answer_0(icallid, EOK);
     
    155141        }
    156142
    157         usb_log_debug("default_connection_handler: Invalid function.\n");
    158143        async_answer_0(icallid, EINVAL);
    159144}
     
    167152                return NULL;
    168153        }
    169         mouse->mouse_phone = -1;
    170         mouse->wheel_phone = -1;
     154        mouse->console_phone = -1;
    171155       
    172156        return mouse;
     
    180164       
    181165        // hangup phone to the console
    182         if ((*mouse_dev)->mouse_phone >= 0) {
    183                 async_hangup((*mouse_dev)->mouse_phone);
    184         }
    185        
    186         if ((*mouse_dev)->wheel_phone >= 0) {
    187                 async_hangup((*mouse_dev)->wheel_phone);
     166        if ((*mouse_dev)->console_phone >= 0) {
     167                async_hangup((*mouse_dev)->console_phone);
    188168        }
    189169       
     
    194174/*----------------------------------------------------------------------------*/
    195175
    196 static void usb_mouse_send_wheel(const usb_mouse_t *mouse_dev, int wheel)
    197 {
    198         console_event_t ev;
    199        
    200         ev.type = KEY_PRESS;
    201         ev.key = (wheel > 0) ? KC_UP : (wheel < 0) ? KC_DOWN : 0;
    202         ev.mods = 0;
    203         ev.c = 0;
    204 
    205         if (mouse_dev->wheel_phone < 0) {
    206                 usb_log_warning(
    207                     "Connection to console not ready, key discarded.\n");
    208                 return;
    209         }
    210        
    211         int count = (wheel < 0) ? -wheel : wheel;
    212         int i;
    213        
    214         for (i = 0; i < count * 3; ++i) {
    215                 usb_log_debug2("Sending key %d to the console\n", ev.key);
    216                 async_msg_4(mouse_dev->wheel_phone, KBD_EVENT, ev.type,
    217                     ev.key, ev.mods, ev.c);
    218                 // send key release right away
    219                 async_msg_4(mouse_dev->wheel_phone, KBD_EVENT, KEY_RELEASE,
    220                     ev.key, ev.mods, ev.c);
    221         }
    222 }
    223 
    224 /*----------------------------------------------------------------------------*/
    225 
    226 static bool usb_mouse_process_report(usb_hid_dev_t *hid_dev, uint8_t *buffer,
    227     size_t buffer_size)
     176static bool usb_mouse_process_boot_report(usb_hid_dev_t *hid_dev,
     177    uint8_t *buffer, size_t buffer_size)
    228178{
    229179        usb_mouse_t *mouse_dev = (usb_mouse_t *)hid_dev->data;
     
    232182            usb_debug_str_buffer(buffer, buffer_size, 0));
    233183       
    234         if (mouse_dev->mouse_phone < 0) {
     184        if (mouse_dev->console_phone < 0) {
    235185                usb_log_error(NAME " No console phone.\n");
    236186                return false;   // ??
     
    302252       
    303253        if ((shift_x != 0) || (shift_y != 0)) {
    304                 async_req_2_0(mouse_dev->mouse_phone,
     254                async_req_2_0(mouse_dev->console_phone,
    305255                    MEVENT_MOVE, shift_x, shift_y);
    306256        }
    307        
    308         /*
    309          * Wheel
    310          */
    311         int wheel;
    312        
    313         path = usb_hid_report_path();
    314         usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_GENERIC_DESKTOP,
    315             USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
    316 
    317         usb_hid_report_path_set_report_id(path, report_id);
    318        
    319         field = usb_hid_report_get_sibling(
    320             hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END,
    321             USB_HID_REPORT_TYPE_INPUT);
    322 
    323         if (field != NULL) {
    324                 usb_log_debug(NAME " VALUE(%X) USAGE(%X)\n", field->value,
    325                     field->usage);
    326                 wheel = field->value;
    327         }
    328 
    329         usb_hid_report_path_free(path);
    330        
    331         // send arrow up for positive direction and arrow down for negative
    332         // direction; three arrows for difference of 1
    333         usb_mouse_send_wheel(mouse_dev, wheel);
    334        
    335257       
    336258        /*
     
    352274                if (mouse_dev->buttons[field->usage - field->usage_minimum] == 0
    353275                    && field->value != 0) {
    354                         async_req_2_0(mouse_dev->mouse_phone,
     276                        async_req_2_0(mouse_dev->console_phone,
    355277                            MEVENT_BUTTON, field->usage, 1);
    356278                        mouse_dev->buttons[field->usage - field->usage_minimum]
     
    359281                    mouse_dev->buttons[field->usage - field->usage_minimum] != 0
    360282                    && field->value == 0) {
    361                        async_req_2_0(mouse_dev->mouse_phone,
     283                       async_req_2_0(mouse_dev->console_phone,
    362284                           MEVENT_BUTTON, field->usage, 0);
    363285                       mouse_dev->buttons[field->usage - field->usage_minimum]
     
    415337        }
    416338       
    417         /*
    418          * Special function for acting as keyboard (wheel)
    419          */
    420         usb_log_debug("Creating DDF function %s...\n",
    421                       HID_MOUSE_WHEEL_FUN_NAME);
    422         fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,
    423             HID_MOUSE_WHEEL_FUN_NAME);
    424         if (fun == NULL) {
    425                 usb_log_error("Could not create DDF function node.\n");
    426                 return ENOMEM;
    427         }
    428        
    429         /*
    430          * Store the initialized HID device and HID ops
    431          * to the DDF function.
    432          */
    433         fun->ops = &hid_dev->ops;
    434         fun->driver_data = hid_dev;   // TODO: maybe change to hid_dev->data
    435 
    436         rc = ddf_fun_bind(fun);
    437         if (rc != EOK) {
    438                 usb_log_error("Could not bind DDF function: %s.\n",
    439                     str_error(rc));
    440                 ddf_fun_destroy(fun);
    441                 return rc;
    442         }
    443        
    444         usb_log_debug("Adding DDF function to class %s...\n",
    445             HID_MOUSE_WHEEL_CLASS_NAME);
    446         rc = ddf_fun_add_to_class(fun, HID_MOUSE_WHEEL_CLASS_NAME);
    447         if (rc != EOK) {
    448                 usb_log_error(
    449                     "Could not add DDF function to class %s: %s.\n",
    450                     HID_MOUSE_WHEEL_CLASS_NAME, str_error(rc));
    451                 ddf_fun_destroy(fun);
    452                 return rc;
    453         }
    454        
    455339        return EOK;
    456340}
     
    523407        }
    524408       
    525         return usb_mouse_process_report(hid_dev, buffer, buffer_size);
     409        return usb_mouse_process_boot_report(hid_dev, buffer, buffer_size);
    526410}
    527411
  • uspace/drv/usbhid/mouse/mousedev.h

    r1ce4189 r6c6a95d2  
    4848        //suseconds_t poll_interval_us;
    4949        /** IPC phone to console (consumer). */
    50         int mouse_phone;
    51         int wheel_phone;
     50        int console_phone;
    5251       
    5352        int32_t *buttons;
  • uspace/drv/usbhid/subdrivers.c

    r1ce4189 r6c6a95d2  
    3636#include "subdrivers.h"
    3737#include "usb/classes/hidut.h"
    38 #include "usb/classes/hidpath.h"
    3938
    4039#include "lgtch-ultrax/lgtch-ultrax.h"
    41 #include "mouse/mousedev.h"
    4240
    4341static usb_hid_subdriver_usage_t path_kbd[] = {
    4442        {USB_HIDUT_PAGE_KEYBOARD, 0},
    45         {0, 0}
    46 };
    47 
    48 static usb_hid_subdriver_usage_t path_mouse[] = {
    49         {USB_HIDUT_PAGE_GENERIC_DESKTOP, USB_HIDUT_USAGE_GENERIC_DESKTOP_MOUSE},
    50         {USB_HIDUT_PAGE_GENERIC_DESKTOP,
    51          USB_HIDUT_USAGE_GENERIC_DESKTOP_POINTER},
    52         {0, 0}
    53 };
    54 
    55 static usb_hid_subdriver_usage_t path_mouse2[] = {
    56         {USB_HIDUT_PAGE_GENERIC_DESKTOP, USB_HIDUT_USAGE_GENERIC_DESKTOP_X},
    5743        {0, 0}
    5844};
     
    9379                }
    9480        },
    95         {
    96                 path_mouse,
    97                 -1,
    98                 USB_HID_PATH_COMPARE_COLLECTION_ONLY,
    99                 -1,
    100                 -1,
    101                 {
    102                         .init = usb_mouse_init,
    103                         .deinit = usb_mouse_deinit,
    104                         .poll = usb_mouse_polling_callback,
    105                         .poll_end = NULL
    106                 }
    107         },
    108         {
    109                 path_mouse2,
    110                 -1,
    111                 USB_HID_PATH_COMPARE_END
    112                 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    113                 -1,
    114                 -1,
    115                 {
    116                         .init = usb_mouse_init,
    117                         .deinit = usb_mouse_deinit,
    118                         .poll = usb_mouse_polling_callback,
    119                         .poll_end = NULL
    120                 }
    121         },
    12281        {NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL}}
    12382};
  • uspace/drv/usbhid/usbhid.c

    r1ce4189 r6c6a95d2  
    6363static const int USB_HID_MAX_SUBDRIVERS = 10;
    6464
    65 static fibril_local bool report_received;
    66 
    6765/*----------------------------------------------------------------------------*/
    6866
     
    414412        }
    415413       
    416         if (fallback) {
     414        // TODO: remove the mouse hack
     415        if (hid_dev->poll_pipe_index == USB_HID_MOUSE_POLL_EP_NO ||
     416            fallback) {
    417417                // fall back to boot protocol
    418418                switch (hid_dev->poll_pipe_index) {
     
    509509                                free(input_old);
    510510                        }
    511                         usb_hid_new_report();
    512511                }
    513512        }
     
    590589/*----------------------------------------------------------------------------*/
    591590
    592 void usb_hid_new_report(void)
    593 {
    594         report_received = false;
    595 }
    596 
    597 /*----------------------------------------------------------------------------*/
    598 
    599 void usb_hid_report_received(void)
    600 {
    601         report_received = true;
    602 }
    603 
    604 /*----------------------------------------------------------------------------*/
    605 
    606 bool usb_hid_report_ready(void)
    607 {
    608         return !report_received;
    609 }
    610 
    611 /*----------------------------------------------------------------------------*/
    612 
    613591void usb_hid_free(usb_hid_dev_t **hid_dev)
    614592{
  • uspace/drv/usbhid/usbhid.h

    r1ce4189 r6c6a95d2  
    4444#include <usb/devdrv.h>
    4545#include <usb/classes/hid.h>
    46 #include <bool.h>
    4746
    4847struct usb_hid_dev;
     
    129128//const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev);
    130129
    131 void usb_hid_new_report(void);
    132 
    133 void usb_hid_report_received(void);
    134 
    135 bool usb_hid_report_ready(void);
    136 
    137130void usb_hid_free(usb_hid_dev_t **hid_dev);
    138131
  • uspace/lib/usb/include/usb/classes/hiddescriptor.h

    r1ce4189 r6c6a95d2  
    7878uint32_t usb_hid_report_tag_data_uint32(const uint8_t *data, size_t size);
    7979
    80 usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t *report, usb_hid_report_path_t *cmp_path);
    8180#endif
    8281/**
  • uspace/lib/usb/include/usb/classes/hidpath.h

    r1ce4189 r6c6a95d2  
    4343 * Description of path of usage pages and usages in report descriptor
    4444 */
    45 /** Wanted usage path must be exactly the same as the searched one */
    4645#define USB_HID_PATH_COMPARE_STRICT                             0
    47 /** Wanted usage path must be the suffix in the searched one */
    48 #define USB_HID_PATH_COMPARE_END                        1
    49 /** */
     46#define USB_HID_PATH_COMPARE_END                                1
    5047#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY    4
    5148#define USB_HID_PATH_COMPARE_COLLECTION_ONLY    2 /* porovnava jenom cestu z Kolekci */
    52 /** Searched usage page must be prefix of the other one */
    53 #define USB_HID_PATH_COMPARE_BEGIN              8
    54 /** Searched couple of usage page and usage can be anywhere in usage path */
    55 #define USB_HID_PATH_COMPARE_WHERE              16
    56 /**
    57  * TODO
    58  *  * porovnani zacatek - neni to to samy jako COLLECTION ONLY?? -- TEST
    59  *  * porovnani kdekoliv (jenom s delkou 1 at si to moc nekomplikujem)
    60  */
    6149
    6250
  • uspace/lib/usb/include/usb/classes/hidtypes.h

    r1ce4189 r6c6a95d2  
    165165        /** */ 
    166166        link_t link;
    167 
    168         int in_delimiter;
    169167} usb_hid_report_item_t;
    170168
  • uspace/lib/usb/src/hiddescriptor.c

    r1ce4189 r6c6a95d2  
    4141#include <assert.h>
    4242
    43 
    44 #define OUTSIDE_DELIMITER_SET   0
    45 #define START_DELIMITER_SET     1
    46 #define INSIDE_DELIMITER_SET    2
    47        
    4843/** The new report item flag. Used to determine when the item is completly
    4944 * configured and should be added to the report structure
     
    6156#define USB_HID_UNKNOWN_TAG             -99
    6257
    63 usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t *report, usb_hid_report_path_t *cmp_path)
    64 {
     58
     59/**
     60 * Initialize the report descriptor parser structure
     61 *
     62 * @param parser Report descriptor parser structure
     63 * @return Error code
     64 */
     65int usb_hid_report_init(usb_hid_report_t *report)
     66{
     67        if(report == NULL) {
     68                return EINVAL;
     69        }
     70
     71        memset(report, 0, sizeof(usb_hid_report_t));
     72        list_initialize(&report->reports);
     73        list_initialize(&report->collection_paths);
     74
     75        report->use_report_ids = 0;
     76    return EOK;   
     77}
     78
     79int usb_hid_report_append_fields(usb_hid_report_t *report, usb_hid_report_item_t *report_item)
     80{
     81        usb_hid_report_field_t *field;
     82        int i;
     83
     84
    6585        /* find or append current collection path to the list */
    6686        link_t *path_it = report->collection_paths.next;
     
    6989                path = list_get_instance(path_it, usb_hid_report_path_t, link);
    7090               
    71                 if(usb_hid_report_compare_usage_path(path, cmp_path, USB_HID_PATH_COMPARE_STRICT) == EOK){
     91                if(usb_hid_report_compare_usage_path(path, report_item->usage_path, USB_HID_PATH_COMPARE_STRICT) == EOK){
    7292                        break;
    7393                }                       
     
    7595        }
    7696        if(path_it == &report->collection_paths) {
    77                 path = usb_hid_report_path_clone(cmp_path);                     
     97                path = usb_hid_report_path_clone(report_item->usage_path);                     
    7898                list_append(&path->link, &report->collection_paths);                                   
    7999                report->collection_paths_count++;
    80 
    81                 return path;
    82         }
    83         else {
    84                 return list_get_instance(path_it, usb_hid_report_path_t, link);
    85         }
    86 }
    87 
    88 /**
    89  * Initialize the report descriptor parser structure
    90  *
    91  * @param parser Report descriptor parser structure
    92  * @return Error code
    93  */
    94 int usb_hid_report_init(usb_hid_report_t *report)
    95 {
    96         if(report == NULL) {
    97                 return EINVAL;
    98         }
    99 
    100         memset(report, 0, sizeof(usb_hid_report_t));
    101         list_initialize(&report->reports);
    102         list_initialize(&report->collection_paths);
    103 
    104         report->use_report_ids = 0;
    105     return EOK;   
    106 }
    107 
    108 
    109 /*
    110  *
    111  *
    112  */
    113 int usb_hid_report_append_fields(usb_hid_report_t *report, usb_hid_report_item_t *report_item)
    114 {
    115         usb_hid_report_field_t *field;
    116         int i;
     100        }
    117101
    118102        for(i=0; i<report_item->usages_count; i++){
     
    120104        }
    121105
    122         usb_hid_report_path_t *path = report_item->usage_path; 
     106       
    123107        for(i=0; i<report_item->count; i++){
    124108
     
    128112
    129113                /* fill the attributes */               
     114                field->collection_path = path;
    130115                field->logical_minimum = report_item->logical_minimum;
    131116                field->logical_maximum = report_item->logical_maximum;
     
    144129                if(report_item->usages_count > 0 && ((report_item->usage_minimum == 0) && (report_item->usage_maximum == 0))) {
    145130                        uint32_t usage;
    146                         if(i < report_item->usages_count){
    147                                 usage = report_item->usages[i];
     131                        if(report_item->type != USB_HID_REPORT_TYPE_OUTPUT) {
     132                                if(i < report_item->usages_count){
     133                                        usage = report_item->usages[i];
     134                                }
     135                                else {
     136                                        usage = report_item->usages[report_item->usages_count - 1];
     137                                }
    148138                        }
    149139                        else {
    150                                 usage = report_item->usages[report_item->usages_count - 1];
     140                                if((report_item->count - i - 1) < report_item->usages_count){
     141                                        usage = report_item->usages[(report_item->count - i - 1)];
     142                                }
     143                                else {
     144                                        usage = report_item->usages[report_item->usages_count - 1];
     145                                }
    151146                        }
    152147
     
    164159
    165160                if((USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags) != 0) && (!((report_item->usage_minimum == 0) && (report_item->usage_maximum == 0)))) {
    166                         field->usage = report_item->usage_minimum + i;                                 
    167                 }
    168                
    169                 usb_hid_report_set_last_item(path, USB_HID_TAG_CLASS_GLOBAL, field->usage_page);
    170                 usb_hid_report_set_last_item(path, USB_HID_TAG_CLASS_LOCAL, field->usage);
    171 
    172                 field->collection_path = usb_hid_report_path_try_insert(report, path);
    173 
     161                        if(report_item->type == USB_HID_REPORT_TYPE_INPUT) {
     162                                field->usage = report_item->usage_maximum - i;
     163                        }
     164                        else {
     165                                field->usage = report_item->usage_minimum + i;                                 
     166                        }
     167
     168                }
     169               
    174170                field->size = report_item->size;
    175                
    176                 size_t offset_byte = (report_item->offset + (i * report_item->size)) / 8;
    177                 size_t offset_bit = 8 - ((report_item->offset + (i * report_item->size)) % 8) - report_item->size;
    178 
    179                 field->offset = 8 * offset_byte + offset_bit;
     171                field->offset = report_item->offset + (i * report_item->size);
    180172                if(report_item->id != 0) {
    181173                        field->offset += 8;
     
    272264                return ENOMEM;
    273265        }
    274         usb_hid_report_path_append_item(usage_path, 0, 0);     
    275266       
    276267        while(i<size){ 
     
    358349                                        tmp_usage_path = list_get_instance(report_item->usage_path->link.prev, usb_hid_report_usage_path_t, link);
    359350                                       
    360                                         usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, tmp_usage_path->usage_page);
    361                                         usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, tmp_usage_path->usage);
     351                                        usb_hid_report_set_last_item(usage_path, tmp_usage_path->usage_page, tmp_usage_path->usage);
    362352
    363353                                        usb_hid_report_path_free(report_item->usage_path);
     
    448438                       
    449439                case USB_HID_REPORT_TAG_COLLECTION:
    450                         //TODO: usage_path->flags = *data;
    451                        
    452                         usb_log_debug("APPENDED ITEM TO USAGE PATH (PAGE %d, USAGE %d\n", report_item->usage_page, report_item->usages[report_item->usages_count-1]);
    453                         usb_hid_print_usage_path(usage_path);
    454 
    455                         // set last item
    456                         usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page);
    457                         usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]);
    458                         // append the new one which will be set by common
    459                         // usage/usage page
    460                         usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]);
    461                         usb_hid_print_usage_path(usage_path);
    462 
     440                        // TODO usage_path->flags = *data;
     441                        usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]);                                         
    463442                        usb_hid_report_reset_local_items (report_item);
    464443                        return USB_HID_NO_ACTION;
     
    596575                        break;                 
    597576                case USB_HID_REPORT_TAG_DELIMITER:
    598                         if (report_item->in_delimiter == OUTSIDE_DELIMITER_SET) {
    599                                 report_item->in_delimiter = START_DELIMITER_SET;
    600                         }
    601                         else {
    602                                 report_item->in_delimiter = OUTSIDE_DELIMITER_SET;
    603                         }
    604                        
     577                        //report_item->delimiter = usb_hid_report_tag_data_uint32(data,item_size);
     578                        //TODO:
     579                        //      DELIMITER STUFF
    605580                        break;
    606581               
     
    654629
    655630                usb_log_debug("\t\tOFFSET: %X\n", report_item->offset);
    656                 usb_log_debug("\t\tSIZE: %X\n", report_item->size);                             
     631                usb_log_debug("\t\tSIZE: %zu\n", report_item->size);
    657632                usb_log_debug("\t\tLOGMIN: %d\n", report_item->logical_minimum);
    658633                usb_log_debug("\t\tLOGMAX: %d\n", report_item->logical_maximum);               
     
    665640                usb_log_debug("\t\ttUSAGE: %X\n", report_item->usage);
    666641                usb_log_debug("\t\tUSAGE PAGE: %X\n", report_item->usage_page);
    667                
    668                 //usb_hid_print_usage_path(report_item->collection_path);
    669 
    670                 usb_log_debug("\n");           
     642                                               
     643//              usb_log_debug("\n");           
    671644
    672645        }
     
    693666                usb_log_debug("Report ID: %d\n", report_des->report_id);
    694667                usb_log_debug("\tType: %d\n", report_des->type);
    695                 usb_log_debug("\tLength: %d\n", report_des->bit_length);               
    696                 usb_log_debug("\tItems: %d\n", report_des->item_length);               
     668                usb_log_debug("\tLength: %zu\n", report_des->bit_length);
     669                usb_log_debug("\tItems: %zu\n", report_des->item_length);
    697670
    698671                usb_hid_descriptor_print_list(&report_des->report_items);
  • uspace/lib/usb/src/hidparser.c

    r1ce4189 r6c6a95d2  
    405405                                }
    406406
    407                                 size_t shift = 8 - offset%8 - length;
     407                                size_t shift = offset%8;
    408408
    409409                                value = value << shift;                                                 
Note: See TracChangeset for help on using the changeset viewer.