Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e61aa80 in mainline


Ignore:
Timestamp:
2012-04-13T05:57:21Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
9b0a6b4
Parents:
6c942e1
Message:

Implement stdin polling for msim

Location:
uspace/app/msim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/msim/helenos.c

    r6c942e1 re61aa80  
    8686}
    8787
    88 bool stdin_poll(char *key)
    89 {
    90         // TODO: implement reading from keyboard
    91         return false;
    92 }
    9388
  • uspace/app/msim/helenos_input.c

    r6c942e1 re61aa80  
    8484}
    8585
     86
     87bool stdin_poll(char *key)
     88{
     89        kbd_event_t ev;
     90        suseconds_t timeout = 0;
     91        errno = EOK;
     92        console_flush(input_prompt->console);
     93        bool has_input = console_get_kbd_event_timeout(input_prompt->console, &ev, &timeout);
     94        if (!has_input) {
     95                return false;
     96        }
     97
     98        if (ev.type != KEY_PRESS)
     99                return false;
     100
     101        *key = ev.c;
     102
     103        return true;
     104}
     105
Note: See TracChangeset for help on using the changeset viewer.