Changeset 7a2f8ea0 in mainline


Ignore:
Timestamp:
2011-03-02T14:20:12Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30db06c
Parents:
e135751
Message:

Assert replaced with condition

The assert was originally there for debugging purposes. However, there is
no guarantee that the console will create the callback phone immediatelly.
It may be busy doing other things and impatient user may be already tapping
the keyboard. It is definitely better to discard some keys than to crash
the driver ;-).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/kbddev.c

    re135751 r7a2f8ea0  
    289289
    290290        usb_log_debug2("Sending key %d to the console\n", ev.key);
    291         assert(kbd_dev->console_phone != -1);
     291        if (kbd_dev->console_phone < 0) {
     292                usb_log_warning(
     293                    "Connection to console not ready, key discarded.\n");
     294                return;
     295        }
    292296       
    293297        async_msg_4(kbd_dev->console_phone, KBD_EVENT, ev.type, ev.key,
Note: See TracChangeset for help on using the changeset viewer.