2009-08-24 Colin Watson <cjwatson@ubuntu.com>
* term/usb_keyboard.c (grub_usb_keyboard_getreport): Make `report' grub_uint8_t *. (grub_usb_keyboard_checkkey): Make `data' elements grub_uint8_t. Use a 50-millisecond timeout rather than just repeating grub_usb_keyboard_getreport 50 times. (grub_usb_keyboard_getkey): Make `data' elements grub_uint8_t.
This commit is contained in:
parent
2d21e3e8e0
commit
c385bfc37f
2 changed files with 19 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2009-08-24 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* term/usb_keyboard.c (grub_usb_keyboard_getreport): Make
|
||||||
|
`report' grub_uint8_t *.
|
||||||
|
(grub_usb_keyboard_checkkey): Make `data' elements grub_uint8_t.
|
||||||
|
Use a 50-millisecond timeout rather than just repeating
|
||||||
|
grub_usb_keyboard_getreport 50 times.
|
||||||
|
(grub_usb_keyboard_getkey): Make `data' elements grub_uint8_t.
|
||||||
|
|
||||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Rename *_partition_map to part_*
|
Rename *_partition_map to part_*
|
||||||
|
|
|
@ -97,7 +97,7 @@ grub_usb_hid (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_usb_keyboard_getreport (grub_usb_device_t dev, unsigned char *report)
|
grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report)
|
||||||
{
|
{
|
||||||
return grub_usb_control_msg (dev, (1 << 7) | (1 << 5) | 1, 0x01, 0, 0,
|
return grub_usb_control_msg (dev, (1 << 7) | (1 << 5) | 1, 0x01, 0, 0,
|
||||||
8, (char *) report);
|
8, (char *) report);
|
||||||
|
@ -108,20 +108,24 @@ grub_usb_keyboard_getreport (grub_usb_device_t dev, unsigned char *report)
|
||||||
static int
|
static int
|
||||||
grub_usb_keyboard_checkkey (void)
|
grub_usb_keyboard_checkkey (void)
|
||||||
{
|
{
|
||||||
unsigned char data[8];
|
grub_uint8_t data[8];
|
||||||
int key;
|
int key;
|
||||||
int i;
|
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
grub_uint64_t currtime;
|
||||||
|
int timeout = 50;
|
||||||
|
|
||||||
data[2] = 0;
|
data[2] = 0;
|
||||||
for (i = 0; i < 50; i++)
|
currtime = grub_get_time_ms ();
|
||||||
|
do
|
||||||
{
|
{
|
||||||
/* Get_Report. */
|
/* Get_Report. */
|
||||||
err = grub_usb_keyboard_getreport (usbdev, data);
|
err = grub_usb_keyboard_getreport (usbdev, data);
|
||||||
|
|
||||||
if (! err && data[2])
|
/* Implement a timeout. */
|
||||||
|
if (grub_get_time_ms () > currtime + timeout)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
while (err || !data[2]);
|
||||||
|
|
||||||
if (err || !data[2])
|
if (err || !data[2])
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -174,7 +178,7 @@ grub_usb_keyboard_getkey (void)
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
unsigned char data[8];
|
grub_uint8_t data[8];
|
||||||
grub_uint64_t currtime;
|
grub_uint64_t currtime;
|
||||||
int timeout;
|
int timeout;
|
||||||
static grub_usb_keyboard_repeat_t repeat = GRUB_HIDBOOT_REPEAT_NONE;
|
static grub_usb_keyboard_repeat_t repeat = GRUB_HIDBOOT_REPEAT_NONE;
|
||||||
|
|
Loading…
Reference in a new issue