All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Vendor power-on button
@ 2010-06-07  0:15 Henrique Ferreiro
  2010-06-07 20:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: Henrique Ferreiro @ 2010-06-07  0:15 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 151 bytes --]

Hi!

I have an Asus EeePC 1005PE. If I did it correctly the address would be
84:1. I am attaching the two files so you can check.

Regards,

Henrique.

[-- Attachment #1.2: Type: text/html, Size: 224 bytes --]

[-- Attachment #2: normal_button.txt --]
[-- Type: text/plain, Size: 522 bytes --]

0000000: 0000 0000 f000 0e80 02ff ff2f 00ff 3f10  .........../..?.
0000010: 0000 3f00 0000 0000 0000 0040 4747 4707  ..?........@GGG.
0000020: 0656 ffff 20b7 bff6 0300 0000 0000 1e1e  .V.. ...........
0000030: 14f5 0000 0000 0000 0000 0000 0000 802f  .............../
0000040: 2c00 0000 01fe 0221 4365 87a9 0b21 8354  ,......!Ce...!.T
0000050: 7698 f500 0000 0000 0000 00ba 0005 0000  v...............
0000060: 2408 0000 0000 0000 0000 001a 081a 3058  $.............0X
0000070: 0080                                     ..

[-- Attachment #3: vendor_button.txt --]
[-- Type: text/plain, Size: 522 bytes --]

0000000: 0000 0000 f000 0e80 02ff ff2f 00ff 3f10  .........../..?.
0000010: 0000 3f00 0000 0000 0000 0040 4747 4707  ..?........@GGG.
0000020: 0656 ffff 20b7 bff6 0300 0000 0000 1e1e  .V.. ...........
0000030: 14f5 0000 0000 0000 0000 0000 0000 802f  .............../
0000040: 2c00 0000 01fe 0021 4365 87a9 0b21 8354  ,......!Ce...!.T
0000050: 7698 f500 0000 0000 0000 00ba 0005 0000  v...............
0000060: 2408 0000 0000 0000 0000 001a 081a 3058  $.............0X
0000070: 0080                                     ..

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  2010-06-07  0:15 Vendor power-on button Henrique Ferreiro
@ 2010-06-07 20:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2010-06-08 13:41   ` Henrique Ferreiro
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-06-07 20:26 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

On 06/07/2010 02:15 AM, Henrique Ferreiro wrote:
> Hi!
>
> I have an Asus EeePC 1005PE. If I did it correctly the address would
> be 84:1. I am attaching the two files so you can check.
>
It looks correct. Did you try using GRUB_DEFAULT_BUTTON ?
> Regards,
>
> Henrique.
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Henrique Ferreiro @ 2010-06-08 13:41 UTC (permalink / raw)
  To: The development of GNU GRUB

> It looks correct. Did you try using GRUB_DEFAULT_BUTTON ?

Sorry I am not using mainline and I can't do such a change right now.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  2010-06-08 13:41   ` Henrique Ferreiro
@ 2010-06-09 20:26     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-06-09 20:26 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

On 06/08/2010 03:41 PM, Henrique Ferreiro wrote:
>> It looks correct. Did you try using GRUB_DEFAULT_BUTTON ?
>>     
> Sorry I am not using mainline and I can't do such a change right now.
>
>   
Ok. I added this info to the texinfo manual marking it as "non-confirmed".
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  2010-06-28  8:28   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-07-17  0:37     ` Paul Vojta
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Vojta @ 2010-07-17  0:37 UTC (permalink / raw)
  To: The development of GNU GRUB

On Mon, Jun 28, 2010 at 10:28:04AM +0200, Vladimir '?-coder/phcoder' Serbinenko wrote:
> 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

That didn't help (and, noticing a typo in your patch, neither did adding
GRUB_BUTTON_CMOS_CLEAN=prettyplease).

I don't know how Windows decides to start up Media Direct, but I think the
best way to solve my problem is to replace the file MDirect.exe with
something innocuous.

Anyway, thanks for trying.

--Paul Vojta, vojta@math.berkeley.edu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  2010-06-20  4:52 ` Paul Vojta
@ 2010-06-28  8:28   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2010-07-17  0:37     ` Paul Vojta
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-06-28  8:28 UTC (permalink / raw)
  To: grub-devel


[-- 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 --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Vendor power-on button
  2010-05-23 12:31 Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-06-20  4:52 ` Paul Vojta
  2010-06-28  8:28   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Vojta @ 2010-06-20  4:52 UTC (permalink / raw)
  To: The development of GNU GRUB

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?

--Paul Vojta, vojta@math.berkeley.edu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Vendor power-on button
@ 2010-05-23 12:31 Vladimir 'φ-coder/phcoder' Serbinenko
  2010-06-20  4:52 ` Paul Vojta
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-05-23 12:31 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

Hello, all. I've just merged vendor power-on button support into
mainline. Here is extract from manual: <<EOF
Some laptop vendors provide an additional power-on button which boots
another OS.
GRUB supports such buttons with GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON,
GRUB_HIDDEN_TIMEOUT_BUTTON and GRUB_BUTTON_CMOS_ADDRESS variables in
default/grub. GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON and
GRUB_HIDDEN_TIMEOUT_BUTTON are used instead of corresponding variables
without
_BUTTON suffix when powered using special button.
GRUB_BUTTON_CMOS_ADDRESS is vendor specific and partially model-specific.
Values known to GRUB team are:

@table @key
@item Dell XPS M1530
85:3
@end table

EOF

If you have a laptop which has a similar feature could you figure your
address and contribute?
To discover the address do the following:
1) boot normally
2) sudo modprobe nvram
sudo cat /dev/nvram | xxd > normal_button.txt
3) boot using vendor button
sudo modprobe nvram
sudo cat /dev/nvram | xxd > normal_vendor.txt

Then compare these text files and find where a bit was toggled. E.g. in
case of Dell XPS it was:
byte 0x47: 20 --> 28
It's a bit number 3 as seen from following table:
0: 01
1: 02
2: 04
3: 08
4: 10
5: 20
6: 40
7: 80

0x47 is decimal 71. Linux nvram implementation cuts first 14 bytes of
CMOS. So the real byte address in CMOS is 71+4=85
So complete address is 85:3

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-17  0:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-07  0:15 Vendor power-on button 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
  -- strict thread matches above, loose matches on Subject: below --
2010-05-23 12:31 Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-20  4:52 ` Paul Vojta
2010-06-28  8:28   ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-17  0:37     ` Paul Vojta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.