libpayload: Fix build when both USB and PS/2 keyboard support is disabled
libpayload uses -Werror for some reason right now, and the variable 'c' in curses_getchar is only used if CONFIG_USB_HID or CONFIG_PC_KEYBOARD is defined, giving an unused variable warning that gets promoted to an error. So wrap the variable declaration around appropriate #ifdef's
Signed-off-by: Mart Raudsepp leio@gentoo.org --- libpayload/curses/keyboard.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libpayload/curses/keyboard.c b/libpayload/curses/keyboard.c index 4a96428..4a83391 100644 --- a/libpayload/curses/keyboard.c +++ b/libpayload/curses/keyboard.c @@ -146,7 +146,9 @@ static int cook_serial(unsigned char ch)
static int curses_getchar(int delay) { +#if defined(CONFIG_USB_HID) || defined(CONFIG_PC_KEYBOARD) unsigned short c; +#endif
do { #ifdef CONFIG_USB_HID
Hello Mart!
On Sun, 22 Feb 2009, Mart Raudsepp wrote:
libpayload: Fix build when both USB and PS/2 keyboard support is disabled
libpayload uses -Werror for some reason right now, and the variable 'c' in curses_getchar is only used if CONFIG_USB_HID or CONFIG_PC_KEYBOARD is defined, giving an unused variable warning that gets promoted to an error. So wrap the variable declaration around appropriate #ifdef's
The variable c is also used in the serial console input code just below the PS/2 one, so to trigger the error all of CONFIG_USB_HID, CONFIG_PC_KEYBOARD, and CONFIG_SERIAL_CONSOLE needs to be undefined. I guess we won't get much input to libpayload then. The patch in current form will instead throw an error if CONFIG_SERIAL_CONSOLE is defined while CONFIG_USB_HID and CONFIG_PC_KEYBOARD are not, i.e. for those who build only for serial console.
I propose to include "|| defined(CONFIG_SERIAL_CONSOLE)" in the #if.
With that change included the patch is
Acked-by: Ulf Jordan jordan@chalmers.se
/ulf
On Sun, 2009-02-22 at 10:07 +0100, Ulf Jordan wrote:
Hello Mart!
Hello,
On Sun, 22 Feb 2009, Mart Raudsepp wrote:
libpayload: Fix build when both USB and PS/2 keyboard support is disabled
libpayload uses -Werror for some reason right now, and the variable 'c' in curses_getchar is only used if CONFIG_USB_HID or CONFIG_PC_KEYBOARD is defined, giving an unused variable warning that gets promoted to an error. So wrap the variable declaration around appropriate #ifdef's
The variable c is also used in the serial console input code just below the PS/2 one, so to trigger the error all of CONFIG_USB_HID, CONFIG_PC_KEYBOARD, and CONFIG_SERIAL_CONSOLE needs to be undefined.
oops
I guess we won't get much input to libpayload then.
I think we can improve on top of this and leave keyboard.c out completely in the future if no keyboards are enabled. I'd be quite happy to have input support, but that depends on currently pretty much non-existing OHCI support. Later I will probably add serial console support back to my images, but that depends on getting the serial port GPIO mux with VGA DDC turned back to DDC mode post-bootloader on a GeodeLX that I need to figure out how to do cleanly.
The patch in current form will instead throw an error if CONFIG_SERIAL_CONSOLE is defined while CONFIG_USB_HID and CONFIG_PC_KEYBOARD are not, i.e. for those who build only for serial console.
I propose to include "|| defined(CONFIG_SERIAL_CONSOLE)" in the #if.
Right, wasn't looking closely enough, shouldn't make it fail another way :)
With that change included the patch is
Acked-by: Ulf Jordan jordan@chalmers.se
Thanks, r3957