From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1SMyo0-0007PK-SD for mharc-grub-devel@gnu.org; Wed, 25 Apr 2012 05:46:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyny-0007P5-Pc for grub-devel@gnu.org; Wed, 25 Apr 2012 05:46:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMynt-0005wC-RG for grub-devel@gnu.org; Wed, 25 Apr 2012 05:46:34 -0400 Received: from smtprelay02.ispgateway.de ([80.67.31.40]:58304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMynt-0005vy-Hs for grub-devel@gnu.org; Wed, 25 Apr 2012 05:46:29 -0400 Received: from [88.67.16.117] (helo=[192.168.1.11]) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1SMynr-0002D8-08 for grub-devel@gnu.org; Wed, 25 Apr 2012 11:46:27 +0200 Message-ID: <4F97C800.5000307@jomammele.de> Date: Wed, 25 Apr 2012 11:46:40 +0200 From: Joachim Mammele User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: using a new grub command Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Df-Sender: bWFpbEBqb21hbW1lbGUuZGU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.67.31.40 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2012 09:46:36 -0000 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 . */ #include #include #include #include #include #include #include #include #include #include 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; 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); }