~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to grub-core/kern/term.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-09-13 18:02:04 UTC
  • mfrom: (1.17.15 upstream)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 145.
  • Revision ID: package-import@ubuntu.com-20120913180204-mojnmocbimlom4im
Tags: upstream-2.00
ImportĀ upstreamĀ versionĀ 2.00

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
struct grub_term_input *grub_term_inputs;
30
30
 
31
31
void (*grub_term_poll_usb) (void) = NULL;
 
32
void (*grub_net_poll_cards_idle) (void) = NULL;
32
33
 
33
34
/* Put a Unicode character.  */
34
35
static void
49
50
    {
50
51
      int n;
51
52
 
52
 
      n = 8 - ((term->getxy (term) >> 8) & 7);
 
53
      n = GRUB_TERM_TAB_WIDTH - ((term->getxy (term) >> 8)
 
54
                                 % GRUB_TERM_TAB_WIDTH);
53
55
      while (n--)
54
56
        grub_putcode_dumb (' ', term);
55
57
 
78
80
 
79
81
void (*grub_xputs) (const char *str) = grub_xputs_dumb;
80
82
 
81
 
static int pending_key = GRUB_TERM_NO_KEY;
82
 
 
83
83
int
84
 
grub_checkkey (void)
 
84
grub_getkey_noblock (void)
85
85
{
86
86
  grub_term_input_t term;
87
87
 
88
 
  if (pending_key != GRUB_TERM_NO_KEY)
89
 
    return pending_key;
90
 
 
91
88
  if (grub_term_poll_usb)
92
89
    grub_term_poll_usb ();
93
90
 
 
91
  if (grub_net_poll_cards_idle)
 
92
    grub_net_poll_cards_idle ();
 
93
 
94
94
  FOR_ACTIVE_TERM_INPUTS(term)
95
95
  {
96
 
    pending_key = term->getkey (term);
97
 
    if (pending_key != GRUB_TERM_NO_KEY)
98
 
      return pending_key;
 
96
    int key = term->getkey (term);
 
97
    if (key != GRUB_TERM_NO_KEY)
 
98
      return key;
99
99
  }
100
100
 
101
 
  return -1;
 
101
  return GRUB_TERM_NO_KEY;
102
102
}
103
103
 
104
104
int
108
108
 
109
109
  grub_refresh ();
110
110
 
111
 
  grub_checkkey ();
112
 
  while (pending_key == GRUB_TERM_NO_KEY)
 
111
  while (1)
113
112
    {
 
113
      ret = grub_getkey_noblock ();
 
114
      if (ret != GRUB_TERM_NO_KEY)
 
115
        return ret;
114
116
      grub_cpu_idle ();
115
 
      grub_checkkey ();
116
117
    }
117
 
  ret = pending_key;
118
 
  pending_key = GRUB_TERM_NO_KEY;
119
 
  return ret;
120
118
}
121
119
 
122
 
 
123
120
void
124
121
grub_refresh (void)
125
122
{