All of lore.kernel.org
 help / color / mirror / Atom feed
* using a new grub command
@ 2012-04-25  9:46 Joachim Mammele
  2012-04-25  9:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Joachim Mammele @ 2012-04-25  9:46 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi,

I've added my code to read the frontkeys to a file 
\grub-1.99.tar\grub-1.99\grub-1.99\grub-core\commands\i386\pc\checkfrontkeys.c 
and it compiles fine (with ./configure, make and make install).
Later on the scripts install the file correctly as I can see 
checkfrontkeys.mod in /boot/grub
So what I then do is adding the following lines to /etc/grub.d/00_header".
After that I execute grub-mkconfig and update-grub2. The command 
checkfrontkeys no appears correctly in /boot/grub/grub.cfg
But on starting my tablet I see error: unknown command 'checkfrontkeys'

Where else do I need to register the command checkfrontkeys so that grub 
recognizes it? (makefiles etc.)

Thank you in advance
Joachim

code added to /etc/grub.d/00_header:
cat << EOF
echo "before checkfrontkeys"
checkfrontkeysresult = checkfrontkeys;
echo checkfrontkeysresult
echo "after checkfrontkeys"
EOF

(cat << EOF
if [ -s \$prefix/grubenv ]; then
   load_env
fi
EOF
....)


/* checkfrontkeys.c - command to play a tune  */
/*
  *  GRUB  --  GRand Unified Bootloader
  *  Copyright (C) 2005,2007,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  GRUB is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */

#include <grub/dl.h>
#include <grub/file.h>
#include <grub/disk.h>
#include <grub/term.h>
#include <grub/misc.h>
#include <grub/machine/time.h>
#include <grub/cpu/io.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub/cmos.h>

GRUB_MOD_LICENSE ("GPLv3+");

static grub_err_t
grub_cmd_checkfrontkeys (grub_command_t cmd __attribute__ ((unused)),
            int argc, char **args)
{

     if(argc == 1) {}
     if(args[0] == args[0]) {}

     unsigned char bits9;
     //unsigned char keybits;

     //keybits = 32;
     grub_outb(32, 0x20A);
     grub_outw(-16832, 0x20C);
     bits9 = grub_inb(0x209);

/*    echo "bits9= "
     echo ${bits9}

     if [${bits9} = 64]; then
         set default="1"
     elif [${bits9} = 32]; then
         set default="2"
     elif [${bits9} = 16]; then
         set default="3"
     else
         set default="0"
     fi*/

     grub_printf ("bits9=%c\n", bits9);
     grub_dprintf ("bits9", "bits9= 0x%02x\n",
         bits9);

     return bits9;
}


static grub_command_t cmd;
\f
GRUB_MOD_INIT(checkfrontkeys)
{
   cmd = grub_register_command ("checkfrontkeys", grub_cmd_checkfrontkeys,
                 0,
                    N_("check the status of the front keys."));
}

GRUB_MOD_FINI(checkfrontkeys)
{
   grub_unregister_command (cmd);

}





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

end of thread, other threads:[~2012-04-25 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25  9:46 using a new grub command Joachim Mammele
2012-04-25  9:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-25 12:23   ` Joachim Mammele

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.