grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Detect key modifier status in 'sleep --interruptible'


From: Robert Millan
Subject: Re: [PATCH] Detect key modifier status in 'sleep --interruptible'
Date: Tue, 25 Aug 2009 00:41:20 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, Aug 24, 2009 at 11:04:19PM +0100, Colin Watson wrote:
> +/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
> +   description of the BIOS Data Area layout.  */
> +struct grub_machine_bios_data_area
> +{
> +  grub_uint8_t unused1[0x17];
> +  grub_uint8_t keyboard_flag_lower; /* 0x17 */ 
> +  grub_uint8_t keyboard_flag_upper; /* 0x17 */ 
> +  grub_uint8_t unused2[0xf0 - 0x19];
> +};

Why split the keyboard field in upper/lower?  We have working 16-bit types :-)

> +static int
> +grub_check_keyboard (void)
> +{
> +  int mods = grub_getkeystatus ();
> +  if (mods >= 0 && (mods & GRUB_TERM_STATUS_SHIFT) != 0)
> +    return 1;
> +
> +  if (grub_checkkey () >= 0 &&
> +      GRUB_TERM_ASCII_CHAR (grub_getkey ()) == GRUB_TERM_ESC)
> +    return 1;
> +
> +  return 0;
> +}

I'm not sure if hardcoding ESC and SHIFT here makes this a bit too ad-hoc.

IIRC you had a more generic approach in mind?

What does everyone think about this?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]