From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1M0TGt-0006qw-O2 for mharc-grub-devel@gnu.org; Sun, 03 May 2009 00:25:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0TGr-0006oo-JG for grub-devel@gnu.org; Sun, 03 May 2009 00:25:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0TGm-0006nW-Ry for grub-devel@gnu.org; Sun, 03 May 2009 00:25:44 -0400 Received: from [199.232.76.173] (port=51532 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0TGm-0006nT-M2 for grub-devel@gnu.org; Sun, 03 May 2009 00:25:40 -0400 Received: from c60.cesmail.net ([216.154.195.49]:49759) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1M0TGm-0007VP-DM for grub-devel@gnu.org; Sun, 03 May 2009 00:25:40 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 03 May 2009 00:25:42 -0400 Received: from [192.168.1.104] (c-69-141-194-35.hsd1.pa.comcast.net [69.141.194.35]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 968F734C6D for ; Sun, 3 May 2009 00:24:14 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090502113928.GC28362@thorin> References: <1240890910.29799.104.camel@mj> <20090502113928.GC28362@thorin> Content-Type: text/plain Date: Sun, 03 May 2009 00:25:31 -0400 Message-Id: <1241324731.8745.36.camel@ct> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: Crash in usb_keyboard X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2009 04:25:45 -0000 On Sat, 2009-05-02 at 13:39 +0200, Robert Millan wrote: > On Mon, Apr 27, 2009 at 11:55:10PM -0400, Pavel Roskin wrote: > > Hello! > > > > Running "terminal_input.usb_keyboard" crashed GRUB (or qemu it's running > > in). It turns out we never check if usbdev in term/usb_keyboard.c is > > not NULL. It is NULL if no USB host controllers have been detected. > > > > I'm not sure if we even want to call grub_term_register_input() if no > > USB keyboard is present. > > What if a keyboard is not present, but plugged in later? If we add support for USB hotplug, then we'll take care of it. I don't think GRUB will support interrupts, but it may get support for timers that would rescan the USB tree periodically. When USB hotplug is not supported, it doesn't really matter if terminal_input.usb_keyboard succeeds of fails in absence of a USB keyboard. By the way, we need to handle the case of multiple keyboards. That would automatically take care of the zero keyboards. It looks like the current code can match non-keyboards. For my keyboard, "lsusb -v" gives: bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 ... bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None The existing code doesn't check interfaces. -- Regards, Pavel Roskin