Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r5f6e25e r5cc9eba  
    4242#include <errno.h>
    4343#include <async.h>
    44 #include <async_obsolete.h>
    4544#include <str_error.h>
    4645#include <ipc/mouseev.h>
     
    5352#include "../usbhid.h"
    5453
    55 /** Number of simulated arrow-key presses for singel wheel step. */
    56 #define ARROWS_PER_SINGLE_WHEEL 3
    57 
    58 // FIXME: remove this header
    59 #include <abi/ipc/methods.h>
    60 
    6154#define NAME "mouse"
    6255
    6356/*----------------------------------------------------------------------------*/
    6457
    65 usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
     58const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
    6659        .transfer_type = USB_TRANSFER_INTERRUPT,
    6760        .direction = USB_DIRECTION_IN,
     
    7366
    7467const char *HID_MOUSE_FUN_NAME = "mouse";
    75 const char *HID_MOUSE_WHEEL_FUN_NAME = "mouse-wheel";
    7668const char *HID_MOUSE_CATEGORY = "mouse";
    77 const char *HID_MOUSE_WHEEL_CATEGORY = "keyboard";
    7869
    7970/** Default idle rate for mouses. */
    8071static const uint8_t IDLE_RATE = 0;
    81 static const size_t USB_MOUSE_BUTTON_COUNT = 3;
    82 
    83 /*----------------------------------------------------------------------------*/
    84 
    85 enum {
    86         USB_MOUSE_BOOT_REPORT_DESCRIPTOR_SIZE = 63
    87 };
    88 
    89 static const uint8_t USB_MOUSE_BOOT_REPORT_DESCRIPTOR[
    90     USB_MOUSE_BOOT_REPORT_DESCRIPTOR_SIZE] = {
     72
     73/*----------------------------------------------------------------------------*/
     74static const uint8_t USB_MOUSE_BOOT_REPORT_DESCRIPTOR[] = {
    9175        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    9276        0x09, 0x02,                    // USAGE (Mouse)
     
    128112    ipc_callid_t icallid, ipc_call_t *icall)
    129113{
    130         sysarg_t method = IPC_GET_IMETHOD(*icall);
    131        
    132         usb_mouse_t *mouse_dev = (usb_mouse_t *)fun->driver_data;
    133        
     114        usb_mouse_t *mouse_dev = fun->driver_data;
     115
    134116        if (mouse_dev == NULL) {
    135                 usb_log_debug("default_connection_handler: Missing "
    136                     "parameters.\n");
     117                usb_log_debug("%s: Missing parameters.\n", __FUNCTION__);
    137118                async_answer_0(icallid, EINVAL);
    138119                return;
    139120        }
    140        
    141         usb_log_debug("default_connection_handler: fun->name: %s\n",
    142                       fun->name);
    143         usb_log_debug("default_connection_handler: mouse_phone: %d, wheel "
    144             "phone: %d\n", mouse_dev->mouse_phone, mouse_dev->wheel_phone);
    145        
    146         int *phone = (str_cmp(fun->name, HID_MOUSE_FUN_NAME) == 0)
    147                      ? &mouse_dev->mouse_phone : &mouse_dev->wheel_phone;
    148        
    149         if (method == IPC_M_CONNECT_TO_ME) {
    150                 int callback = IPC_GET_ARG5(*icall);
    151 
    152                 if (*phone != -1) {
    153                         usb_log_debug("default_connection_handler: Console "
    154                             "phone to mouse already set.\n");
     121
     122        usb_log_debug("%s: fun->name: %s\n", __FUNCTION__, fun->name);
     123        usb_log_debug("%s: mouse_sess: %p\n",
     124            __FUNCTION__, mouse_dev->mouse_sess);
     125
     126        async_sess_t *sess =
     127            async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
     128        if (sess != NULL) {
     129                if (mouse_dev->mouse_sess == NULL) {
     130                        mouse_dev->mouse_sess = sess;
     131                        usb_log_debug("Console session to %s set ok (%p).\n",
     132                            fun->name, sess);
     133                        async_answer_0(icallid, EOK);
     134                } else {
     135                        usb_log_error("Console session to %s already set.\n",
     136                            fun->name);
    155137                        async_answer_0(icallid, ELIMIT);
    156                         return;
     138                        async_hangup(sess);
    157139                }
    158 
    159                 *phone = callback;
    160                 usb_log_debug("Console phone to mouse set ok (%d).\n", *phone);
    161                 async_answer_0(icallid, EOK);
    162                 return;
    163         }
    164 
    165         usb_log_debug("default_connection_handler: Invalid function.\n");
    166         async_answer_0(icallid, EINVAL);
    167 }
    168 
    169 /*----------------------------------------------------------------------------*/
    170 
    171 static usb_mouse_t *usb_mouse_new(void)
    172 {
    173         usb_mouse_t *mouse = calloc(1, sizeof(usb_mouse_t));
    174         if (mouse == NULL) {
    175                 return NULL;
    176         }
    177         mouse->mouse_phone = -1;
    178         mouse->wheel_phone = -1;
    179        
    180         return mouse;
    181 }
    182 
    183 /*----------------------------------------------------------------------------*/
    184 
    185 static void usb_mouse_destroy(usb_mouse_t *mouse_dev)
    186 {
    187         assert(mouse_dev != NULL);
    188        
    189         // hangup phone to the console
    190         if (mouse_dev->mouse_phone >= 0) {
    191                 async_obsolete_hangup(mouse_dev->mouse_phone);
    192         }
    193        
    194         if (mouse_dev->wheel_phone >= 0) {
    195                 async_obsolete_hangup(mouse_dev->wheel_phone);
    196         }
    197 }
    198 
    199 /*----------------------------------------------------------------------------*/
    200 
    201 static void usb_mouse_send_wheel(const usb_mouse_t *mouse_dev, int wheel)
    202 {
    203         unsigned int key = (wheel > 0) ? KC_UP : KC_DOWN;
    204 
    205         if (mouse_dev->wheel_phone < 0) {
    206                 usb_log_warning(
    207                     "Connection to console not ready, wheel roll discarded.\n");
    208                 return;
    209         }
    210        
    211         int count = ((wheel < 0) ? -wheel : wheel) * ARROWS_PER_SINGLE_WHEEL;
    212         int i;
    213        
    214         for (i = 0; i < count; i++) {
    215                 /* Send arrow press and release. */
    216                 usb_log_debug2("Sending key %d to the console\n", key);
    217                 async_obsolete_msg_4(mouse_dev->wheel_phone, KBDEV_EVENT,
    218                     KEY_PRESS, key, 0, 0);
    219                 async_obsolete_msg_4(mouse_dev->wheel_phone, KBDEV_EVENT,
    220                     KEY_RELEASE, key, 0, 0);
    221         }
    222 }
    223 
    224 /*----------------------------------------------------------------------------*/
    225 
     140        } else {
     141                usb_log_debug("%s: Invalid function.\n", __FUNCTION__);
     142                async_answer_0(icallid, EINVAL);
     143        }
     144}
     145/*----------------------------------------------------------------------------*/
    226146static int get_mouse_axis_move_value(uint8_t rid, usb_hid_report_t *report,
    227147    int32_t usage)
     
    252172{
    253173        assert(mouse_dev != NULL);
    254        
    255         if (mouse_dev->mouse_phone < 0) {
    256                 usb_log_warning(NAME " No console phone.\n");
     174
     175        if (mouse_dev->mouse_sess == NULL) {
     176                usb_log_warning(NAME " No console session.\n");
    257177                return true;
    258178        }
    259179
    260         int shift_x = get_mouse_axis_move_value(hid_dev->report_id,
    261             hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
    262         int shift_y = get_mouse_axis_move_value(hid_dev->report_id,
    263             hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
    264         int wheel = get_mouse_axis_move_value(hid_dev->report_id,
    265             hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
    266 
    267         if ((shift_x != 0) || (shift_y != 0)) {
    268                 async_obsolete_req_2_0(mouse_dev->mouse_phone,
    269                     MOUSEEV_MOVE_EVENT, shift_x, shift_y);
    270         }
    271 
    272         if (wheel != 0) {
    273                 usb_mouse_send_wheel(mouse_dev, wheel);
    274         }
    275        
    276         /*
    277          * Buttons
    278          */
     180        const int shift_x = get_mouse_axis_move_value(hid_dev->report_id,
     181            &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
     182        const int shift_y = get_mouse_axis_move_value(hid_dev->report_id,
     183            &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
     184        const int wheel = get_mouse_axis_move_value(hid_dev->report_id,
     185            &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
     186
     187        if (shift_x || shift_y || wheel) {
     188                async_exch_t *exch =
     189                    async_exchange_begin(mouse_dev->mouse_sess);
     190                if (exch != NULL) {
     191                        async_msg_3(exch, MOUSEEV_MOVE_EVENT,
     192                            shift_x, shift_y, wheel);
     193                        async_exchange_end(exch);
     194                }
     195        }
     196
     197        /* Buttons */
    279198        usb_hid_report_path_t *path = usb_hid_report_path();
    280         usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
     199        if (path == NULL) {
     200                usb_log_warning("Failed to create USB HID report path.\n");
     201                return true;
     202        }
     203        int ret =
     204           usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
     205        if (ret != EOK) {
     206                usb_hid_report_path_free(path);
     207                usb_log_warning("Failed to add buttons to report path.\n");
     208                return true;
     209        }
    281210        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    282        
     211
    283212        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    284             hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
    285             | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    286             USB_HID_REPORT_TYPE_INPUT);
     213            &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
     214            | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, USB_HID_REPORT_TYPE_INPUT);
    287215
    288216        while (field != NULL) {
    289217                usb_log_debug2(NAME " VALUE(%X) USAGE(%X)\n", field->value,
    290218                    field->usage);
    291                
    292                 if (mouse_dev->buttons[field->usage - field->usage_minimum] == 0
    293                     && field->value != 0) {
    294                         async_obsolete_req_2_0(mouse_dev->mouse_phone,
    295                             MOUSEEV_BUTTON_EVENT, field->usage, 1);
    296                         mouse_dev->buttons[field->usage - field->usage_minimum]
    297                             = field->value;
    298                 } else if (mouse_dev->buttons[field->usage - field->usage_minimum] != 0
    299                     && field->value == 0) {
    300                         async_obsolete_req_2_0(mouse_dev->mouse_phone,
    301                            MOUSEEV_BUTTON_EVENT, field->usage, 0);
    302                         mouse_dev->buttons[field->usage - field->usage_minimum] =
    303                            field->value;
     219                assert(field->usage > field->usage_minimum);
     220                const unsigned index = field->usage - field->usage_minimum;
     221                assert(index < mouse_dev->buttons_count);
     222
     223                if (mouse_dev->buttons[index] == 0 && field->value != 0) {
     224                        async_exch_t *exch =
     225                            async_exchange_begin(mouse_dev->mouse_sess);
     226                        if (exch != NULL) {
     227                                async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
     228                                    field->usage, 1);
     229                                async_exchange_end(exch);
     230                                mouse_dev->buttons[index] = field->value;
     231                        }
     232
     233                } else if (mouse_dev->buttons[index] != 0 && field->value == 0) {
     234                        async_exch_t *exch =
     235                            async_exchange_begin(mouse_dev->mouse_sess);
     236                        if (exch != NULL) {
     237                                async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
     238                                    field->usage, 0);
     239                                async_exchange_end(exch);
     240                                mouse_dev->buttons[index] = field->value;
     241                        }
    304242                }
    305                
     243
    306244                field = usb_hid_report_get_sibling(
    307                     hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
    308                     | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
     245                    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
     246                    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    309247                    USB_HID_REPORT_TYPE_INPUT);
    310248        }
    311        
     249
    312250        usb_hid_report_path_free(path);
    313251
    314252        return true;
    315253}
    316 
    317 /*----------------------------------------------------------------------------*/
    318 
     254/*----------------------------------------------------------------------------*/
     255#define FUN_UNBIND_DESTROY(fun) \
     256if (fun) { \
     257        if (ddf_fun_unbind((fun)) == EOK) { \
     258                (fun)->driver_data = NULL; \
     259                ddf_fun_destroy((fun)); \
     260        } else { \
     261                usb_log_error("Could not unbind function `%s', it " \
     262                    "will not be destroyed.\n", (fun)->name); \
     263        } \
     264} else (void)0
     265/*----------------------------------------------------------------------------*/
    319266static int usb_mouse_create_function(usb_hid_dev_t *hid_dev, usb_mouse_t *mouse)
    320267{
    321268        assert(hid_dev != NULL);
    322269        assert(mouse != NULL);
    323        
     270
    324271        /* Create the exposed function. */
    325272        usb_log_debug("Creating DDF function %s...\n", HID_MOUSE_FUN_NAME);
    326         ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed, 
     273        ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,
    327274            HID_MOUSE_FUN_NAME);
    328275        if (fun == NULL) {
    329                 usb_log_error("Could not create DDF function node.\n");
     276                usb_log_error("Could not create DDF function node `%s'.\n",
     277                    HID_MOUSE_FUN_NAME);
    330278                return ENOMEM;
    331279        }
    332        
     280
    333281        fun->ops = &mouse->ops;
    334282        fun->driver_data = mouse;
     
    336284        int rc = ddf_fun_bind(fun);
    337285        if (rc != EOK) {
    338                 usb_log_error("Could not bind DDF function: %s.\n",
    339                     str_error(rc));
     286                usb_log_error("Could not bind DDF function `%s': %s.\n",
     287                    fun->name, str_error(rc));
     288                fun->driver_data = NULL;
    340289                ddf_fun_destroy(fun);
    341290                return rc;
    342291        }
    343        
    344         usb_log_debug("Adding DDF function to category %s...\n",
    345             HID_MOUSE_CATEGORY);
     292
     293        usb_log_debug("Adding DDF function `%s' to category %s...\n",
     294            fun->name, HID_MOUSE_CATEGORY);
    346295        rc = ddf_fun_add_to_category(fun, HID_MOUSE_CATEGORY);
    347296        if (rc != EOK) {
     
    349298                    "Could not add DDF function to category %s: %s.\n",
    350299                    HID_MOUSE_CATEGORY, str_error(rc));
    351                 ddf_fun_destroy(fun);
     300                FUN_UNBIND_DESTROY(fun);
    352301                return rc;
    353302        }
    354        
    355         /*
    356          * Special function for acting as keyboard (wheel)
    357          */
    358         usb_log_debug("Creating DDF function %s...\n",
    359                       HID_MOUSE_WHEEL_FUN_NAME);
    360         fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,
    361             HID_MOUSE_WHEEL_FUN_NAME);
    362         if (fun == NULL) {
    363                 usb_log_error("Could not create DDF function node.\n");
    364                 return ENOMEM;
    365         }
    366        
    367         /*
    368          * Store the initialized HID device and HID ops
    369          * to the DDF function.
    370          */
    371         fun->ops = &mouse->ops;
    372         fun->driver_data = mouse;
    373 
    374         rc = ddf_fun_bind(fun);
    375         if (rc != EOK) {
    376                 usb_log_error("Could not bind DDF function: %s.\n",
    377                     str_error(rc));
    378                 ddf_fun_destroy(fun);
    379                 return rc;
    380         }
    381        
    382         usb_log_debug("Adding DDF function to category %s...\n",
    383             HID_MOUSE_WHEEL_CATEGORY);
    384         rc = ddf_fun_add_to_category(fun, HID_MOUSE_WHEEL_CATEGORY);
    385         if (rc != EOK) {
    386                 usb_log_error(
    387                     "Could not add DDF function to category %s: %s.\n",
    388                     HID_MOUSE_WHEEL_CATEGORY, str_error(rc));
    389                 ddf_fun_destroy(fun);
    390                 return rc;
    391         }
    392        
     303        mouse->mouse_fun = fun;
     304
    393305        return EOK;
    394306}
    395307
    396 /*----------------------------------------------------------------------------*/
    397 
     308/** Get highest index of a button mentioned in given report.
     309 *
     310 * @param report HID report.
     311 * @param report_id Report id we are interested in.
     312 * @return Highest button mentioned in the report.
     313 * @retval 1 No button was mentioned.
     314 *
     315 */
     316static size_t usb_mouse_get_highest_button(usb_hid_report_t *report, uint8_t report_id)
     317{
     318        size_t highest_button = 0;
     319
     320        usb_hid_report_path_t *path = usb_hid_report_path();
     321        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
     322        usb_hid_report_path_set_report_id(path, report_id);
     323
     324        usb_hid_report_field_t *field = NULL;
     325
     326        /* Break from within. */
     327        while (1) {
     328                field = usb_hid_report_get_sibling(
     329                    report, field, path,
     330                    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     331                    USB_HID_REPORT_TYPE_INPUT);
     332                /* No more buttons? */
     333                if (field == NULL) {
     334                        break;
     335                }
     336
     337                size_t current_button = field->usage - field->usage_minimum;
     338                if (current_button > highest_button) {
     339                        highest_button = current_button;
     340                }
     341        }
     342
     343        usb_hid_report_path_free(path);
     344
     345        return highest_button;
     346}
     347/*----------------------------------------------------------------------------*/
    398348int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
    399349{
    400350        usb_log_debug("Initializing HID/Mouse structure...\n");
    401        
     351
    402352        if (hid_dev == NULL) {
    403353                usb_log_error("Failed to init keyboard structure: no structure"
     
    405355                return EINVAL;
    406356        }
    407        
    408         usb_mouse_t *mouse_dev = usb_mouse_new();
     357
     358        usb_mouse_t *mouse_dev = calloc(1, sizeof(usb_mouse_t));
    409359        if (mouse_dev == NULL) {
    410360                usb_log_error("Error while creating USB/HID Mouse device "
     
    412362                return ENOMEM;
    413363        }
    414        
    415         mouse_dev->buttons = (int32_t *)calloc(USB_MOUSE_BUTTON_COUNT,
    416             sizeof(int32_t));
    417        
     364
     365        // FIXME: This may not be optimal since stupid hardware vendor may
     366        // use buttons 1, 2, 3 and 6000 and we would allocate array of
     367        // 6001*4B and use only 4 items in it.
     368        // Since I doubt that hardware producers would do that, I think
     369        // that the current solution is good enough.
     370        /* Adding 1 because we will be accessing buttons[highest]. */
     371        mouse_dev->buttons_count = 1 + usb_mouse_get_highest_button(
     372            &hid_dev->report, hid_dev->report_id);
     373        mouse_dev->buttons = calloc(mouse_dev->buttons_count, sizeof(int32_t));
     374
    418375        if (mouse_dev->buttons == NULL) {
    419                 usb_log_fatal("No memory!\n");
     376                usb_log_error(NAME ": out of memory, giving up on device!\n");
    420377                free(mouse_dev);
    421378                return ENOMEM;
    422379        }
    423        
    424         // save the Mouse device structure into the HID device structure
    425         *data = mouse_dev;
    426        
     380
    427381        // set handler for incoming calls
    428382        mouse_dev->ops.default_handler = default_connection_handler;
    429        
     383
    430384        // TODO: how to know if the device supports the request???
    431         usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, 
     385        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
    432386            hid_dev->usb_dev->interface_no, IDLE_RATE);
    433        
     387
    434388        int rc = usb_mouse_create_function(hid_dev, mouse_dev);
    435389        if (rc != EOK) {
    436                 usb_mouse_destroy(mouse_dev);
     390                free(mouse_dev->buttons);
     391                free(mouse_dev);
    437392                return rc;
    438393        }
    439        
     394
     395        /* Save the Mouse device structure into the HID device structure. */
     396        *data = mouse_dev;
     397
    440398        return EOK;
    441399}
    442 
    443 /*----------------------------------------------------------------------------*/
    444 
     400/*----------------------------------------------------------------------------*/
    445401bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data)
    446402{
    447403        if (hid_dev == NULL || data == NULL) {
    448                 usb_log_error("Missing argument to the mouse polling callback."
    449                     "\n");
     404                usb_log_error(
     405                    "Missing argument to the mouse polling callback.\n");
    450406                return false;
    451407        }
    452        
    453         usb_mouse_t *mouse_dev = (usb_mouse_t *)data;
    454                
     408
     409        usb_mouse_t *mouse_dev = data;
     410
    455411        return usb_mouse_process_report(hid_dev, mouse_dev);
    456412}
    457 
    458 /*----------------------------------------------------------------------------*/
    459 
     413/*----------------------------------------------------------------------------*/
    460414void usb_mouse_deinit(usb_hid_dev_t *hid_dev, void *data)
    461415{
    462         if (data != NULL) {
    463                 usb_mouse_destroy((usb_mouse_t *)data);
    464         }
    465 }
    466 
    467 /*----------------------------------------------------------------------------*/
    468 
     416        if (data == NULL)
     417                return;
     418
     419        usb_mouse_t *mouse_dev = data;
     420
     421        /* Hangup session to the console */
     422        if (mouse_dev->mouse_sess != NULL) {
     423                const int ret = async_hangup(mouse_dev->mouse_sess);
     424                if (ret != EOK)
     425                        usb_log_warning("Failed to hang up mouse session: "
     426                            "%p, %s.\n", mouse_dev->mouse_sess, str_error(ret));
     427        }
     428
     429        FUN_UNBIND_DESTROY(mouse_dev->mouse_fun);
     430
     431        free(mouse_dev->buttons);
     432        free(mouse_dev);
     433}
     434/*----------------------------------------------------------------------------*/
    469435int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
    470436{
    471         int rc = usb_hid_parse_report_descriptor(hid_dev->report,
    472             USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
    473             USB_MOUSE_BOOT_REPORT_DESCRIPTOR_SIZE);
    474        
     437        int rc = usb_hid_parse_report_descriptor(
     438            &hid_dev->report, USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
     439            sizeof(USB_MOUSE_BOOT_REPORT_DESCRIPTOR));
     440
    475441        if (rc != EOK) {
    476442                usb_log_error("Failed to parse boot report descriptor: %s\n",
     
    478444                return rc;
    479445        }
    480        
    481         rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 
     446
     447        rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe,
    482448            hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT);
    483        
     449
    484450        if (rc != EOK) {
    485451                usb_log_warning("Failed to set boot protocol to the device: "
     
    487453                return rc;
    488454        }
    489        
     455
    490456        return EOK;
    491457}
Note: See TracChangeset for help on using the changeset viewer.