* getting status of frontkeys
@ 2012-03-16 9:12 Joachim Mammele
2012-03-16 10:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 2+ messages in thread
From: Joachim Mammele @ 2012-03-16 9:12 UTC (permalink / raw)
To: grub-devel
Hi everybody,
I wrote a mail to this list some time ago wondering if it might be
possible to get the status of some frontkeys of a tablet.
Vladimir answered me and mentioned that Grub Legacy wouldn't be
supported any more. Would it be possible then with Grub2 instead?
Vladimir answered aswell the following:
> bits9 = system("readFrontKey");
You can't use usual syscalls inside bootloader. GRUB2 has its own API
which is somewhat posix-like but has no such things as "system", pipes
or forks, and normally there shouldn't be any need.
I had a look at this page:
http://www.gnu.org/software/grub/manual/grub.html#Command_002dline-and-menu-entry-commands
So I'm wondering if there might be any way to select the system to boot
depending on which key is pressed?
Greetings
Joachiim
Here my old mail:
----
Hi everybody,
I have got a tablet with special frontkeys and I would like to install
and adapt android on it. This works fine with the project android-x86.org
On grub I would like to select the bootitems with the frontkeys.
The frontkeys can be read with the following code (this is working,
file named readFrontKey.c).
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>
int main()
{
unsigned char bits8, bits9, bits0, bitsA, bitsB, bitsC, bitsD,
bitsE, bits;
if(ioperm(0x208, 8, 1) < 0) {
perror("0x208");
return 1;
}
bits = 32;
outb(bits, 0x20A);
outw(-16832, 0x20C);
bits9 = inb(0x209);
return bits9;
}
But when I add the following code to external/grub/stage2/stage2.c I get an
"undefined reference to `system' " error message:
The code I added to stage2.c (at roundabout line 391) is
bits9 = system("readFrontKey");
if (bits9 == 64)
entryno = 1;
if (bits9 == 32)
entryno = 2;
if (bits9 == 16)
entryno = 3;
goto boot_entry;
/* Check for a keypress, however if TIMEOUT has been expired
(GRUB_TIMEOUT == -1) relax in GETKEY even if no key has been
pressed.
stage2.c has stdlib.h included.
I added the program readfrontkey.c to Makefile.am and also adapted
Makefile.in
Any help woud be apreciated
Joachim Mammele
P.S. The repository that I use can be found here:
http://android-x86.git.sourceforge.net/git/gitweb.cgi?p=android-x86/korg_external_grub.git;a=summary
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: getting status of frontkeys
2012-03-16 9:12 getting status of frontkeys Joachim Mammele
@ 2012-03-16 10:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-03-16 10:48 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: Joachim Mammele
On 16.03.2012 10:12, Joachim Mammele wrote:
> bits = 32;
> outb(bits, 0x20A);
> outw(-16832, 0x20C);
> bits9 = inb(0x209);
> return bits9;
This code is easy to port to GRUB2. Just have a look at cmostest command
to see what wrapping you need and replace in* with grub_in* and out*
with grub_out*
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-16 10:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 9:12 getting status of frontkeys Joachim Mammele
2012-03-16 10:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
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.