From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: Vendor power-on button
Date: Mon, 28 Jun 2010 10:28:04 +0200 [thread overview]
Message-ID: <4C285D14.9040808@gmail.com> (raw)
In-Reply-To: <20100620045258.GA1083@math.berkeley.edu>
[-- Attachment #1.1: Type: text/plain, Size: 1254 bytes --]
On 06/20/2010 06:52 AM, Paul Vojta wrote:
> On Sun, May 23, 2010 at 02:31:05PM +0200, Vladimir '??-coder/phcoder' Serbinenko wrote:
>
>> Hello, all. I've just merged vendor power-on button support into
>> mainline. Here is extract from manual:
>>
> [snip]
>
>
>> If you have a laptop which has a similar feature could you figure your
>> address and contribute?
>>
> I have a Dell XPS M1330, and GRUB_BUTTON_CMOS_ADDRESS=85:3 works also for me.
>
> However, I do have one question.
>
> I have it set up now to boot directly into Linux when I use the main power-on
> button, and I use the auxiliary button to get a boot menu, defaulting
> to Windows. But when I boot Windows using that button, it starts up
> a MediaDirect setup screen (in addition to regular Windows). Would it be
> possible to (optionally) clear the vendor power-on button bit in the
> cmos before booting?
>
Please try the attached patch. And add:
GRUB_BUTTON_CMOS_CLEAN=yes
> --Paul Vojta, vojta@math.berkeley.edu
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: cmosclean.diff --]
[-- Type: text/x-diff; name="cmosclean.diff", Size: 2989 bytes --]
=== modified file 'commands/i386/cmostest.c'
--- commands/i386/cmostest.c 2010-05-22 18:28:09 +0000
+++ commands/i386/cmostest.c 2010-06-28 08:24:28 +0000
@@ -22,20 +22,32 @@
#include <grub/cmos.h>
static grub_err_t
-grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
- int argc, char *argv[])
+parse_args (int argc, char *argv[], int *byte, int *bit)
{
- int byte, bit;
char *rest;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
- byte = grub_strtoul (argv[0], &rest, 0);
+ *byte = grub_strtoul (argv[0], &rest, 0);
if (*rest != ':')
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
- bit = grub_strtoul (rest + 1, 0, 0);
+ *bit = grub_strtoul (rest + 1, 0, 0);
+
+ return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
+ int argc, char *argv[])
+{
+ int byte, bit;
+ grub_err_t err;
+
+ err = parse_args (argc, argv, &byte, &bit);
+ if (err)
+ return err;
if (grub_cmos_read (byte) & (1 << bit))
return GRUB_ERR_NONE;
@@ -43,7 +55,22 @@
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
}
-static grub_command_t cmd;
+static grub_err_t
+grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
+ int argc, char *argv[])
+{
+ int byte, bit;
+ grub_err_t err;
+
+ err = parse_args (argc, argv, &byte, &bit);
+ if (err)
+ return err;
+
+ grub_cmos_write (byte, grub_cmos_read (byte) & (~(1 << bit)));
+ return GRUB_ERR_NONE;
+}
+
+static grub_command_t cmd, cmd_clean;
\f
GRUB_MOD_INIT(cmostest)
@@ -51,9 +78,13 @@
cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
"cmostest BYTE:BIT",
"Test bit at BYTE:BIT in CMOS.");
+ cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
+ "cmosclean BYTE:BIT",
+ "Clean bit at BYTE:BIT in CMOS.");
}
GRUB_MOD_FINI(cmostest)
{
grub_unregister_command (cmd);
+ grub_unregister_command (cmd_clean);
}
=== modified file 'util/grub-mkconfig.in'
--- util/grub-mkconfig.in 2010-06-28 00:39:49 +0000
+++ util/grub-mkconfig.in 2010-06-28 08:26:35 +0000
@@ -254,6 +254,7 @@
GRUB_HIDDEN_TIMEOUT_BUTTON \
GRUB_TIMEOUT_BUTTON \
GRUB_BUTTON_CMOS_ADDRESS \
+ GRUB_BUTTON_CMOS_CLEAN \
GRUB_DISTRIBUTOR \
GRUB_CMDLINE_LINUX \
GRUB_CMDLINE_LINUX_DEFAULT \
=== modified file 'util/grub.d/00_header.in'
--- util/grub.d/00_header.in 2010-06-17 15:01:17 +0000
+++ util/grub.d/00_header.in 2010-06-28 08:25:59 +0000
@@ -253,6 +253,12 @@
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
fi
+if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" != "xyes" ]; then
+ cat <<EOF
+cmosclean $GRUB_BUTTON_CMOS_ADDRESS
+EOF
+fi
+
# Play an initial tune
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
cat << EOF
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
next prev parent reply other threads:[~2010-06-28 8:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-23 12:31 Vendor power-on button Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-20 4:52 ` Paul Vojta
2010-06-28 8:28 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2010-07-17 0:37 ` Paul Vojta
-- strict thread matches above, loose matches on Subject: below --
2010-06-07 0:15 Henrique Ferreiro
2010-06-07 20:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-08 13:41 ` Henrique Ferreiro
2010-06-09 20:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C285D14.9040808@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox