All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joachim Mammele <mail@jomammele.de>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: using a new grub command
Date: Wed, 25 Apr 2012 11:46:40 +0200	[thread overview]
Message-ID: <4F97C800.5000307@jomammele.de> (raw)

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);

}





             reply	other threads:[~2012-04-25  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  9:46 Joachim Mammele [this message]
2012-04-25  9:57 ` using a new grub command Vladimir 'φ-coder/phcoder' Serbinenko
2012-04-25 12:23   ` Joachim Mammele

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=4F97C800.5000307@jomammele.de \
    --to=mail@jomammele.de \
    --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 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.